(plugin) hardware::server::xfusion::ibmc::snmp - force metric v2 (#4049)

This commit is contained in:
qgarnier 2022-11-09 13:18:28 +01:00 committed by GitHub
parent 5eabb2d09d
commit 531071c5f3
12 changed files with 177 additions and 113 deletions

View File

@ -29,7 +29,7 @@ my %map_status = (
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
6 => 'unknown'
);
my %map_type = (
@ -38,13 +38,13 @@ my %map_type = (
3 => 'amcController',
4 => 'mmcController',
5 => 'hddBackPlane',
6 => 'raidCard',
6 => 'raidCard'
);
my $mapping = {
componentName => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1.1' },
componentType => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1.2', map => \%map_type },
componentStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1.5', map => \%map_status },
componentStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1.5', map => \%map_status }
};
my $oid_componentDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1';
@ -70,17 +70,24 @@ sub check {
next if ($result->{componentStatus} =~ /absence/);
$self->{components}->{component}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Component '%s' of type '%s' status is '%s' [instance = %s]",
$result->{componentName}, $result->{componentType}, $result->{componentStatus}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"component '%s' of type '%s' status is '%s' [instance: %s]",
$result->{componentName}, $result->{componentType}, $result->{componentStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default', section => 'component', value => $result->{componentStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Component '%s' of type '%s' status is '%s'",
$result->{componentName}, $result->{componentType}, $result->{componentStatus}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"Component '%s' of type '%s' status is '%s'",
$result->{componentName}, $result->{componentType}, $result->{componentStatus}
)
);
}
}
}
1;
1;

View File

@ -29,12 +29,12 @@ my %map_status = (
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
6 => 'unknown'
);
my $mapping = {
cpuStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.15.50.1.6', map => \%map_status },
cpuDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.15.50.1.10' },
cpuDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.15.50.1.10' }
};
my $oid_cpuDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.15.50.1';
@ -44,7 +44,7 @@ sub load {
push @{$self->{request}}, {
oid => $oid_cpuDescriptionEntry,
start => $mapping->{cpuStatus}->{oid},
end => $mapping->{cpuDevicename}->{oid},
end => $mapping->{cpuDevicename}->{oid}
};
}
@ -64,14 +64,19 @@ sub check {
next if ($result->{cpuStatus} =~ /absence/);
$self->{components}->{cpu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Cpu '%s' status is '%s' [instance = %s]",
$result->{cpuDevicename}, $result->{cpuStatus}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"cpu '%s' status is '%s' [instance: %s]",
$result->{cpuDevicename}, $result->{cpuStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default', section => 'cpu', value => $result->{cpuStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Cpu '%s' status is '%s'", $result->{cpuDevicename}, $result->{cpuStatus}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Cpu '%s' status is '%s'", $result->{cpuDevicename}, $result->{cpuStatus})
);
}
}
}

View File

@ -29,20 +29,20 @@ my %map_status = (
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
6 => 'unknown'
);
my %map_installation_status = (
1 => 'absence',
2 => 'presence',
3 => 'unknown',
3 => 'unknown'
);
my $mapping = {
fanSpeed => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.2' },
fanPresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.3', map => \%map_installation_status },
fanStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.4', map => \%map_status },
fanDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.7' },
fanDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.7' }
};
my $oid_fanDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1';
@ -72,13 +72,15 @@ sub check {
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{fanSpeed});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' speed is %s RPM", $result->{fanDevicename}, $result->{fanSpeed}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Fan '%s' speed is %s RPM", $result->{fanDevicename}, $result->{fanSpeed})
);
}
$self->{output}->perfdata_add(
label => 'speed', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm',
unit => 'rpm',
instances => $result->{fanDevicename},
value => $result->{fanSpeed},
warning => $warn,
@ -87,14 +89,19 @@ sub check {
);
}
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance = %s]",
$result->{fanDevicename}, $result->{fanStatus}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"fan '%s' status is '%s' [instance: %s]",
$result->{fanDevicename}, $result->{fanStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{fanStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' status is '%s'", $result->{fanDevicename}, $result->{fanStatus}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Fan '%s' status is '%s'", $result->{fanDevicename}, $result->{fanStatus})
);
}
}
}

View File

@ -29,20 +29,20 @@ my %map_status = (
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
6 => 'unknown'
);
my %map_installation_status = (
1 => 'absence',
2 => 'presence',
3 => 'unknown',
3 => 'unknown'
);
my $mapping = {
hardDiskPresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.2', map => \%map_installation_status },
hardDiskStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.3', map => \%map_status },
hardDiskDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.6' },
hardDiskTemperature => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.20' },
hardDiskTemperature => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.20' }
};
my $oid_hardDiskDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1';
@ -52,7 +52,7 @@ sub load {
push @{$self->{request}}, {
oid => $oid_hardDiskDescriptionEntry,
start => $mapping->{hardDiskPresence}->{oid},
end => $mapping->{hardDiskTemperature}->{oid},
end => $mapping->{hardDiskTemperature}->{oid}
};
}
@ -76,13 +76,15 @@ sub check {
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'harddisk', instance => $instance, value => $result->{hardDiskTemperature});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Hard Disk '%s' temperature is %s celsius degrees", $result->{hardDiskDevicename}, $result->{hardDiskTemperature}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Hard Disk '%s' temperature is %s celsius degrees", $result->{hardDiskDevicename}, $result->{hardDiskTemperature})
);
}
$self->{output}->perfdata_add(
label => 'temperature', unit => 'C',
nlabel => 'hardware.harddisk.temperature.celsius',
nlabel => 'hardware.harddisk.temperature.celsius',
unit => 'C',
instances => $result->{hardDiskDevicename},
value => $result->{hardDiskTemperature},
warning => $warn,
@ -91,14 +93,19 @@ sub check {
);
}
$self->{output}->output_add(long_msg => sprintf("Hard disk '%s' status is '%s' [instance = %s]",
$result->{hardDiskDevicename}, $result->{hardDiskStatus}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"hard disk '%s' status is '%s' [instance: %s]",
$result->{hardDiskDevicename}, $result->{hardDiskStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default', section => 'harddisk', value => $result->{hardDiskStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Hard disk '%s' status is '%s'", $result->{hardDiskDevicename}, $result->{hardDiskStatus}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Hard disk '%s' status is '%s'", $result->{hardDiskDevicename}, $result->{hardDiskStatus})
);
}
}
}

View File

@ -28,13 +28,13 @@ my %map_state = (
2 => 'partial degraded',
3 => 'degraded',
4 => 'optimal',
255 => 'unknown',
255 => 'unknown'
);
my $mapping = {
logicalDriveRAIDControllerIndex => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1.1' },
logicalDriveIndex => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1.2' },
logicalDriveState => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1.4', map => \%map_state },
logicalDriveState => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1.4', map => \%map_state }
};
my $oid_logicalDriveDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1';
@ -43,7 +43,7 @@ sub load {
push @{$self->{request}}, {
oid => $oid_logicalDriveDescriptionEntry,
end => $mapping->{logicalDriveState}->{oid},
end => $mapping->{logicalDriveState}->{oid}
};
}
@ -62,17 +62,24 @@ sub check {
next if ($self->check_filter(section => 'logicaldrive', instance => $instance));
$self->{components}->{logicaldrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Logical drive '%s.%s' status is '%s' [instance = %s]",
$result->{logicalDriveRAIDControllerIndex}, $result->{logicalDriveIndex}, $result->{logicalDriveState}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"logical drive '%s.%s' status is '%s' [instance: %s]",
$result->{logicalDriveRAIDControllerIndex}, $result->{logicalDriveIndex}, $result->{logicalDriveState}, $instance,
)
);
my $exit = $self->get_severity(section => 'logicaldrive', value => $result->{logicalDriveState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Logical drive '%s.%s' status is '%s'",
$result->{logicalDriveRAIDControllerIndex},
$result->{logicalDriveIndex},
$result->{logicalDriveState}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"Logical drive '%s.%s' status is '%s'",
$result->{logicalDriveRAIDControllerIndex},
$result->{logicalDriveIndex},
$result->{logicalDriveState}
)
);
}
}
}

View File

@ -29,12 +29,12 @@ my %map_status = (
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
6 => 'unknown'
);
my $mapping = {
memoryStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.16.50.1.6', map => \%map_status },
memoryDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.16.50.1.10' },
memoryDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.16.50.1.10' }
};
my $oid_memoryDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.16.50.1';
@ -44,7 +44,7 @@ sub load {
push @{$self->{request}}, {
oid => $oid_memoryDescriptionEntry,
start => $mapping->{memoryStatus}->{oid},
end => $mapping->{memoryDevicename}->{oid},
end => $mapping->{memoryDevicename}->{oid}
};
}
@ -64,14 +64,19 @@ sub check {
next if ($result->{memoryStatus} =~ /absence/);
$self->{components}->{memory}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Memory '%s' status is '%s' [instance = %s]",
$result->{memoryDevicename}, $result->{memoryStatus}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"memory '%s' status is '%s' [instance: %s]",
$result->{memoryDevicename}, $result->{memoryStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default', section => 'memory', value => $result->{memoryStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Memory '%s' status is '%s'", $result->{memoryDevicename}, $result->{memoryStatus}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Memory '%s' status is '%s'", $result->{memoryDevicename}, $result->{memoryStatus})
);
}
}
}

View File

@ -29,19 +29,19 @@ my %map_status = (
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
6 => 'unknown'
);
my %map_installation_status = (
1 => 'absence',
2 => 'presence',
3 => 'unknown',
3 => 'unknown'
);
my $mapping = {
pCIePresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1.2', map => \%map_installation_status },
pCIeStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1.3', map => \%map_status },
pCIeDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1.7' },
pCIeDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1.7' }
};
my $oid_pCIeDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1';
@ -51,7 +51,7 @@ sub load {
push @{$self->{request}}, {
oid => $oid_pCIeDescriptionEntry,
start => $mapping->{pCIePresence}->{oid},
end => $mapping->{pCIeDevicename}->{oid},
end => $mapping->{pCIeDevicename}->{oid}
};
}
@ -71,14 +71,19 @@ sub check {
next if ($result->{pCIePresence} !~ /presence/);
$self->{components}->{pcie}->{total}++;
$self->{output}->output_add(long_msg => sprintf("PCIe '%s' status is '%s' [instance = %s]",
$result->{pCIeDevicename}, $result->{pCIeStatus}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"PCIe '%s' status is '%s' [instance: %s]",
$result->{pCIeDevicename}, $result->{pCIeStatus}, $instance
)
);
my $exit = $self->get_severity(label => 'default', section => 'pcie', value => $result->{pCIeStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("PCIe '%s' status is '%s'", $result->{pCIeDevicename}, $result->{pCIeStatus}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("PCIe '%s' status is '%s'", $result->{pCIeDevicename}, $result->{pCIeStatus})
);
}
}
}

View File

@ -29,13 +29,13 @@ my %map_status = (
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
6 => 'unknown'
);
my %map_installation_status = (
1 => 'absence',
2 => 'presence',
3 => 'unknown',
3 => 'unknown'
);
my $mapping = {
@ -43,7 +43,7 @@ my $mapping = {
powerSupplyStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.7', map => \%map_status },
powerSupplyInputPower => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.8' },
powerSupplyPresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.9', map => \%map_installation_status },
powerSupplyDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.13' },
powerSupplyDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.13' }
};
my $oid_powerSupplyDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1';
@ -52,7 +52,7 @@ sub load {
push @{$self->{request}}, {
oid => $oid_powerSupplyDescriptionEntry,
start => $mapping->{powerSupplyPowerRating}->{oid},
start => $mapping->{powerSupplyPowerRating}->{oid}
};
}
@ -77,13 +77,15 @@ sub check {
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'psu', instance => $instance, value => $result->{powerSupplyInputPower});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' power is %s watts", $result->{powerSupplyDevicename}, $result->{powerSupplyInputPower}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Power supply '%s' power is %s watts", $result->{powerSupplyDevicename}, $result->{powerSupplyInputPower})
);
}
$self->{output}->perfdata_add(
label => 'power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
unit => 'W',
instances => $result->{powerSupplyDevicename},
value => $result->{powerSupplyInputPower},
warning => $warn,
@ -93,14 +95,19 @@ sub check {
);
}
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s' [instance = %s]",
$result->{powerSupplyDevicename}, $result->{powerSupplyStatus}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"power supply '%s' status is '%s' [instance: %s]",
$result->{powerSupplyDevicename}, $result->{powerSupplyStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{powerSupplyStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' status is '%s'", $result->{powerSupplyDevicename}, $result->{powerSupplyStatus}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Power supply '%s' status is '%s'", $result->{powerSupplyDevicename}, $result->{powerSupplyStatus})
);
}
}
}

View File

@ -25,7 +25,7 @@ use warnings;
my $mapping = {
raidControllerComponentName => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1.4' },
raidControllerHealthStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1.7' },
raidControllerHealthStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1.7' }
};
my $oid_raidControllerDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1';
@ -66,16 +66,21 @@ sub check {
$self->{components}->{raidcontroller}->{total}++;
if (defined($map_status{$result->{raidControllerHealthStatus}})) {
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]",
$result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"raid controller '%s' status is '%s' [instance: %s]",
$result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}, $instance,
)
);
my $exit = $self->get_severity(section => 'raidcontroller', value => $map_status{$result->{raidControllerHealthStatus}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}})
);
}
next;
}
@ -83,14 +88,19 @@ sub check {
next if (!($result->{raidControllerHealthStatus} & (1 << $i)));
my $status = $bitmap_status{$i};
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]",
$result->{raidControllerComponentName}, $status, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"raid controller '%s' status is '%s' [instance: %s]",
$result->{raidControllerComponentName}, $status, $instance,
)
);
my $exit = $self->get_severity(section => 'raidcontroller', value => $status);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $status));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $status)
);
}
}
}

View File

@ -25,7 +25,7 @@ use warnings;
my $mapping = {
temperatureObject => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.26.50.1.2' },
temperatureReading => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.26.50.1.3' },
temperatureReading => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.26.50.1.3' }
};
my $oid_temperatureDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.26.50.1';
@ -54,19 +54,24 @@ sub check {
next if ($self->check_filter(section => 'temperature', instance => $instance));
next if ($result->{temperatureReading} == 65535);
$self->{components}->{temperature}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Temperature of '%s' is '%s' celsius degrees [instance = %s]",
$result->{temperatureObject}, $result->{temperatureReading} / 10, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"temperature of '%s' is '%s' celsius degrees [instance: %s]",
$result->{temperatureObject}, $result->{temperatureReading} / 10, $instance,
)
);
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{temperatureReading} / 10);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Temperature of '%s' is '%s' celsius degrees", $result->{temperatureObject}, $result->{temperatureReading} / 10));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Temperature of '%s' is '%s' celsius degrees", $result->{temperatureObject}, $result->{temperatureReading} / 10)
);
}
$self->{output}->perfdata_add(
label => 'temperature', unit => 'C',
nlabel => 'hardware.temperature.celsius',
unit => 'C',
instances => $result->{temperatureObject},
value => $result->{temperatureReading} / 10,
warning => $warn,

View File

@ -74,7 +74,7 @@ sub snmp_execute {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {});

View File

@ -29,10 +29,9 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
%{$self->{modes}} = (
'hardware' => 'hardware::server::xfusion::ibmc::snmp::mode::hardware',
);
$self->{modes} = {
'hardware' => 'hardware::server::xfusion::ibmc::snmp::mode::hardware'
};
return $self;
}