This commit is contained in:
qgarnier 2020-10-30 18:09:35 +01:00 committed by GitHub
parent 0440d7d632
commit 04cc894573
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 32 deletions

View File

@ -341,39 +341,44 @@ sub manage_selection {
device_health => {}
};
my $total = centreon::plugins::misc::convert_bytes(
value => $device->{Hardware}->{memory},
pattern => '([0-9\.]+)(.*)$'
);
my $free = centreon::plugins::misc::convert_bytes(
value => $device->{Hardware}->{freeMemory},
pattern => '([0-9\.]+)(.*)$'
);
$self->{devices}->{ $device->{name} }->{device_memory} = {
display => $device->{name},
total => $total,
free => $free,
used => $total - $free,
prct_used => 100 - ($free * 100 / $total),
prct_free => ($free * 100 / $total)
};
my ($total, $free);
if (defined($device->{Hardware}->{memory})) {
$total = centreon::plugins::misc::convert_bytes(
value => $device->{Hardware}->{memory},
pattern => '([0-9\.]+)(.*)$'
);
$free = centreon::plugins::misc::convert_bytes(
value => $device->{Hardware}->{freeMemory},
pattern => '([0-9\.]+)(.*)$'
);
$self->{devices}->{ $device->{name} }->{device_memory} = {
display => $device->{name},
total => $total,
free => $free,
used => $total - $free,
prct_used => 100 - ($free * 100 / $total),
prct_free => ($free * 100 / $total)
};
}
$total = centreon::plugins::misc::convert_bytes(
value => $device->{Hardware}->{diskSize},
pattern => '([0-9\.]+)(.*)$'
);
$free = centreon::plugins::misc::convert_bytes(
value => $device->{Hardware}->{freeDisk},
pattern => '([0-9\.]+)(.*)$'
);
$self->{devices}->{ $device->{name} }->{device_disk} = {
display => $device->{name},
total => $total,
free => $free,
used => $total - $free,
prct_used => 100 - ($free * 100 / $total),
prct_free => ($free * 100 / $total)
};
if (defined($device->{Hardware}->{diskSize})) {
$total = centreon::plugins::misc::convert_bytes(
value => $device->{Hardware}->{diskSize},
pattern => '([0-9\.]+)(.*)$'
);
$free = centreon::plugins::misc::convert_bytes(
value => $device->{Hardware}->{freeDisk},
pattern => '([0-9\.]+)(.*)$'
);
$self->{devices}->{ $device->{name} }->{device_disk} = {
display => $device->{name},
total => $total,
free => $free,
used => $total - $free,
prct_used => 100 - ($free * 100 / $total),
prct_free => ($free * 100 / $total)
};
}
foreach (@{$device->{alarmSummary}->{rows}}) {
$self->{devices}->{ $device->{name} }->{device_alarms}->{ lc($_->{firstColumnValue}) } = $_->{columnValues}->[0];