WIP: new perfdata for hardware components

This commit is contained in:
garnier-quentin 2019-04-18 10:05:40 +02:00
parent 91d2854ede
commit ace44c7272
11 changed files with 63 additions and 49 deletions

View File

@ -49,7 +49,7 @@ sub set_counters {
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'total-read', nlabel => 'datastore.read.usage.bytesperseconds', set => { { label => 'total-read', nlabel => 'datastore.read.usage.bytespersecond', set => {
key_values => [ { name => 'read' } ], key_values => [ { name => 'read' } ],
output_template => 'Total rate of reading data: %s %s/s', output_template => 'Total rate of reading data: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
@ -59,7 +59,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'total-write', nlabel => 'datastore.write.usage.bytesperseconds', set => { { label => 'total-write', nlabel => 'datastore.write.usage.bytespersecond', set => {
key_values => [ { name => 'write' } ], key_values => [ { name => 'write' } ],
output_template => 'Total rate of writing data: %s %s/s', output_template => 'Total rate of writing data: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
@ -80,7 +80,7 @@ sub set_counters {
closure_custom_threshold_check => \&catalog_status_threshold, closure_custom_threshold_check => \&catalog_status_threshold,
} }
}, },
{ label => 'read', nlabel => 'datastore.read.usage.bytesperseconds', set => { { label => 'read', nlabel => 'datastore.read.usage.bytespersecond', set => {
key_values => [ { name => 'read' } ], key_values => [ { name => 'read' } ],
output_template => 'rate of reading data: %s %s/s', output_template => 'rate of reading data: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
@ -90,7 +90,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'write', nlabel => 'datastore.write.usage.bytesperseconds', set => { { label => 'write', nlabel => 'datastore.write.usage.bytespersecond', set => {
key_values => [ { name => 'write' } ], key_values => [ { name => 'write' } ],
output_template => 'rate of writing data: %s %s/s', output_template => 'rate of writing data: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,

View File

@ -56,7 +56,7 @@ sub set_counters {
closure_custom_threshold_check => \&catalog_status_threshold, closure_custom_threshold_check => \&catalog_status_threshold,
} }
}, },
{ label => 'swap-in', nlabel => 'host.swap.in.usage.bytesperseconds', set => { { label => 'swap-in', nlabel => 'host.swap.in.usage.bytespersecond', set => {
key_values => [ { name => 'swap_in' }, { name => 'display' } ], key_values => [ { name => 'swap_in' }, { name => 'display' } ],
output_template => 'Swap In: %s %s/s', output_template => 'Swap In: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
@ -66,7 +66,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'swap-out', nlabel => 'host.swap.out.usage.bytesperseconds', set => { { label => 'swap-out', nlabel => 'host.swap.out.usage.bytespersecond', set => {
key_values => [ { name => 'swap_out' }, { name => 'display' } ], key_values => [ { name => 'swap_out' }, { name => 'display' } ],
output_template => 'Swap Out: %s %s/s', output_template => 'Swap Out: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,

View File

@ -57,7 +57,7 @@ sub set_counters {
closure_custom_threshold_check => \&catalog_status_threshold, closure_custom_threshold_check => \&catalog_status_threshold,
} }
}, },
{ label => 'swap-in', nlabel => 'vm.swap.in.usage.bytesperseconds', set => { { label => 'swap-in', nlabel => 'vm.swap.in.usage.bytespersecond', set => {
key_values => [ { name => 'swap_in' }, { name => 'display' } ], key_values => [ { name => 'swap_in' }, { name => 'display' } ],
output_template => 'Swap In: %s %s/s', output_template => 'Swap In: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
@ -67,7 +67,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'swap-out', nlabel => 'vm.swap.out.usage.bytesperseconds', set => { { label => 'swap-out', nlabel => 'vm.swap.out.usage.bytespersecond', set => {
key_values => [ { name => 'swap_out' }, { name => 'display' } ], key_values => [ { name => 'swap_out' }, { name => 'display' } ],
output_template => 'Swap Out: %s %s/s', output_template => 'Swap Out: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,

View File

@ -92,11 +92,15 @@ sub check {
$self->{output}->output_add(severity => $exit2, $self->{output}->output_add(severity => $exit2,
short_msg => sprintf("Humidity '%s' value is %s %%", $result->{rPDU2SensorTempHumidityStatusName}, $value)); short_msg => sprintf("Humidity '%s' value is %s %%", $result->{rPDU2SensorTempHumidityStatusName}, $value));
} }
$self->{output}->perfdata_add(label => 'hum_' . $result->{rPDU2SensorTempHumidityStatusName}, unit => '%', $self->{output}->perfdata_add(
label => 'hum', unit => '%',
nlabel => 'hardware.sensor.humidity.percentage',
instances => $result->{rPDU2SensorTempHumidityStatusName},
value => $value, value => $value,
warning => $warn, warning => $warn,
critical => $crit, critical => $crit,
min => 0, max => 100); min => 0, max => 100
);
} }
} }
} }

View File

@ -92,10 +92,14 @@ sub check {
$self->{output}->output_add(severity => $exit2, $self->{output}->output_add(severity => $exit2,
short_msg => sprintf("Temperature '%s' value is %s C", $result->{rPDU2SensorTempHumidityStatusName}, $value)); short_msg => sprintf("Temperature '%s' value is %s C", $result->{rPDU2SensorTempHumidityStatusName}, $value));
} }
$self->{output}->perfdata_add(label => 'temp_' . $result->{rPDU2SensorTempHumidityStatusName}, unit => 'C', $self->{output}->perfdata_add(
label => 'temp', unit => 'C',
nlabel => 'hardware.sensor.temperature.celsius',
instances => $result->{rPDU2SensorTempHumidityStatusName},
value => $value, value => $value,
warning => $warn, warning => $warn,
critical => $crit); critical => $crit
);
} }
} }
} }

View File

@ -71,7 +71,10 @@ sub check {
$self->{output}->output_add(severity => $exit2, $self->{output}->output_add(severity => $exit2,
short_msg => sprintf("Fan '%s' is %s %s", $result->{LABEL}->{VALUE}, $result->{SPEED}->{VALUE}, $unit)); short_msg => sprintf("Fan '%s' is %s %s", $result->{LABEL}->{VALUE}, $result->{SPEED}->{VALUE}, $unit));
} }
$self->{output}->perfdata_add(label => 'fan_' . $instance, unit => $unit, $self->{output}->perfdata_add(
label => 'fan', unit => $unit,
nlabel => 'hardware.fan.speed.' . lc($result->{SPEED}->{UNIT}),
instances => $instance,
value => $result->{SPEED}->{VALUE}, value => $result->{SPEED}->{VALUE},
warning => $warn, warning => $warn,
critical => $crit, critical => $crit,

View File

@ -72,7 +72,10 @@ sub check {
$self->{output}->output_add(severity => $exit2, $self->{output}->output_add(severity => $exit2,
short_msg => sprintf("Temperature '%s' is %s %s", $result->{LABEL}->{VALUE}, $result->{CURRENTREADING}->{VALUE}, $unit)); short_msg => sprintf("Temperature '%s' is %s %s", $result->{LABEL}->{VALUE}, $result->{CURRENTREADING}->{VALUE}, $unit));
} }
$self->{output}->perfdata_add(label => 'temp_' . $instance, unit => $unit, $self->{output}->perfdata_add(
label => 'temp', unit => $unit,
nlabel => 'hardware.temperature.' . lc($result->{CURRENTREADING}->{UNIT}),
instances => $instance,
value => $result->{CURRENTREADING}->{VALUE}, value => $result->{CURRENTREADING}->{VALUE},
warning => $warn, warning => $warn,
critical => $crit, critical => $crit,

View File

@ -75,12 +75,11 @@ sub check {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' speed is %s RPM", $result->{fanDevicename}, $result->{fanSpeed})); short_msg => sprintf("Fan '%s' speed is %s RPM", $result->{fanDevicename}, $result->{fanSpeed}));
} }
my $perf_label = $result->{fanDevicename};
$perf_label =~ s/ /_/g;
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'speed', unit => 'rpm', label => 'speed', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm', nlabel => 'hardware.fan.speed.rpm',
instances => $perf_label, instances => $result->{fanDevicename},
value => $result->{fanSpeed}, value => $result->{fanSpeed},
warning => $warn, warning => $warn,
critical => $crit, critical => $crit,

View File

@ -75,12 +75,11 @@ sub check {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(severity => $exit,
short_msg => sprintf("Hard Disk '%s' temperature is %s celsius degrees", $result->{hardDiskDevicename}, $result->{hardDiskTemperature})); short_msg => sprintf("Hard Disk '%s' temperature is %s celsius degrees", $result->{hardDiskDevicename}, $result->{hardDiskTemperature}));
} }
my $perf_label = $result->{hardDiskDevicename};
$perf_label =~ s/ /_/g;
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'temperature', unit => 'C', label => 'temperature', unit => 'C',
nlabel => 'hardware.harddisk.temperature.celsius', nlabel => 'hardware.harddisk.temperature.celsius',
instances => $perf_label, instances => $result->{hardDiskDevicename},
value => $result->{hardDiskTemperature}, value => $result->{hardDiskTemperature},
warning => $warn, warning => $warn,
critical => $crit, critical => $crit,

View File

@ -77,9 +77,11 @@ sub check {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' power is %s watts", $result->{powerSupplyDevicename}, $result->{powerSupplyInputPower})); short_msg => sprintf("Power supply '%s' power is %s watts", $result->{powerSupplyDevicename}, $result->{powerSupplyInputPower}));
} }
my $perf_label = $result->{powerSupplyDevicename};
$perf_label =~ s/ /_/g; $self->{output}->perfdata_add(
$self->{output}->perfdata_add(label => 'power_' . $perf_label, unit => 'W', label => 'power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
instances => $result->{powerSupplyDevicename},
value => $result->{powerSupplyInputPower}, value => $result->{powerSupplyInputPower},
warning => $warn, warning => $warn,
critical => $crit, critical => $crit,

View File

@ -110,7 +110,7 @@ sub custom_offset_perfdata {
); );
} else { } else {
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'offset' . $extra_label, unit => 'ms', label => 'offset', unit => 'ms',
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display_absolute} : undef, instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display_absolute} : undef,
value => $self->{result_values}->{offset_absolute}, value => $self->{result_values}->{offset_absolute},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),