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} = [
{ label => 'total-read', nlabel => 'datastore.read.usage.bytesperseconds', set => {
{ label => 'total-read', nlabel => 'datastore.read.usage.bytespersecond', set => {
key_values => [ { name => 'read' } ],
output_template => 'Total rate of reading data: %s %s/s',
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' } ],
output_template => 'Total rate of writing data: %s %s/s',
output_change_bytes => 1,
@ -80,7 +80,7 @@ sub set_counters {
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' } ],
output_template => 'rate of reading data: %s %s/s',
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' } ],
output_template => 'rate of writing data: %s %s/s',
output_change_bytes => 1,

View File

@ -56,7 +56,7 @@ sub set_counters {
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' } ],
output_template => 'Swap In: %s %s/s',
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' } ],
output_template => 'Swap Out: %s %s/s',
output_change_bytes => 1,

View File

@ -57,7 +57,7 @@ sub set_counters {
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' } ],
output_template => 'Swap In: %s %s/s',
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' } ],
output_template => 'Swap Out: %s %s/s',
output_change_bytes => 1,

View File

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

View File

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

View File

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

View File

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

View File

@ -75,12 +75,11 @@ sub check {
$self->{output}->output_add(severity => $exit,
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(
label => 'speed', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm',
instances => $perf_label,
instances => $result->{fanDevicename},
value => $result->{fanSpeed},
warning => $warn,
critical => $crit,

View File

@ -75,12 +75,11 @@ sub check {
$self->{output}->output_add(severity => $exit,
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(
label => 'temperature', unit => 'C',
nlabel => 'hardware.harddisk.temperature.celsius',
instances => $perf_label,
instances => $result->{hardDiskDevicename},
value => $result->{hardDiskTemperature},
warning => $warn,
critical => $crit,

View File

@ -77,15 +77,17 @@ sub check {
$self->{output}->output_add(severity => $exit,
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(label => 'power_' . $perf_label, unit => 'W',
value => $result->{powerSupplyInputPower},
warning => $warn,
critical => $crit,
min => 0,
max => $result->{powerSupplyPowerRating}
);
$self->{output}->perfdata_add(
label => 'power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
instances => $result->{powerSupplyDevicename},
value => $result->{powerSupplyInputPower},
warning => $warn,
critical => $crit,
min => 0,
max => $result->{powerSupplyPowerRating}
);
}
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s' [instance = %s]",
@ -100,4 +102,4 @@ sub check {
}
}
1;
1;

View File

@ -110,7 +110,7 @@ sub custom_offset_perfdata {
);
} else {
$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,
value => $self->{result_values}->{offset_absolute},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),