示例#1
0
function collectdata_main()
{
    if (lxfile_exists("/proc/xen") && lxfile_exists("/usr/sbin/xm")) {
        vps__xen::find_traffic();
        vps__xen::find_cpuusage();
    }
    if (lxfile_exists("/proc/vz")) {
        vps__openvz::find_traffic();
        vps__openvz::find_cpuusage();
        vps__openvz::find_memoryusage();
    }
}
示例#2
0
 function importVps()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $objlist = null;
     if ($this->main->__var_vps_driver === 'openvz') {
         if (!lxfile_exists("/etc/vz/conf")) {
             throw new lxException("no_vz_conf_directory", '');
         }
         $list = lscandir_without_dot_or_underscore("/etc/vz/conf");
         foreach ($list as $l) {
             if (!cse($l, ".conf")) {
                 continue;
             }
             if ($l === '0.conf') {
                 continue;
             }
             $object = vps__openvz::createVpsObject($this->main->nname, $l);
             $objlist[$object->nname] = $object;
         }
     } else {
         lxshell_return("chkconfig", "xendomains", "on");
         //lxshell_return("service", "xendomains", "restart");
         $imdriver = $this->main->__var_xenimportdriver;
         $importdriverfile = "{$sgbl->__path_program_htmlbase}/lib/xenimport/xenimport__{$imdriver}.php";
         if (!lxfile_exists($importdriverfile)) {
             throw new lxException("could_not_find_xen_import_driver_file", '');
         }
         include_once $importdriverfile;
         if (!function_exists("__xenimport_get_data")) {
             throw new lxException("no_xenimport_function", '');
         }
         $data = __xenimport_get_data();
         foreach ((array) $data as $input) {
             $object = vps__xen::createVpsObject($this->main->nname, $input);
             $objlist[$object->nname] = $object;
         }
     }
     return $objlist;
 }