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

View File

@ -29,12 +29,12 @@ my %map_status = (
3 => 'major', 3 => 'major',
4 => 'critical', 4 => 'critical',
5 => 'absence', 5 => 'absence',
6 => 'unknown', 6 => 'unknown'
); );
my $mapping = { my $mapping = {
cpuStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.15.50.1.6', map => \%map_status }, 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'; 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}}, { push @{$self->{request}}, {
oid => $oid_cpuDescriptionEntry, oid => $oid_cpuDescriptionEntry,
start => $mapping->{cpuStatus}->{oid}, start => $mapping->{cpuStatus}->{oid},
end => $mapping->{cpuDevicename}->{oid}, end => $mapping->{cpuDevicename}->{oid}
}; };
} }
@ -64,14 +64,19 @@ sub check {
next if ($result->{cpuStatus} =~ /absence/); next if ($result->{cpuStatus} =~ /absence/);
$self->{components}->{cpu}->{total}++; $self->{components}->{cpu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Cpu '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
long_msg => sprintf(
"cpu '%s' status is '%s' [instance: %s]",
$result->{cpuDevicename}, $result->{cpuStatus}, $instance, $result->{cpuDevicename}, $result->{cpuStatus}, $instance,
)); )
);
my $exit = $self->get_severity(label => 'default', section => 'cpu', value => $result->{cpuStatus}); my $exit = $self->get_severity(label => 'default', section => 'cpu', value => $result->{cpuStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Cpu '%s' status is '%s'", $result->{cpuDevicename}, $result->{cpuStatus})); 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', 3 => 'major',
4 => 'critical', 4 => 'critical',
5 => 'absence', 5 => 'absence',
6 => 'unknown', 6 => 'unknown'
); );
my %map_installation_status = ( my %map_installation_status = (
1 => 'absence', 1 => 'absence',
2 => 'presence', 2 => 'presence',
3 => 'unknown', 3 => 'unknown'
); );
my $mapping = { my $mapping = {
fanSpeed => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.2' }, 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 }, 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 }, 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'; 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}); 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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Fan '%s' speed is %s RPM", $result->{fanDevicename}, $result->{fanSpeed})); severity => $exit,
short_msg => sprintf("Fan '%s' speed is %s RPM", $result->{fanDevicename}, $result->{fanSpeed})
);
} }
$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 => $result->{fanDevicename}, instances => $result->{fanDevicename},
value => $result->{fanSpeed}, value => $result->{fanSpeed},
warning => $warn, warning => $warn,
@ -87,14 +89,19 @@ sub check {
); );
} }
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
long_msg => sprintf(
"fan '%s' status is '%s' [instance: %s]",
$result->{fanDevicename}, $result->{fanStatus}, $instance, $result->{fanDevicename}, $result->{fanStatus}, $instance,
)); )
);
my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{fanStatus}); my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{fanStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Fan '%s' status is '%s'", $result->{fanDevicename}, $result->{fanStatus})); 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', 3 => 'major',
4 => 'critical', 4 => 'critical',
5 => 'absence', 5 => 'absence',
6 => 'unknown', 6 => 'unknown'
); );
my %map_installation_status = ( my %map_installation_status = (
1 => 'absence', 1 => 'absence',
2 => 'presence', 2 => 'presence',
3 => 'unknown', 3 => 'unknown'
); );
my $mapping = { my $mapping = {
hardDiskPresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.2', map => \%map_installation_status }, 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 }, 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' }, 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'; 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}}, { push @{$self->{request}}, {
oid => $oid_hardDiskDescriptionEntry, oid => $oid_hardDiskDescriptionEntry,
start => $mapping->{hardDiskPresence}->{oid}, 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}); 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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Hard Disk '%s' temperature is %s celsius degrees", $result->{hardDiskDevicename}, $result->{hardDiskTemperature})); severity => $exit,
short_msg => sprintf("Hard Disk '%s' temperature is %s celsius degrees", $result->{hardDiskDevicename}, $result->{hardDiskTemperature})
);
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'temperature', unit => 'C',
nlabel => 'hardware.harddisk.temperature.celsius', nlabel => 'hardware.harddisk.temperature.celsius',
unit => 'C',
instances => $result->{hardDiskDevicename}, instances => $result->{hardDiskDevicename},
value => $result->{hardDiskTemperature}, value => $result->{hardDiskTemperature},
warning => $warn, warning => $warn,
@ -91,14 +93,19 @@ sub check {
); );
} }
$self->{output}->output_add(long_msg => sprintf("Hard disk '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
long_msg => sprintf(
"hard disk '%s' status is '%s' [instance: %s]",
$result->{hardDiskDevicename}, $result->{hardDiskStatus}, $instance, $result->{hardDiskDevicename}, $result->{hardDiskStatus}, $instance,
)); )
);
my $exit = $self->get_severity(label => 'default', section => 'harddisk', value => $result->{hardDiskStatus}); my $exit = $self->get_severity(label => 'default', section => 'harddisk', value => $result->{hardDiskStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Hard disk '%s' status is '%s'", $result->{hardDiskDevicename}, $result->{hardDiskStatus})); 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', 2 => 'partial degraded',
3 => 'degraded', 3 => 'degraded',
4 => 'optimal', 4 => 'optimal',
255 => 'unknown', 255 => 'unknown'
); );
my $mapping = { my $mapping = {
logicalDriveRAIDControllerIndex => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1.1' }, 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' }, 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'; 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}}, { push @{$self->{request}}, {
oid => $oid_logicalDriveDescriptionEntry, 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)); next if ($self->check_filter(section => 'logicaldrive', instance => $instance));
$self->{components}->{logicaldrive}->{total}++; $self->{components}->{logicaldrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Logical drive '%s.%s' status is '%s' [instance = %s]", $self->{output}->output_add(
long_msg => sprintf(
"logical drive '%s.%s' status is '%s' [instance: %s]",
$result->{logicalDriveRAIDControllerIndex}, $result->{logicalDriveIndex}, $result->{logicalDriveState}, $instance, $result->{logicalDriveRAIDControllerIndex}, $result->{logicalDriveIndex}, $result->{logicalDriveState}, $instance,
)); )
);
my $exit = $self->get_severity(section => 'logicaldrive', value => $result->{logicalDriveState}); my $exit = $self->get_severity(section => 'logicaldrive', value => $result->{logicalDriveState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Logical drive '%s.%s' status is '%s'", severity => $exit,
short_msg => sprintf(
"Logical drive '%s.%s' status is '%s'",
$result->{logicalDriveRAIDControllerIndex}, $result->{logicalDriveRAIDControllerIndex},
$result->{logicalDriveIndex}, $result->{logicalDriveIndex},
$result->{logicalDriveState})); $result->{logicalDriveState}
)
);
} }
} }
} }

View File

@ -29,12 +29,12 @@ my %map_status = (
3 => 'major', 3 => 'major',
4 => 'critical', 4 => 'critical',
5 => 'absence', 5 => 'absence',
6 => 'unknown', 6 => 'unknown'
); );
my $mapping = { my $mapping = {
memoryStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.16.50.1.6', map => \%map_status }, 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'; 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}}, { push @{$self->{request}}, {
oid => $oid_memoryDescriptionEntry, oid => $oid_memoryDescriptionEntry,
start => $mapping->{memoryStatus}->{oid}, start => $mapping->{memoryStatus}->{oid},
end => $mapping->{memoryDevicename}->{oid}, end => $mapping->{memoryDevicename}->{oid}
}; };
} }
@ -64,14 +64,19 @@ sub check {
next if ($result->{memoryStatus} =~ /absence/); next if ($result->{memoryStatus} =~ /absence/);
$self->{components}->{memory}->{total}++; $self->{components}->{memory}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Memory '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
long_msg => sprintf(
"memory '%s' status is '%s' [instance: %s]",
$result->{memoryDevicename}, $result->{memoryStatus}, $instance, $result->{memoryDevicename}, $result->{memoryStatus}, $instance,
)); )
);
my $exit = $self->get_severity(label => 'default', section => 'memory', value => $result->{memoryStatus}); my $exit = $self->get_severity(label => 'default', section => 'memory', value => $result->{memoryStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Memory '%s' status is '%s'", $result->{memoryDevicename}, $result->{memoryStatus})); 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', 3 => 'major',
4 => 'critical', 4 => 'critical',
5 => 'absence', 5 => 'absence',
6 => 'unknown', 6 => 'unknown'
); );
my %map_installation_status = ( my %map_installation_status = (
1 => 'absence', 1 => 'absence',
2 => 'presence', 2 => 'presence',
3 => 'unknown', 3 => 'unknown'
); );
my $mapping = { my $mapping = {
pCIePresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1.2', map => \%map_installation_status }, 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 }, 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'; 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}}, { push @{$self->{request}}, {
oid => $oid_pCIeDescriptionEntry, oid => $oid_pCIeDescriptionEntry,
start => $mapping->{pCIePresence}->{oid}, start => $mapping->{pCIePresence}->{oid},
end => $mapping->{pCIeDevicename}->{oid}, end => $mapping->{pCIeDevicename}->{oid}
}; };
} }
@ -71,14 +71,19 @@ sub check {
next if ($result->{pCIePresence} !~ /presence/); next if ($result->{pCIePresence} !~ /presence/);
$self->{components}->{pcie}->{total}++; $self->{components}->{pcie}->{total}++;
$self->{output}->output_add(long_msg => sprintf("PCIe '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
$result->{pCIeDevicename}, $result->{pCIeStatus}, $instance, 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}); my $exit = $self->get_severity(label => 'default', section => 'pcie', value => $result->{pCIeStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("PCIe '%s' status is '%s'", $result->{pCIeDevicename}, $result->{pCIeStatus})); 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', 3 => 'major',
4 => 'critical', 4 => 'critical',
5 => 'absence', 5 => 'absence',
6 => 'unknown', 6 => 'unknown'
); );
my %map_installation_status = ( my %map_installation_status = (
1 => 'absence', 1 => 'absence',
2 => 'presence', 2 => 'presence',
3 => 'unknown', 3 => 'unknown'
); );
my $mapping = { 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 }, 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' }, 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 }, 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'; 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}}, { push @{$self->{request}}, {
oid => $oid_powerSupplyDescriptionEntry, 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}); 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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Power supply '%s' power is %s watts", $result->{powerSupplyDevicename}, $result->{powerSupplyInputPower})); severity => $exit,
short_msg => sprintf("Power supply '%s' power is %s watts", $result->{powerSupplyDevicename}, $result->{powerSupplyInputPower})
);
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt', nlabel => 'hardware.powersupply.power.watt',
unit => 'W',
instances => $result->{powerSupplyDevicename}, instances => $result->{powerSupplyDevicename},
value => $result->{powerSupplyInputPower}, value => $result->{powerSupplyInputPower},
warning => $warn, warning => $warn,
@ -93,14 +95,19 @@ sub check {
); );
} }
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
long_msg => sprintf(
"power supply '%s' status is '%s' [instance: %s]",
$result->{powerSupplyDevicename}, $result->{powerSupplyStatus}, $instance, $result->{powerSupplyDevicename}, $result->{powerSupplyStatus}, $instance,
)); )
);
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{powerSupplyStatus}); my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{powerSupplyStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Power supply '%s' status is '%s'", $result->{powerSupplyDevicename}, $result->{powerSupplyStatus})); 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 = { my $mapping = {
raidControllerComponentName => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1.4' }, 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'; my $oid_raidControllerDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1';
@ -66,14 +66,19 @@ sub check {
$self->{components}->{raidcontroller}->{total}++; $self->{components}->{raidcontroller}->{total}++;
if (defined($map_status{$result->{raidControllerHealthStatus}})) { if (defined($map_status{$result->{raidControllerHealthStatus}})) {
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
long_msg => sprintf(
"raid controller '%s' status is '%s' [instance: %s]",
$result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}, $instance, $result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}, $instance,
)); )
);
my $exit = $self->get_severity(section => 'raidcontroller', value => $map_status{$result->{raidControllerHealthStatus}}); my $exit = $self->get_severity(section => 'raidcontroller', value => $map_status{$result->{raidControllerHealthStatus}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}})); severity => $exit,
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}})
);
} }
next; next;
@ -83,14 +88,19 @@ sub check {
next if (!($result->{raidControllerHealthStatus} & (1 << $i))); next if (!($result->{raidControllerHealthStatus} & (1 << $i)));
my $status = $bitmap_status{$i}; my $status = $bitmap_status{$i};
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
long_msg => sprintf(
"raid controller '%s' status is '%s' [instance: %s]",
$result->{raidControllerComponentName}, $status, $instance, $result->{raidControllerComponentName}, $status, $instance,
)); )
);
my $exit = $self->get_severity(section => 'raidcontroller', value => $status); my $exit = $self->get_severity(section => 'raidcontroller', value => $status);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $status)); severity => $exit,
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $status)
);
} }
} }
} }

View File

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

View File

@ -74,7 +74,7 @@ sub snmp_execute {
sub new { sub new {
my ($class, %options) = @_; 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; bless $self, $class;
$options{options}->add_options(arguments => {}); $options{options}->add_options(arguments => {});

View File

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