by default it is unknown, if the storage is >= 60% full, it is
'nearfull', if it is >= 90% full, it is 'full'
if we have any other information, it is 'available'
we can use this information for the tree
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
storage => $storeid,
node => $node,
type => 'storage',
+ status => 'unknown',
};
if (my $d = $rrd->{"pve2-storage/$node/$storeid"}) {
$entry->{maxdisk} = ($d->[1] || 0) + 0;
$entry->{disk} = ($d->[2] || 0) + 0;
+ $entry->{status} = 'available';
+ if ($entry->{disk} > 0 && $entry->{maxdisk} > 0) {
+ my $usage = $entry->{disk} / $entry->{maxdisk};
+
+ if ($usage >= 0.9) {
+ $entry->{status} = 'full';
+ } elsif ($usage >= 0.6) {
+ $entry->{status} = 'nearfull';
+ }
+ }
}
return $entry;