enh(supermicro): force new metrics (#3067)

This commit is contained in:
qgarnier 2021-09-01 09:25:51 +02:00 committed by GitHub
parent 88c39bc817
commit 33724ba2b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 19 deletions

View File

@ -143,7 +143,7 @@ sub check {
$self->{components}->{sensor}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"sensor '%s' reading is '%s' [instance = %s]",
"sensor '%s' reading is '%s' [instance: %s]",
$result->{sensorIDString},
$result->{sensorReading},
$instance . '#' . $result->{sensorIDString}

View File

@ -30,9 +30,9 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
%{$self->{modes}} = (
'sensors' => 'hardware::server::supermicro::bmc::snmp::mode::hardware',
);
$self->{modes} = {
'sensors' => 'hardware::server::supermicro::bmc::snmp::mode::hardware'
};
return $self;
}

View File

@ -29,9 +29,9 @@ sub set_system {
my ($self, %options) = @_;
$self->{regexp_threshold_numeric_check_section_option} = '^(sensor\..*)$';
$self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = {
sensor => [
['ok', 'OK'],
@ -50,7 +50,7 @@ sub set_system {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_load_components => 1);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_load_components => 1, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {});
@ -115,7 +115,7 @@ use warnings;
my %map_sensor_status = (0 => 'ok', 1 => 'warning', 2 => 'critical');
my %map_sensor_type = (
0 => 'fan', 1 => 'voltage', 2 => 'temperature', 3 => 'discrete',
0 => 'fan', 1 => 'voltage', 2 => 'temperature', 3 => 'discrete'
);
my %map_sensor_monitored = (
0 => 'not monitored', 1 => 'monitored',
@ -127,13 +127,13 @@ my $mapping = {
smHealthMonitorReading => { oid => '.1.3.6.1.4.1.10876.2.1.1.1.1.4' },
smHealthMonitorMonitor => { oid => '.1.3.6.1.4.1.10876.2.1.1.1.1.10', map => \%map_sensor_monitored },
smHealthMonitorReadingUnit => { oid => '.1.3.6.1.4.1.10876.2.1.1.1.1.11' },
smHealthMonitorStatus => { oid => '.1.3.6.1.4.1.10876.2.1.1.1.1.12', map => \%map_sensor_status },
smHealthMonitorStatus => { oid => '.1.3.6.1.4.1.10876.2.1.1.1.1.12', map => \%map_sensor_status }
};
my $oid_smHealthMonitorEntry = '.1.3.6.1.4.1.10876.2.1.1.1.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_smHealthMonitorEntry };
}
@ -156,7 +156,7 @@ sub check {
$self->{components}->{sensor}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"sensor '%s' status is '%s' [instance = %s, value = %s]",
"sensor '%s' status is '%s' [instance: %s, value: %s]",
$result->{smHealthMonitorName},
defined($result->{smHealthMonitorStatus}) ? $result->{smHealthMonitorStatus} : 'undefined',
$result->{smHealthMonitorType} . '.' . $instance,
@ -197,8 +197,8 @@ sub check {
# need some snmpwalk to do unit mapping!! experimental
$self->{output}->perfdata_add(
label => $component, unit => $result->{smHealthMonitorReadingUnit},
nlabel => 'hardware.sensor.' . $result->{smHealthMonitorType} . '.' . $result->{smHealthMonitorReadingUnit},
unit => $result->{smHealthMonitorReadingUnit},
instances => $result->{smHealthMonitorName},
value => $result->{smHealthMonitorReading},
warning => $warn,
@ -218,7 +218,7 @@ my %map_memory_status = (0 => 'ok', 2 => 'critical');
my $mapping_memory = {
memTag => { oid => '.1.3.6.1.4.1.10876.100.1.3.1.1' },
memDeviceStatus => { oid => '.1.3.6.1.4.1.10876.100.1.3.1.3', map => \%map_memory_status },
memDeviceStatus => { oid => '.1.3.6.1.4.1.10876.100.1.3.1.3', map => \%map_memory_status }
};
my $oid_memEntry = '.1.3.6.1.4.1.10876.100.1.3.1';
@ -245,7 +245,7 @@ sub check {
$self->{components}->{memory}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"memory '%s' status is '%s' [instance = %s]",
"memory '%s' status is '%s' [instance: %s]",
$result->{memTag},
$result->{memDeviceStatus},
$instance
@ -304,7 +304,7 @@ sub check {
$self->{components}->{memory}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"disk '%s' status is '%s' [instance = %s]",
"disk '%s' status is '%s' [instance: %s]",
$result->{diskName},
$result->{diskSmartStatus},
$instance
@ -361,7 +361,7 @@ sub check {
$self->{components}->{cpu}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"cpu '%s' status is '%s' [instance = %s]",
"cpu '%s' status is '%s' [instance: %s]",
$instance,
$result->{cpuDeviceStatus},
$instance

View File

@ -30,9 +30,9 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
%{$self->{modes}} = (
'hardware' => 'hardware::server::supermicro::superdoctor::snmp::mode::hardware',
);
$self->{modes} = {
'hardware' => 'hardware::server::supermicro::superdoctor::snmp::mode::hardware'
};
return $self;
}