fix thresholds
This commit is contained in:
parent
5971c2530e
commit
70d796193d
|
@ -30,9 +30,9 @@ my $thresholds = {
|
||||||
['indeterminate', 'UNKNOWN'],
|
['indeterminate', 'UNKNOWN'],
|
||||||
['main', 'OK'],
|
['main', 'OK'],
|
||||||
['stand-by', 'OK'],
|
['stand-by', 'OK'],
|
||||||
['active-pcs', 'CRITICAL'],
|
|
||||||
['inactive-pcs', 'CRITICAL'],
|
['inactive-pcs', 'CRITICAL'],
|
||||||
],
|
['active-pcs', 'CRITICAL']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
my %map_role = (
|
my %map_role = (
|
||||||
0 => 'indeterminate',
|
0 => 'indeterminate',
|
||||||
|
@ -46,11 +46,11 @@ sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'threshold-overload:s@' => { name => 'threshold_overload' },
|
||||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
});
|
||||||
});
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,12 +82,12 @@ sub run {
|
||||||
my $oid_pbxRole = '.1.3.6.1.4.1.637.64.4400.1.4.0';
|
my $oid_pbxRole = '.1.3.6.1.4.1.637.64.4400.1.4.0';
|
||||||
my $oid_pbxRole_buggy = '.1.3.6.1.4.1.637.64.4400.1.4';
|
my $oid_pbxRole_buggy = '.1.3.6.1.4.1.637.64.4400.1.4';
|
||||||
my $result = $self->{snmp}->get_leef(oids => [$oid_pbxRole, $oid_pbxRole_buggy], nothing_quit => 1);
|
my $result = $self->{snmp}->get_leef(oids => [$oid_pbxRole, $oid_pbxRole_buggy], nothing_quit => 1);
|
||||||
|
|
||||||
my $pbx_role = defined($result->{$oid_pbxRole}) ? $map_role{$result->{$oid_pbxRole}} : $map_role{$result->{$oid_pbxRole_buggy}};
|
my $pbx_role = defined($result->{$oid_pbxRole}) ? $map_role{$result->{$oid_pbxRole}} : $map_role{$result->{$oid_pbxRole_buggy}};
|
||||||
my $exit = $self->get_severity(section => 'role', value => $pbx_role);
|
my $exit = $self->get_severity(section => 'role', value => $pbx_role);
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("PBX Role is '%s'", $pbx_role));
|
short_msg => sprintf("PBX Role is '%s'", $pbx_role));
|
||||||
|
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ sub run {
|
||||||
sub get_severity {
|
sub get_severity {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
my $status = 'UNKNOWN'; # default
|
my $status = 'UNKNOWN'; # default
|
||||||
|
|
||||||
if (defined($self->{overload_th}->{$options{section}})) {
|
if (defined($self->{overload_th}->{$options{section}})) {
|
||||||
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||||
if ($options{value} =~ /$_->{filter}/i) {
|
if ($options{value} =~ /$_->{filter}/i) {
|
||||||
|
|
Loading…
Reference in New Issue