implement openvz status update
This commit is contained in:
parent
c6a69e0bb5
commit
6d2c25d4f5
32
bin/pvestatd
32
bin/pvestatd
@ -13,6 +13,7 @@ use PVE::INotify;
|
||||
use PVE::Cluster qw(cfs_read_file);
|
||||
use PVE::Storage;
|
||||
use PVE::QemuServer;
|
||||
use PVE::OpenVZ;
|
||||
use PVE::RPCEnvironment;
|
||||
|
||||
$SIG{'__WARN__'} = sub {
|
||||
@ -194,6 +195,31 @@ sub update_qemu_status {
|
||||
}
|
||||
}
|
||||
|
||||
sub update_openvz_status {
|
||||
|
||||
my $ctime = time();
|
||||
|
||||
my $vmstatus = PVE::OpenVZ::vmstatus();
|
||||
|
||||
foreach my $vmid (keys %$vmstatus) {
|
||||
my $d = $vmstatus->{$vmid};
|
||||
my $data;
|
||||
if ($d->{status} eq 'running') { # running
|
||||
$data = "$d->{uptime}:$d->{name}:$ctime:$d->{cpus}:$d->{cpu}:" .
|
||||
"$d->{maxmem}:$d->{mem}:" .
|
||||
"$d->{maxdisk}:$d->{disk}:" .
|
||||
"$d->{netin}:$d->{netout}:" .
|
||||
"$d->{diskread}:$d->{diskwrite}";
|
||||
} else {
|
||||
$data = "0:$d->{name}:$ctime:$d->{cpus}::" .
|
||||
"$d->{maxmem}::" .
|
||||
"$d->{maxdisk}:$d->{disk}:" .
|
||||
":::";
|
||||
}
|
||||
PVE::Cluster::broadcast_rrd("pve2-vm/$vmid", $data);
|
||||
}
|
||||
}
|
||||
|
||||
sub update_storage_status {
|
||||
|
||||
my $cfg = cfs_read_file("storage.cfg");
|
||||
@ -240,6 +266,12 @@ sub update_status {
|
||||
$err = $@;
|
||||
syslog('err', "qemu status update error: $err") if $err;
|
||||
|
||||
eval {
|
||||
update_openvz_status();
|
||||
};
|
||||
$err = $@;
|
||||
syslog('err', "openvz status update error: $err") if $err;
|
||||
|
||||
eval {
|
||||
update_storage_status();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user