WIP: new perfdata system

This commit is contained in:
garnier-quentin 2019-04-18 11:35:29 +02:00
parent aa4608e30d
commit 3920503f02
28 changed files with 295 additions and 189 deletions

View File

@ -33,29 +33,29 @@ our @ISA = qw(Exporter);
our @EXPORT_OK = qw($thresholds $mapping %raritan_type %map_type);
my %map_units = (
-1 => '', # none
0 => 'other',
1 => 'V', # volt,
2 => 'A', # amp,
3 => 'W', # watt
4 => 'voltamp',
5 => 'wattHour',
6 => 'voltampHour',
7 => 'C', # degreeC
8 => 'Hz', # hertz
9 => '%', # percent
10 => 'meterpersec',
11 => 'pascal',
12 => 'psi',
13 => 'g',
14 => 'degreeF',
15 => 'feet',
16 => 'inches',
17 => 'cm',
18 => 'meters',
19 => 'rpm',
20 => 'degrees',
21 => 'lux',
-1 => { unit => '' }, # none
0 => { unit => 'other', nunit => 'count' },
1 => { unit => 'V', nunit => 'volt' }, # volt,
2 => { unit => 'A', nunit => 'ampere' }, # amp,
3 => { unit => 'W', nunit => 'watt' }, # watt
4 => { unit => 'voltamp' },
5 => { unit => 'wattHour' },
6 => { unit => 'voltampHour' },
7 => { unit => 'C', nunit => 'celsius' }, # degreeC
8 => { unit => 'Hz', nunit => 'hertz' }, # hertz
9 => { unit => '%', nunit => 'percentage' }, # percent
10 => { unit => 'meterpersec' },
11 => { unit => 'pascal' },
12 => { unit => 'psi' },
13 => { unit => 'g' },
14 => { unit => 'degreeF', nunit => 'fahrenheit' },
15 => { unit => 'feet' },
16 => { unit => 'inches' },
17 => { unit => 'cm' },
18 => { unit => 'meters' },
19 => { unit => 'rpm' },
20 => { unit => 'degrees' },
21 => { unit => 'lux' },
);
my %map_state = (
@ -247,4 +247,4 @@ $thresholds = {
],
};
1;
1;

View File

@ -74,7 +74,7 @@ sub check {
}
$self->{output}->output_add(long_msg => sprintf("'%s' %s state is '%s' [instance: %s, value: %s, unit: %s, label: %s]",
$instance, $component, $result->{State},
$instance, $value, $result->{Unit}, $result2->{Label}));
$instance, $value, $result->{Unit}->{unit}, $result2->{Label}));
my $exit = $self->get_severity(section => $component, label => $value_type,
instance => $instance, value => $result->{State});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
@ -84,7 +84,7 @@ sub check {
}
if ($value =~ /[0-9]/) {
next if ($value =~ /^0$/ && $result->{Unit} eq '');
next if ($value =~ /^0$/ && $result->{Unit}->{unit} eq '');
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => $component, instance => $instance, value => $value);
if ($checked == 0) {
$result->{EnabledThresholds} = oct("0b". unpack('b*', $result->{EnabledThresholds}));
@ -114,15 +114,21 @@ sub check {
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit2,
short_msg => sprintf("'%s' %s value is %s %s",
$instance, $component, $value, $result->{Unit}));
$instance, $component, $value, $result->{Unit}->{unit}));
}
$self->{output}->perfdata_add(label => $instance . "_" . $component, unit => $result->{Unit},
value => $value,
warning => $warn,
critical => $crit);
my $nunit = (!defined($result->{Unit}->{nunit}) ? $result->{Unit}->{nunit} : lc($result->{Unit}->{unit}));
$self->{output}->perfdata_add(
label => $component, unit => $result->{Unit}->{unit},
nlabel => 'hardware.sensor.' . $options{type} . '.' . lc($component) . '.' . $nunit,
instances => $instance,
value => $value,
warning => $warn,
critical => $crit
);
}
}
}
}
1;
1;

View File

@ -80,9 +80,8 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
});
$options{options}->add_options(arguments => {
});
return $self;
}
@ -129,4 +128,4 @@ Example: --critical='powerQuality,.*,40'
=back
=cut
=cut

View File

@ -80,9 +80,8 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
});
$options{options}->add_options(arguments => {
});
return $self;
}
@ -129,4 +128,4 @@ Example: --critical='powerQuality,.*,40'
=back
=cut
=cut

View File

@ -25,8 +25,8 @@ use warnings;
# In MIB 'DELL-RAC-MIB'
my $mapping = {
drsWattsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.1.1.13', section => 'power', label => 'power', unit => 'W' },
drsAmpsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.1.1.14', section => 'current', label => 'current', unit => 'A' },
drsWattsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.1.1.13', section => 'power', label => 'power', unit => 'watt' },
drsAmpsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.1.1.14', section => 'current', label => 'current', unit => 'ampere' },
};
my $oid_drsCMCPowerTableEntrydrsCMCPowerTableEntry = '.1.3.6.1.4.1.674.10892.2.4.1.1';
@ -63,12 +63,16 @@ sub check {
short_msg => sprintf("Chassis '%s' %s is %s%s", $instance,
$mapping->{$probe}->{section}, $result->{$probe}, $mapping->{$probe}->{unit}));
}
$self->{output}->perfdata_add(label => 'chassis_' . $mapping->{$probe}->{label} . '_' . $instance, unit => $mapping->{$probe}->{unit},
value => $result->{$probe},
warning => $warn,
critical => $crit);
$self->{output}->perfdata_add(
label => 'chassis_' . $mapping->{$probe}->{label}, unit => $mapping->{$probe}->{unit},
nlabel => 'hardware.chassis.' . $mapping->{$probe}->{label} . '.' . $mapping->{$probe}->{unit},
instances => $instance,
value => $result->{$probe},
warning => $warn,
critical => $crit
);
}
}
}
1;
1;

View File

@ -33,9 +33,9 @@ my %map_psu_capable = (
my $mapping = {
drsPSULocation => { oid => '.1.3.6.1.4.1.674.10892.2.4.2.1.3' },
drsPSUMonitoringCapable => { oid => '.1.3.6.1.4.1.674.10892.2.4.2.1.4', map => \%map_psu_capable },
drsPSUVoltsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.2.1.5', section => 'voltage', label => 'voltage', unit => 'V' },
drsPSUAmpsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.2.1.6', section => 'current', label => 'current', unit => 'A' },
drsPSUWattsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.2.1.7', section => 'power', label => 'power', unit => 'W' },
drsPSUVoltsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.2.1.5', section => 'voltage', label => 'voltage', unit => 'volt' },
drsPSUAmpsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.2.1.6', section => 'current', label => 'current', unit => 'ampere' },
drsPSUWattsReading => { oid => '.1.3.6.1.4.1.674.10892.2.4.2.1.7', section => 'power', label => 'power', unit => 'watt' },
};
my $oid_drsCMCPSUTableEntry = '.1.3.6.1.4.1.674.10892.2.4.2.1';
@ -73,12 +73,16 @@ sub check {
short_msg => sprintf("Power supply '%s' %s is %s%s", $result->{drsPSULocation},
$mapping->{$probe}->{section}, $result->{$probe}, $mapping->{$probe}->{unit}));
}
$self->{output}->perfdata_add(label => 'psu_' . $mapping->{$probe}->{label} . '_' . $instance, unit => $mapping->{$probe}->{unit},
value => $result->{$probe},
warning => $warn,
critical => $crit);
$self->{output}->perfdata_add(
label => 'psu_' . $mapping->{$probe}->{label}, unit => $mapping->{$probe}->{unit},
nlabel => 'hardware.' . $mapping->{$probe}->{label} . '.' . $mapping->{$probe}->{unit},
instances => $instance,
value => $result->{$probe},
warning => $warn,
critical => $crit
);
}
}
}
1;
1;

View File

@ -25,9 +25,9 @@ use warnings;
# In MIB 'DELL-RAC-MIB'
my $mapping = {
drsChassisFrontPanelAmbientTemperature => { oid => '.1.3.6.1.4.1.674.10892.2.3.1.10', instance => 'chassis', label => 'temp_chassis', descr => 'Chassis Ambient temperature' },
drsCMCAmbientTemperature => { oid => '.1.3.6.1.4.1.674.10892.2.3.1.11', instance => 'ambient', label => 'temp_ambient', descr => 'CMC Ambient temperarture' },
drsCMCProcessorTemperature => { oid => '.1.3.6.1.4.1.674.10892.2.3.1.12', instance => 'processor', label => 'temp_processor', descr => 'Processor temperature' },
drsChassisFrontPanelAmbientTemperature => { oid => '.1.3.6.1.4.1.674.10892.2.3.1.10', instance => 'chassis', descr => 'Chassis Ambient temperature' },
drsCMCAmbientTemperature => { oid => '.1.3.6.1.4.1.674.10892.2.3.1.11', instance => 'ambient', descr => 'CMC Ambient temperarture' },
drsCMCProcessorTemperature => { oid => '.1.3.6.1.4.1.674.10892.2.3.1.12', instance => 'processor', descr => 'Processor temperature' },
};
my $oid_drsChassisStatusGroup = '.1.3.6.1.4.1.674.10892.2.3';
@ -61,11 +61,15 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("%s is %sC", $mapping->{$probe}->{descr}, $result->{$probe}));
}
$self->{output}->perfdata_add(label => $mapping->{$probe}->{label}, unit => 'C',
value => $result->{$probe},
warning => $warn,
critical => $crit);
$self->{output}->perfdata_add(
label => 'temp', unit => 'C',
nlabel => 'hardware.temperature.celsius',
instances => $mapping->{$probe}->{instance},
value => $result->{$probe},
warning => $warn,
critical => $crit
);
}
}
1;
1;

View File

@ -110,13 +110,16 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Amperage '%s' is %s %s", $result->{amperageProbeLocationName}, $result->{amperageProbeReading}, $unit));
}
$self->{output}->perfdata_add(label => 'amperage_' . $result->{amperageProbeLocationName}, unit => $unit,
value => $result->{amperageProbeReading},
warning => $warn,
critical => $crit,
);
$self->{output}->perfdata_add(
label => 'amperage', unit => $unit,
nlabel => 'hardware.probe.amperage.' . ($unit eq 'A' ? 'ampere' : 'watt'),
instances => $result->{amperageProbeLocationName},
value => $result->{amperageProbeReading},
warning => $warn,
critical => $crit,
);
}
}
}
1;
1;

View File

@ -101,13 +101,16 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Cooling device '%s' is %s rpm", $result->{coolingDeviceLocationName}, $result->{coolingDeviceReading}));
}
$self->{output}->perfdata_add(label => 'fan_' . $result->{coolingDeviceLocationName}, unit => 'rpm',
value => $result->{coolingDeviceReading},
warning => $warn,
critical => $crit,
);
$self->{output}->perfdata_add(
label => 'fan', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm',
instances => $result->{coolingDeviceLocationName},
value => $result->{coolingDeviceReading},
warning => $warn,
critical => $crit,
);
}
}
}
1;
1;

View File

@ -109,13 +109,16 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $result->{temperatureProbeLocationName}, $result->{temperatureProbeReading}));
}
$self->{output}->perfdata_add(label => 'temp_' . $result->{temperatureProbeLocationName}, unit => 'C',
value => $result->{temperatureProbeReading},
warning => $warn,
critical => $crit,
);
$self->{output}->perfdata_add(
label => 'temp', unit => 'C',
nlabel => 'hardware.probe.temperature.celsius',
instances => $result->{temperatureProbeLocationName},
value => $result->{temperatureProbeReading},
warning => $warn,
critical => $crit,
);
}
}
}
1;
1;

View File

@ -101,13 +101,16 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Voltage '%s' is %s V", $result->{voltageProbeLocationName}, $result->{voltageProbeReading}));
}
$self->{output}->perfdata_add(label => 'voltage_' . $result->{voltageProbeLocationName}, unit => 'V',
value => $result->{voltageProbeReading},
warning => $warn,
critical => $crit,
);
$self->{output}->perfdata_add(
label => 'voltage', unit => 'V',
nlabel => 'hardware.probe.voltage.volt',
instances => $result->{voltageProbeLocationName},
value => $result->{voltageProbeReading},
warning => $warn,
critical => $crit,
);
}
}
}
1;
1;

View File

@ -88,12 +88,15 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' speed is %s rpm", $instance, $result->{coolingDeviceReading}));
}
$self->{output}->perfdata_add(label => 'fan_' . $instance, unit => 'rpm',
value => $result->{coolingDeviceReading},
warning => $warn,
critical => $crit,
min => 0
);
$self->{output}->perfdata_add(
label => 'fan', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm',
instances => $instance,
value => $result->{coolingDeviceReading},
warning => $warn,
critical => $crit,
min => 0
);
}
}
}

View File

@ -119,12 +119,15 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' power is %s W", $instance, $result->{powerSupplyOutputWatts}));
}
$self->{output}->perfdata_add(label => 'psu_power_' . $instance, unit => 'W',
value => $result->{powerSupplyOutputWatts},
warning => $warn,
critical => $crit,
min => 0
);
$self->{output}->perfdata_add(
label => 'psu_power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
instances => $instance,
value => $result->{powerSupplyOutputWatts},
warning => $warn,
critical => $crit,
min => 0
);
}
}
}

View File

@ -92,12 +92,15 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $instance, $result->{temperatureProbeReading}));
}
$self->{output}->perfdata_add(label => 'temp_' . $instance, unit => 'C',
value => $result->{temperatureProbeReading},
warning => $warn,
critical => $crit,
min => 0
);
$self->{output}->perfdata_add(
label => 'temp', unit => 'C',
nlabel => 'hardware.temperature.celsius',
instances => $instance,
value => $result->{temperatureProbeReading},
warning => $warn,
critical => $crit,
min => 0
);
}
}
}

View File

@ -136,20 +136,35 @@ sub check {
$psu_index, $map_conditions{$psu_condition}));
}
$self->{output}->perfdata_add(label => "psu_" . $psu_index . "_power", unit => 'W',
value => $psu_pwrout);
$self->{output}->perfdata_add(
label => 'psu_power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
instances => $psu_index,
value => $psu_pwrout
);
if (defined($psu_intemp) && $psu_intemp != -1) {
$self->{output}->perfdata_add(label => "psu_" . $psu_index . "_temp_intake", unit => 'C',
value => $psu_intemp);
$self->{output}->perfdata_add(
label => 'psu_temp', unit => 'C',
nlabel => 'hardware.powersupply.temperature.celsius',
instances => [$psu_index, 'intake'],
value => $psu_intemp
);
}
if (defined($psu_exhtemp) && $psu_exhtemp != -1) {
$self->{output}->perfdata_add(label => "psu_" . $psu_index . "_temp_exhaust", unit => 'C',
value => $psu_exhtemp);
$self->{output}->perfdata_add(
label => 'psu_temp', unit => 'C',
nlabel => 'hardware.powersupply.temperature.celsius',
instances => [$psu_index, 'exhaust'],
value => $psu_exhtemp
);
}
}
$self->{output}->perfdata_add(label => "total_power", unit => 'W',
value => $total_watts);
$self->{output}->perfdata_add(
label => 'total_power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
value => $total_watts
);
}
1;
1;

View File

@ -98,9 +98,13 @@ sub check {
$temp_index, $map_conditions{$temp_condition}));
}
$self->{output}->perfdata_add(label => "temp_" . $temp_index, unit => 'C',
value => $temp_current,
warning => $temp_threshold);
$self->{output}->perfdata_add(
label => "temp", unit => 'C',
nlabel => 'hardware.temperature.celsius',
instances => $temp_index,
value => $temp_current,
warning => $temp_threshold
);
}
}

View File

@ -114,10 +114,14 @@ sub check {
}
if (defined($result->{cpqHeFltTolFanCurrentSpeed})) {
$self->{output}->perfdata_add(label => "fan_speed_" . $instance, unit => 'rpm',
value => $result->{cpqHeFltTolFanCurrentSpeed});
$self->{output}->perfdata_add(
label => 'fan_speed', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm',
instances => $instance,
value => $result->{cpqHeFltTolFanCurrentSpeed}
);
}
}
}
1;
1;

View File

@ -115,12 +115,20 @@ sub check {
$instance, $result->{cpqHeFltTolPowerSupplyCondition}));
}
$self->{output}->perfdata_add(label => "psu_power_" . $instance, unit => 'W',
value => $result->{cpqHeFltTolPowerSupplyCapacityUsed},
critical => $result->{cpqHeFltTolPowerSupplyCapacityMaximum});
$self->{output}->perfdata_add(label => "psu_voltage" . $instance, unit => 'V',
value => $result->{cpqHeFltTolPowerSupplyMainVoltage});
$self->{output}->perfdata_add(
label => 'psu_power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
instances => $instance,
value => $result->{cpqHeFltTolPowerSupplyCapacityUsed},
critical => $result->{cpqHeFltTolPowerSupplyCapacityMaximum}
);
$self->{output}->perfdata_add(
label => 'psu_voltage', unit => 'V',
nlabel => 'hardware.powersupply.voltage.volt',
instances => $instance,
value => $result->{cpqHeFltTolPowerSupplyMainVoltage}
);
}
}
1;
1;

View File

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

View File

@ -71,11 +71,14 @@ sub check {
$self->{output}->output_add(severity => $exit2,
short_msg => sprintf("Fan '%s' is '%s' %%", $result->{fanDescr}, $fan_speed));
}
$self->{output}->perfdata_add(label => 'fan_' . $result->{fanDescr}, unit => '%',
value => $fan_speed,
warning => $warn,
critical => $crit, min => 0, max => 100
);
$self->{output}->perfdata_add(
label => 'fan', unit => '%',
nlabel => 'hardware.fan.speed.percentage',
instances => $result->{fanDescr},
value => $fan_speed,
warning => $warn,
critical => $crit, min => 0, max => 100
);
}
}

View File

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

View File

@ -86,10 +86,14 @@ sub check {
$self->{output}->output_add(severity => $exit2,
short_msg => sprintf("Voltage '%s' is %s", $result->{voltDescr}, $result->{voltReading}));
}
$self->{output}->perfdata_add(label => "volt_" . $result->{voltDescr},
value => $result->{voltReading},
warning => $warn,
critical => $crit);
$self->{output}->perfdata_add(
label => 'volt',
nlabel => 'hardware.voltage.volt',
instances => $result->{voltDescr},
value => $result->{voltReading},
warning => $warn,
critical => $crit
);
}
}

View File

@ -128,11 +128,10 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"with-sensors" => { name => 'with_sensors' },
"exclude:s@" => { name => 'exclude' },
});
$options{options}->add_options(arguments => {
"with-sensors" => { name => 'with_sensors' },
"exclude:s@" => { name => 'exclude' },
});
return $self;
}
@ -196,9 +195,14 @@ sub run {
my $oid_end = $2;
my $hex_val = md5_hex($board_type . '.' . $oid_end);
$self->{output}->perfdata_add(label => $components_board_types{$board_type} . "_" . $hex_val,
unit => $oids_monitor_units->{$oid_scfMonitorUnits . '.' . $board_type . '.' . $oid_end},
value => $oids_monitor_values->{$oid});
# need some snmpwalk to do unit mapping!! experimental
$self->{output}->perfdata_add(
label => $components_board_types{$board_type},
unit => $oids_monitor_units->{$oid_scfMonitorUnits . '.' . $board_type . '.' . $oid_end},
nlabel => 'hardware.' . lc($components_board_types{$board_type}) . '.' . $oids_monitor_units->{$oid_scfMonitorUnits . '.' . $board_type . '.' . $oid_end},
instances => $hex_val,
value => $oids_monitor_values->{$oid}
);
}
}
@ -230,4 +234,4 @@ PART = name
=back
=cut

View File

@ -182,10 +182,16 @@ sub check {
short_msg => sprintf("Sensor '%s' is %s %s", $result->{smHealthMonitorName}, $result->{smHealthMonitorReading},
defined($result->{smHealthMonitorReadingUnit}) ? $result->{smHealthMonitorReadingUnit} : ''));
}
$self->{output}->perfdata_add(label => $component . '_' . $result->{smHealthMonitorName}, unit => $result->{smHealthMonitorReadingUnit},
value => $result->{smHealthMonitorReading},
warning => $warn,
critical => $crit);
# need some snmpwalk to do unit mapping!! experimental
$self->{output}->perfdata_add(
label => $component, unit => $result->{smHealthMonitorReadingUnit},
nlabel => 'hardware.sensor.' . $result->{smHealthMonitorType} . '.' . $result->{smHealthMonitorReadingUnit},
instances => $result->{smHealthMonitorName},
value => $result->{smHealthMonitorReading},
warning => $warn,
critical => $crit
);
}
}

View File

@ -60,9 +60,8 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
});
$options{options}->add_options(arguments => {
});
return $self;
}
@ -165,11 +164,14 @@ sub check {
$self->{output}->output_add(severity => $exit2,
short_msg => sprintf("fan '%s' speed is %s rpm", $result->{axFanName}, $result->{axFanSpeed}));
}
$self->{output}->perfdata_add(label => $result->{axFanName}, unit => 'rpm',
value => $result->{axFanSpeed},
warning => $warn,
critical => $crit, min => 0
);
$self->{output}->perfdata_add(
label => 'fan', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm',
instances => $result->{axFanName},
value => $result->{axFanSpeed},
warning => $warn,
critical => $crit, min => 0
);
}
}
}
@ -250,11 +252,14 @@ sub check {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("physical temperature is %s C", $result->{axSysHwPhySystemTemp}));
}
$self->{output}->perfdata_add(label => 'temperature_physical', unit => 'C',
value => $result->{axSysHwPhySystemTemp},
warning => $warn,
critical => $crit
);
$self->{output}->perfdata_add(
label => 'temperature', unit => 'C',
nlabel => 'hardware.temperature.celsius',
instances => 'physical',
value => $result->{axSysHwPhySystemTemp},
warning => $warn,
critical => $crit
);
}
1;

View File

@ -61,9 +61,8 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
});
$options{options}->add_options(arguments => {
});
return $self;
}
@ -131,7 +130,7 @@ use centreon::plugins::misc;
my %map_status = (1 => 'unknown', 2 => 'faulty', 3 => 'below-min', 4 => 'nominal', 5 => 'above-max', 6 => 'absent');
my %map_type = (1 => 'temperature', 2 => 'fan', 3 => 'power-supply');
my %map_unit = (temperature => 'C', fan => 'rpm'); # No voltage value available
my %map_unit = (temperature => 'celsius', fan => 'rpm'); # No voltage value available
my $mapping = {
swSensorType => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.22.1.2', map => \%map_type },
@ -180,11 +179,14 @@ sub check {
short_msg => sprintf("%s sensor '%s' is %s %s", $result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorValue},
$map_unit{$result->{swSensorType}}));
}
$self->{output}->perfdata_add(label => $result->{swSensorInfo}, unit => $map_unit{$result->{swSensorType}},
value => $result->{swSensorValue},
warning => $warn,
critical => $crit
);
$self->{output}->perfdata_add(
label => 'sensor', unit => $map_unit{$result->{swSensorType}},
nlabel => 'hardware.sensor.' . $result->{swSensorType} . '.' . $map_unit{$result->{swSensorType}},
instances => $result->{swSensorInfo},
value => $result->{swSensorValue},
warning => $warn,
critical => $crit
);
}
}
}

View File

@ -201,11 +201,14 @@ sub check {
short_msg => sprintf("%s '%s' temperature is '%s' C", $result->{tmnxHwClass},
$result->{tmnxHwName}, $result->{tmnxHwTemperature}));
}
$self->{output}->perfdata_add(label => 'temperature_' . $result->{tmnxHwName}, unit => 'C',
value => $result->{tmnxHwTemperature},
warning => $warn,
critical => $crit
);
$self->{output}->perfdata_add(
label => 'temperature' . , unit => 'C',
nlabel => 'hardware.entity.temperature.celsius',
instances => $result->{tmnxHwName},
value => $result->{tmnxHwTemperature},
warning => $warn,
critical => $crit
);
}
}

View File

@ -150,11 +150,14 @@ sub check {
$self->{output}->output_add(severity => $exit2,
short_msg => sprintf("entity '%s' temperature is %s C", $entry->{name}, $entry->{temperature}));
}
$self->{output}->perfdata_add(label => 'temperature_' . $entry->{name}, unit => 'C',
value => $entry->{temperature},
warning => $warn,
critical => $crit, min => 0
);
$self->{output}->perfdata_add(
label => 'temperature', unit => 'C',
nlabel => 'hardware.entity.temperature.celsius',
instances => $entry->{name},
value => $entry->{temperature},
warning => $warn,
critical => $crit, min => 0
);
}
}
}