typo(dell/me4): indent

This commit is contained in:
garnier-quentin 2021-08-12 11:00:42 +02:00
parent e5bde02012
commit c366dec9b7
7 changed files with 109 additions and 64 deletions

View File

@ -36,31 +36,41 @@ sub check {
$self->{components}->{controller} = {name => 'controllers', total => 0, skip => 0}; $self->{components}->{controller} = {name => 'controllers', total => 0, skip => 0};
return if ($self->check_filter(section => 'controller')); return if ($self->check_filter(section => 'controller'));
return if (!defined($self->{json_results}->{controllers})); return if (!defined($self->{json_results}->{controllers}));
foreach my $result (@{$self->{json_results}->{controllers}->{controllers}}) { foreach my $result (@{$self->{json_results}->{controllers}->{controllers}}) {
my $instance = $result->{'durable-id'}; my $instance = $result->{'durable-id'};
next if ($self->check_filter(section => 'controller', instance => $instance)); next if ($self->check_filter(section => 'controller', instance => $instance));
$self->{components}->{controller}->{total}++; $self->{components}->{controller}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Controller '%s' status is '%s', health is '%s', redundancy status is '%s'", $self->{output}->output_add(
$result->{'durable-id'}, $result->{status}, $result->{health}, $result->{'redundancy-status'})); 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}); my $exit1 = $self->get_severity(section => 'controller', value => $result->{status});
if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit1, $self->{output}->output_add(
short_msg => sprintf("Controller '%s' status is '%s'", $result->{'durable-id'}, $result->{status})); 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}); my $exit2 = $self->get_severity(section => 'controller', value => $result->{health});
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit2, $self->{output}->output_add(
short_msg => sprintf("Controller '%s' health is '%s'", $result->{'durable-id'}, $result->{health})); 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)) { if (!$self->{output}->is_status(value => $exit3, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit3, $self->{output}->output_add(
short_msg => sprintf("Controller '%s' redundancy status is '%s'", $result->{'redundancy-status'}, $result->{health})); severity => $exit3,
short_msg => sprintf("Controller '%s' redundancy status is '%s'", $result->{'durable-id'}, $result->{'redundancy-status'})
);
} }
} }
} }

View File

@ -46,7 +46,7 @@ sub check {
$self->{output}->output_add( $self->{output}->output_add(
long_msg => sprintf( 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->{'serial-number'}, $result->{status}, $result->{health}, $result->{state}, $instance,
$result->{'temperature-numeric'} $result->{'temperature-numeric'}
) )
@ -99,8 +99,8 @@ sub check {
); );
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'temperature', unit => 'C',
nlabel => 'hardware.disk.temperature.celsius', nlabel => 'hardware.disk.temperature.celsius',
unit => 'C',
instances => $instance, instances => $instance,
value => $result->{'temperature-numeric'}, value => $result->{'temperature-numeric'},
warning => $warn, warning => $warn,

View File

@ -36,29 +36,37 @@ sub check {
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0}; $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
return if ($self->check_filter(section => 'fan')); return if ($self->check_filter(section => 'fan'));
return if (!defined($self->{json_results}->{fans})); return if (!defined($self->{json_results}->{fans}));
foreach my $result (@{$self->{json_results}->{fans}->{fan}}) { foreach my $result (@{$self->{json_results}->{fans}->{fan}}) {
my $instance = $result->{'durable-id'}; my $instance = $result->{'durable-id'};
next if ($self->check_filter(section => 'fan', instance => $instance)); next if ($self->check_filter(section => 'fan', instance => $instance));
$self->{components}->{fan}->{total}++; $self->{components}->{fan}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s', health is '%s' [instance = %s] [speed = %s rpm]", $self->{output}->output_add(
$result->{name}, $result->{status}, $result->{health}, $instance, long_msg => sprintf(
$result->{speed})); "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}); my $exit1 = $self->get_severity(section => 'fan', value => $result->{status});
if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit1, $self->{output}->output_add(
short_msg => sprintf("Fan '%s' status is '%s'", $result->{name}, $result->{status})); severity => $exit1,
short_msg => sprintf("Fan '%s' status is '%s'", $result->{name}, $result->{status})
);
} }
my $exit2 = $self->get_severity(section => 'fan', value => $result->{health}); my $exit2 = $self->get_severity(section => 'fan', value => $result->{health});
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit2, $self->{output}->output_add(
short_msg => sprintf("Fan '%s' health is '%s'", $result->{name}, $result->{health})); severity => $exit2,
short_msg => sprintf("Fan '%s' health is '%s'", $result->{name}, $result->{health})
);
} }
next if ($result->{speed} !~ /[0-9]/); next if ($result->{speed} !~ /[0-9]/);
my ($exit3, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{speed}); 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)) { 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})); short_msg => sprintf("Fan '%s' speed is %s rpm", $result->{name}, $result->{speed}));
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'speed', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm', nlabel => 'hardware.fan.speed.rpm',
unit => 'rpm',
instances => $instance, instances => $instance,
value => $result->{speed}, value => $result->{speed},
warning => $warn, warning => $warn,

View File

@ -36,21 +36,27 @@ sub check {
$self->{components}->{fru} = {name => 'frus', total => 0, skip => 0}; $self->{components}->{fru} = {name => 'frus', total => 0, skip => 0};
return if ($self->check_filter(section => 'fru')); return if ($self->check_filter(section => 'fru'));
return if (!defined($self->{json_results}->{frus})); return if (!defined($self->{json_results}->{frus}));
foreach my $result (@{$self->{json_results}->{frus}->{'enclosure-fru'}}) { foreach my $result (@{$self->{json_results}->{frus}->{'enclosure-fru'}}) {
my $instance = $result->{name}; my $instance = $result->{name};
next if ($self->check_filter(section => 'fru', instance => $instance)); next if ($self->check_filter(section => 'fru', instance => $instance));
$self->{components}->{fru}->{total}++; $self->{components}->{fru}->{total}++;
$self->{output}->output_add(long_msg => sprintf("FRU '%s' status is '%s'", $self->{output}->output_add(
$result->{name}, $result->{'fru-status'})); long_msg => sprintf(
"fru '%s' status is '%s'",
$result->{name}, $result->{'fru-status'}
)
);
my $exit1 = $self->get_severity(section => 'fru', value => $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)) { if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit1, $self->{output}->output_add(
short_msg => sprintf("FRU '%s' status is '%s'", $result->{name}, $result->{'fru-status'})); severity => $exit1,
short_msg => sprintf("FRU '%s' status is '%s'", $result->{name}, $result->{'fru-status'})
);
} }
} }
} }

View File

@ -36,26 +36,34 @@ sub check {
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
return if ($self->check_filter(section => 'psu')); return if ($self->check_filter(section => 'psu'));
return if (!defined($self->{json_results}->{psus})); return if (!defined($self->{json_results}->{psus}));
foreach my $result (@{$self->{json_results}->{psus}->{'power-supplies'}}) { foreach my $result (@{$self->{json_results}->{psus}->{'power-supplies'}}) {
my $instance = $result->{'durable-id'}; my $instance = $result->{'durable-id'};
next if ($self->check_filter(section => 'psu', instance => $instance)); next if ($self->check_filter(section => 'psu', instance => $instance));
$self->{components}->{psu}->{total}++; $self->{components}->{psu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s', health is '%s' [instance = %s]", $self->{output}->output_add(
$result->{name}, $result->{status}, $result->{health}, $instance)); 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}); my $exit1 = $self->get_severity(section => 'psu', value => $result->{status});
if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit1, $self->{output}->output_add(
short_msg => sprintf("Power supply '%s' status is '%s'", $result->{name}, $result->{status})); 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}); my $exit2 = $self->get_severity(section => 'psu', value => $result->{health});
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit2, $self->{output}->output_add(
short_msg => sprintf("Power supply '%s' health is '%s'", $result->{name}, $result->{health})); severity => $exit2,
short_msg => sprintf("Power supply '%s' health is '%s'", $result->{name}, $result->{health})
);
} }
} }
} }

View File

@ -70,15 +70,21 @@ sub check {
next if ($self->check_filter(section => 'sensor', instance => $instance)); next if ($self->check_filter(section => 'sensor', instance => $instance));
$self->{components}->{sensor}->{total}++; $self->{components}->{sensor}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Sensor '%s' status is '%s' [instance = %s] [value = %s]", $self->{output}->output_add(
$result->{'sensor-name'}, $result->{status}, $instance, long_msg => sprintf(
$result->{value})); "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}); my $exit1 = $self->get_severity(section => 'sensor', value => $result->{status});
if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit1, $self->{output}->output_add(
short_msg => sprintf("sensor '%s' status is '%s'", $result->{'sensor-name'}, $result->{status})); severity => $exit1,
short_msg => sprintf("sensor '%s' status is '%s'", $result->{'sensor-name'}, $result->{status})
);
} }
next if (!defined($mapping{$result->{'sensor-type'}})); next if (!defined($mapping{$result->{'sensor-type'}}));
@ -86,11 +92,12 @@ sub check {
my $value = $1; my $value = $1;
my ($exit3, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'sensor', instance => $instance, value => $value); 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)) { if (!$self->{output}->is_status(value => $exit3, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit3, $self->{output}->output_add(
short_msg => sprintf("Sensor '%s' value is %s %s", $result->{'sensor-name'}, $value, $mapping{$result->{'sensor-type'}}->{nunit})); severity => $exit3,
short_msg => sprintf("Sensor '%s' value is %s %s", $result->{'sensor-name'}, $value, $mapping{$result->{'sensor-type'}}->{nunit})
);
} }
$self->{output}->perfdata_add( $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}, nlabel => 'hardware.sensor.' . $mapping{$result->{'sensor-type'}}->{nlabel} . '.' . $mapping{$result->{'sensor-type'}}->{nunit},
instances => $instance, instances => $instance,
value => $value, value => $value,

View File

@ -36,21 +36,27 @@ sub check {
$self->{components}->{volume} = {name => 'volumes', total => 0, skip => 0}; $self->{components}->{volume} = {name => 'volumes', total => 0, skip => 0};
return if ($self->check_filter(section => 'volume')); return if ($self->check_filter(section => 'volume'));
return if (!defined($self->{json_results}->{volumes})); return if (!defined($self->{json_results}->{volumes}));
foreach my $result (@{$self->{json_results}->{volumes}->{volumes}}) { foreach my $result (@{$self->{json_results}->{volumes}->{volumes}}) {
my $instance = $result->{'durable-id'}; my $instance = $result->{'durable-id'};
next if ($self->check_filter(section => 'volume', instance => $instance)); next if ($self->check_filter(section => 'volume', instance => $instance));
$self->{components}->{volume}->{total}++; $self->{components}->{volume}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Volume '%s' health is '%s' [instance = %s]", $self->{output}->output_add(
$result->{'volume-name'}, $result->{health}, $instance)); 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}); my $exit1 = $self->get_severity(section => 'volume', value => $result->{health});
if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit1, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit1, $self->{output}->output_add(
short_msg => sprintf("Volume '%s' health is '%s'", $result->{'volume-name'}, $result->{health})); severity => $exit1,
short_msg => sprintf("Volume '%s' health is '%s'", $result->{'volume-name'}, $result->{health})
);
} }
} }
} }