[pve-devel] [PATCH manager v4 1/8] add status to node stats
Dominik Csapak
d.csapak at proxmox.com
Fri Nov 3 09:51:32 CET 2017
by default it is unknown,
if it is a standalone node its online
else it is either 'online' or 'offline' depending on the corosync status
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/API2Tools.pm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index 9bd4e49d..2956b5ad 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -33,6 +33,7 @@ sub extract_node_stats {
id => "node/$node",
node => $node,
type => "node",
+ status => 'unknown',
};
if (my $d = $rrd->{"pve2-node/$node"}) {
@@ -43,6 +44,7 @@ sub extract_node_stats {
$entry->{cpu} = ($d->[5] || 0) + 0;
$entry->{mem} = ($d->[8] || 0) + 0;
$entry->{disk} = ($d->[12] || 0) + 0;
+ $entry->{status} = 'online';
}
$entry->{level} = $d->[1];
$entry->{maxcpu} = ($d->[4] || 0) + 0;
@@ -50,6 +52,11 @@ sub extract_node_stats {
$entry->{maxdisk} = ($d->[11] || 0) + 0;
}
+ if ($members && $members->{$node} &&
+ !$members->{$node}->{online}) {
+ $entry->{status} = 'offline';
+ }
+
return $entry;
}
--
2.11.0
More information about the pve-devel
mailing list