mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
fix(alcatel/omniswitch): cpu mode - thresholds (#3123)
This commit is contained in:
parent
2c25515f1a
commit
ecbcdbd67d
@ -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();
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ sub check_options {
|
|||||||
|
|
||||||
sub check_cpu {
|
sub check_cpu {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $exit1 = $self->{perfdata}->threshold_check(
|
my $exit1 = $self->{perfdata}->threshold_check(
|
||||||
value => $options{'1min'},
|
value => $options{'1min'},
|
||||||
threshold => [
|
threshold => [
|
||||||
@ -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(
|
||||||
value => $options{'1min'},
|
label => "cpu1m" . $options{perf_label} , unit => '%',
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'),
|
value => $options{'1min'},
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'),
|
||||||
min => 0, max => 100);
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'),
|
||||||
$self->{output}->perfdata_add(label => "cpu1h" . $options{perf_label} , unit => '%',
|
min => 0, max => 100
|
||||||
value => $options{'1hour'},
|
);
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1h'),
|
$self->{output}->perfdata_add(
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1h'),
|
label => "cpu1h" . $options{perf_label} , unit => '%',
|
||||||
min => 0, max => 100);
|
value => $options{'1hour'},
|
||||||
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1h'),
|
||||||
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1h'),
|
||||||
|
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 => [
|
||||||
@ -133,7 +139,7 @@ sub run {
|
|||||||
if (scalar(keys %{$snmp_result->{ $mapping->{aos7}->{entry_module} }}) > 0) {
|
if (scalar(keys %{$snmp_result->{ $mapping->{aos7}->{entry_module} }}) > 0) {
|
||||||
$type = 'aos7';
|
$type = 'aos7';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined($mapping->{$type}->{device})) {
|
if (defined($mapping->{$type}->{device})) {
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping->{$type}->{device}, results => $snmp_result->{ $mapping->{$type}->{entry_device} }, instance => '0');
|
my $result = $options{snmp}->map_instance(mapping => $mapping->{$type}->{device}, results => $snmp_result->{ $mapping->{$type}->{entry_device} }, instance => '0');
|
||||||
$self->check_cpu(
|
$self->check_cpu(
|
||||||
@ -143,11 +149,11 @@ sub run {
|
|||||||
'1hour' => $result->{healthDeviceCpu1HrAvg}
|
'1hour' => $result->{healthDeviceCpu1HrAvg}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $oid ($options{snmp}->oid_lex_sort(keys %{$snmp_result->{ $mapping->{$type}->{entry_module} }})) {
|
foreach my $oid ($options{snmp}->oid_lex_sort(keys %{$snmp_result->{ $mapping->{$type}->{entry_module} }})) {
|
||||||
next if ($oid !~ /^$mapping->{$type}->{module}->{healthModuleCpu1MinAvg}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{$type}->{module}->{healthModuleCpu1MinAvg}->{oid}\.(.*)$/);
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping->{$type}->{module}, results => $snmp_result->{ $mapping->{$type}->{entry_module} }, instance => $1);
|
my $result = $options{snmp}->map_instance(mapping => $mapping->{$type}->{module}, results => $snmp_result->{ $mapping->{$type}->{entry_module} }, instance => $1);
|
||||||
|
|
||||||
$self->check_cpu(
|
$self->check_cpu(
|
||||||
name => "Module cpu '$1'",
|
name => "Module cpu '$1'",
|
||||||
perf_label => "_module_$1",
|
perf_label => "_module_$1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user