diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/components/controller.pm b/centreon-plugins/storage/dell/me4/restapi/mode/components/controller.pm index c3ab6a2cc..6d0ae8d5a 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/components/controller.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/components/controller.pm @@ -36,31 +36,41 @@ sub check { $self->{components}->{controller} = {name => 'controllers', total => 0, skip => 0}; return if ($self->check_filter(section => 'controller')); return if (!defined($self->{json_results}->{controllers})); - + foreach my $result (@{$self->{json_results}->{controllers}->{controllers}}) { my $instance = $result->{'durable-id'}; - + next if ($self->check_filter(section => 'controller', instance => $instance)); $self->{components}->{controller}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("Controller '%s' status is '%s', health is '%s', redundancy status is '%s'", - $result->{'durable-id'}, $result->{status}, $result->{health}, $result->{'redundancy-status'})); - + + $self->{output}->output_add( + long_msg => sprintf( + "controller '%s' status is '%s', health is '%s', redundancy status is '%s'", + $result->{'durable-id'}, $result->{status}, $result->{health}, $result->{'redundancy-status'} + ) + ); + my $exit1 = $self->get_severity(section => 'controller', value => $result->{status}); if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit1, - short_msg => sprintf("Controller '%s' status is '%s'", $result->{'durable-id'}, $result->{status})); + $self->{output}->output_add( + severity => $exit1, + short_msg => sprintf("Controller '%s' status is '%s'", $result->{'durable-id'}, $result->{status}) + ); } my $exit2 = $self->get_severity(section => 'controller', value => $result->{health}); if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit2, - short_msg => sprintf("Controller '%s' health is '%s'", $result->{'durable-id'}, $result->{health})); + $self->{output}->output_add( + severity => $exit2, + short_msg => sprintf("Controller '%s' health is '%s'", $result->{'durable-id'}, $result->{health}) + ); } - my $exit3 = $self->get_severity(section => 'controller', value => $result->{health}); + my $exit3 = $self->get_severity(section => 'controller', value => $result->{'redundancy-status'}); if (!$self->{output}->is_status(value => $exit3, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit3, - short_msg => sprintf("Controller '%s' redundancy status is '%s'", $result->{'redundancy-status'}, $result->{health})); + $self->{output}->output_add( + severity => $exit3, + short_msg => sprintf("Controller '%s' redundancy status is '%s'", $result->{'durable-id'}, $result->{'redundancy-status'}) + ); } } } diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/components/disk.pm b/centreon-plugins/storage/dell/me4/restapi/mode/components/disk.pm index d37939110..ddd098a91 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/components/disk.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/components/disk.pm @@ -46,7 +46,7 @@ sub check { $self->{output}->output_add( long_msg => sprintf( - "Disk '%s' status is '%s', health is '%s', state is '%s' [instance = %s] [temperature = %s C]", + "disk '%s' status is '%s', health is '%s', state is '%s' [instance = %s] [temperature = %s C]", $result->{'serial-number'}, $result->{status}, $result->{health}, $result->{state}, $instance, $result->{'temperature-numeric'} ) @@ -99,8 +99,8 @@ sub check { ); } $self->{output}->perfdata_add( - label => 'temperature', unit => 'C', nlabel => 'hardware.disk.temperature.celsius', + unit => 'C', instances => $instance, value => $result->{'temperature-numeric'}, warning => $warn, diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/components/fan.pm b/centreon-plugins/storage/dell/me4/restapi/mode/components/fan.pm index aab2ca4fa..ef519e4b2 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/components/fan.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/components/fan.pm @@ -36,29 +36,37 @@ sub check { $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0}; return if ($self->check_filter(section => 'fan')); return if (!defined($self->{json_results}->{fans})); - + foreach my $result (@{$self->{json_results}->{fans}->{fan}}) { my $instance = $result->{'durable-id'}; - + next if ($self->check_filter(section => 'fan', instance => $instance)); $self->{components}->{fan}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s', health is '%s' [instance = %s] [speed = %s rpm]", - $result->{name}, $result->{status}, $result->{health}, $instance, - $result->{speed})); - + + $self->{output}->output_add( + long_msg => sprintf( + "fan '%s' status is '%s', health is '%s' [instance = %s] [speed = %s rpm]", + $result->{name}, $result->{status}, $result->{health}, $instance, + $result->{speed} + ) + ); + my $exit1 = $self->get_severity(section => 'fan', value => $result->{status}); if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit1, - short_msg => sprintf("Fan '%s' status is '%s'", $result->{name}, $result->{status})); + $self->{output}->output_add( + severity => $exit1, + short_msg => sprintf("Fan '%s' status is '%s'", $result->{name}, $result->{status}) + ); } my $exit2 = $self->get_severity(section => 'fan', value => $result->{health}); if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit2, - short_msg => sprintf("Fan '%s' health is '%s'", $result->{name}, $result->{health})); + $self->{output}->output_add( + severity => $exit2, + short_msg => sprintf("Fan '%s' health is '%s'", $result->{name}, $result->{health}) + ); } - + next if ($result->{speed} !~ /[0-9]/); my ($exit3, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{speed}); if (!$self->{output}->is_status(value => $exit3, compare => 'ok', litteral => 1)) { @@ -66,8 +74,8 @@ sub check { short_msg => sprintf("Fan '%s' speed is %s rpm", $result->{name}, $result->{speed})); } $self->{output}->perfdata_add( - label => 'speed', unit => 'rpm', nlabel => 'hardware.fan.speed.rpm', + unit => 'rpm', instances => $instance, value => $result->{speed}, warning => $warn, diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/components/fru.pm b/centreon-plugins/storage/dell/me4/restapi/mode/components/fru.pm index 8700b7366..7cd0fec61 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/components/fru.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/components/fru.pm @@ -36,21 +36,27 @@ sub check { $self->{components}->{fru} = {name => 'frus', total => 0, skip => 0}; return if ($self->check_filter(section => 'fru')); return if (!defined($self->{json_results}->{frus})); - + foreach my $result (@{$self->{json_results}->{frus}->{'enclosure-fru'}}) { my $instance = $result->{name}; - + next if ($self->check_filter(section => 'fru', instance => $instance)); $self->{components}->{fru}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("FRU '%s' status is '%s'", - $result->{name}, $result->{'fru-status'})); - + + $self->{output}->output_add( + long_msg => sprintf( + "fru '%s' status is '%s'", + $result->{name}, $result->{'fru-status'} + ) + ); + my $exit1 = $self->get_severity(section => 'fru', value => $result->{'fru-status'}); if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit1, - short_msg => sprintf("FRU '%s' status is '%s'", $result->{name}, $result->{'fru-status'})); + $self->{output}->output_add( + severity => $exit1, + short_msg => sprintf("FRU '%s' status is '%s'", $result->{name}, $result->{'fru-status'}) + ); } } } diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/components/psu.pm b/centreon-plugins/storage/dell/me4/restapi/mode/components/psu.pm index 151f35a6a..fa67746c1 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/components/psu.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/components/psu.pm @@ -36,26 +36,34 @@ sub check { $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; return if ($self->check_filter(section => 'psu')); return if (!defined($self->{json_results}->{psus})); - + foreach my $result (@{$self->{json_results}->{psus}->{'power-supplies'}}) { my $instance = $result->{'durable-id'}; - + next if ($self->check_filter(section => 'psu', instance => $instance)); $self->{components}->{psu}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s', health is '%s' [instance = %s]", - $result->{name}, $result->{status}, $result->{health}, $instance)); - + + $self->{output}->output_add( + long_msg => sprintf( + "power supply '%s' status is '%s', health is '%s' [instance = %s]", + $result->{name}, $result->{status}, $result->{health}, $instance + ) + ); + my $exit1 = $self->get_severity(section => 'psu', value => $result->{status}); if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit1, - short_msg => sprintf("Power supply '%s' status is '%s'", $result->{name}, $result->{status})); + $self->{output}->output_add( + severity => $exit1, + short_msg => sprintf("Power supply '%s' status is '%s'", $result->{name}, $result->{status}) + ); } my $exit2 = $self->get_severity(section => 'psu', value => $result->{health}); if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit2, - short_msg => sprintf("Power supply '%s' health is '%s'", $result->{name}, $result->{health})); + $self->{output}->output_add( + severity => $exit2, + short_msg => sprintf("Power supply '%s' health is '%s'", $result->{name}, $result->{health}) + ); } } } diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/components/sensor.pm b/centreon-plugins/storage/dell/me4/restapi/mode/components/sensor.pm index fcbf035bd..7fdb24391 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/components/sensor.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/components/sensor.pm @@ -70,15 +70,21 @@ sub check { next if ($self->check_filter(section => 'sensor', instance => $instance)); $self->{components}->{sensor}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("Sensor '%s' status is '%s' [instance = %s] [value = %s]", - $result->{'sensor-name'}, $result->{status}, $instance, - $result->{value})); - + + $self->{output}->output_add( + long_msg => sprintf( + "sensor '%s' status is '%s' [instance = %s] [value = %s]", + $result->{'sensor-name'}, $result->{status}, $instance, + $result->{value} + ) + ); + my $exit1 = $self->get_severity(section => 'sensor', value => $result->{status}); if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit1, - short_msg => sprintf("sensor '%s' status is '%s'", $result->{'sensor-name'}, $result->{status})); + $self->{output}->output_add( + severity => $exit1, + short_msg => sprintf("sensor '%s' status is '%s'", $result->{'sensor-name'}, $result->{status}) + ); } next if (!defined($mapping{$result->{'sensor-type'}})); @@ -86,11 +92,12 @@ sub check { my $value = $1; my ($exit3, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'sensor', instance => $instance, value => $value); if (!$self->{output}->is_status(value => $exit3, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit3, - short_msg => sprintf("Sensor '%s' value is %s %s", $result->{'sensor-name'}, $value, $mapping{$result->{'sensor-type'}}->{nunit})); + $self->{output}->output_add( + severity => $exit3, + short_msg => sprintf("Sensor '%s' value is %s %s", $result->{'sensor-name'}, $value, $mapping{$result->{'sensor-type'}}->{nunit}) + ); } $self->{output}->perfdata_add( - label => 'sensor', unit => $mapping{$result->{'sensor-type'}}->{unit}, nlabel => 'hardware.sensor.' . $mapping{$result->{'sensor-type'}}->{nlabel} . '.' . $mapping{$result->{'sensor-type'}}->{nunit}, instances => $instance, value => $value, diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/components/volume.pm b/centreon-plugins/storage/dell/me4/restapi/mode/components/volume.pm index 2c72211c9..a77c27a83 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/components/volume.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/components/volume.pm @@ -36,21 +36,27 @@ sub check { $self->{components}->{volume} = {name => 'volumes', total => 0, skip => 0}; return if ($self->check_filter(section => 'volume')); return if (!defined($self->{json_results}->{volumes})); - + foreach my $result (@{$self->{json_results}->{volumes}->{volumes}}) { my $instance = $result->{'durable-id'}; - + next if ($self->check_filter(section => 'volume', instance => $instance)); $self->{components}->{volume}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("Volume '%s' health is '%s' [instance = %s]", - $result->{'volume-name'}, $result->{health}, $instance)); - + + $self->{output}->output_add( + long_msg => sprintf( + "volume '%s' health is '%s' [instance = %s]", + $result->{'volume-name'}, $result->{health}, $instance + ) + ); + my $exit1 = $self->get_severity(section => 'volume', value => $result->{health}); if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit1, - short_msg => sprintf("Volume '%s' health is '%s'", $result->{'volume-name'}, $result->{health})); + $self->{output}->output_add( + severity => $exit1, + short_msg => sprintf("Volume '%s' health is '%s'", $result->{'volume-name'}, $result->{health}) + ); } } }