fix(alcatel/omniswitch): cpu mode - thresholds (#3123)

This commit is contained in:
qgarnier 2021-09-17 16:32:20 +02:00 committed by GitHub
parent 2c25515f1a
commit ecbcdbd67d

View File

@ -57,7 +57,7 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "Wrong critical (1min) threshold '" . $self->{crit1m} . "'."); $self->{output}->add_option_msg(short_msg => "Wrong critical (1min) threshold '" . $self->{crit1m} . "'.");
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
if (($self->{perfdata}->threshold_validate(label => 'crit5h', value => $self->{crit5})) == 0) { if (($self->{perfdata}->threshold_validate(label => 'crit1h', value => $self->{crit1h})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical (1hour) threshold '" . $self->{crit1h} . "'."); $self->{output}->add_option_msg(short_msg => "Wrong critical (1hour) threshold '" . $self->{crit1h} . "'.");
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
@ -83,19 +83,25 @@ sub check_cpu {
my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]);
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("%s: %.2f%% (1min), %.2f%% (1hour)", $options{name}, $options{'1min'}, $options{'1hour'})); severity => $exit,
short_msg => sprintf("%s: %.2f%% (1min), %.2f%% (1hour)", $options{name}, $options{'1min'}, $options{'1hour'})
);
$self->{output}->perfdata_add(label => "cpu1m" . $options{perf_label} , unit => '%', $self->{output}->perfdata_add(
label => "cpu1m" . $options{perf_label} , unit => '%',
value => $options{'1min'}, value => $options{'1min'},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'),
min => 0, max => 100); min => 0, max => 100
$self->{output}->perfdata_add(label => "cpu1h" . $options{perf_label} , unit => '%', );
$self->{output}->perfdata_add(
label => "cpu1h" . $options{perf_label} , unit => '%',
value => $options{'1hour'}, value => $options{'1hour'},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1h'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1h'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1h'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1h'),
min => 0, max => 100); min => 0, max => 100
);
} }
sub run { sub run {
@ -107,20 +113,20 @@ sub run {
entry_module => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1', entry_module => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1',
device => { device => {
healthDeviceCpu1MinAvg => { oid => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.14' }, healthDeviceCpu1MinAvg => { oid => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.14' },
healthDeviceCpu1HrAvg => { oid => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.15' }, healthDeviceCpu1HrAvg => { oid => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.15' }
}, },
module => { module => {
healthModuleCpu1MinAvg => { oid => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.15' }, healthModuleCpu1MinAvg => { oid => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.15' },
healthModuleCpu1HrAvg => { oid => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.16' }, healthModuleCpu1HrAvg => { oid => '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.16' }
}, }
}, },
aos7 => { aos7 => {
entry_module => '.1.3.6.1.4.1.6486.801.1.2.1.16.1.1.1.1.1', entry_module => '.1.3.6.1.4.1.6486.801.1.2.1.16.1.1.1.1.1',
module => { module => {
healthModuleCpu1MinAvg => { oid => '.1.3.6.1.4.1.6486.801.1.2.1.16.1.1.1.1.1.11' }, healthModuleCpu1MinAvg => { oid => '.1.3.6.1.4.1.6486.801.1.2.1.16.1.1.1.1.1.11' },
healthModuleCpu1HrAvg => { oid => '.1.3.6.1.4.1.6486.801.1.2.1.16.1.1.1.1.1.12' }, healthModuleCpu1HrAvg => { oid => '.1.3.6.1.4.1.6486.801.1.2.1.16.1.1.1.1.1.12' }
}, }
}, }
}; };
my $snmp_result = $options{snmp}->get_multiple_table(oids => [ my $snmp_result = $options{snmp}->get_multiple_table(oids => [