enh(dell/os10): hardware mode - add os version (#2998)

This commit is contained in:
qgarnier 2021-07-29 16:07:33 +02:00 committed by GitHub
parent c7dbb2f4f4
commit ea7e86fc71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 4 deletions

View File

@ -29,7 +29,8 @@ sub set_system {
my ($self, %options) = @_;
$self->{regexp_threshold_numeric_check_section_option} = '^(?:temperature)$';
$self->{cb_hook1} = 'get_system_information';
$self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = {
@ -39,7 +40,7 @@ sub set_system {
['cardProblem', 'CRITICAL'],
['diagMode', 'OK'],
['cardAbsent', 'OK'],
['offline', 'OK'],
['offline', 'OK']
],
operational => [
['up', 'OK'],
@ -49,14 +50,34 @@ sub set_system {
['dormant', 'OK'],
['notPresent', 'OK'],
['lowerLayerDown', 'OK'],
['failed', 'CRITICAL'],
],
['failed', 'CRITICAL']
]
};
$self->{components_path} = 'network::dell::os10::snmp::mode::components';
$self->{components_module} = ['card', 'temperature', 'fan', 'fantray', 'psu'];
}
sub get_system_information {
my ($self, %options) = @_;
my $oid_sysdescr = '.1.3.6.1.2.1.1.1.0';
my $result = $options{snmp}->get_leef(oids => [$oid_sysdescr]);
my $version = 'unknown';
if (defined($result->{$oid_sysdescr}) && $result->{$oid_sysdescr} =~ /OS Version: ([0-9\.]+)/msi) {
$version = $1;
$version =~ s/\.$//;
}
$self->{output}->output_add(
long_msg => sprintf(
'os version: %s',
$version
)
);
}
sub snmp_execute {
my ($self, %options) = @_;