fix peplink silverpeak plugins typos (#1045)
* fix peplink plugin typos * fix silverpeak plugin typos
This commit is contained in:
parent
3e2f40aaaf
commit
07d3bb5fa2
|
@ -82,7 +82,7 @@ __END__
|
||||||
|
|
||||||
=head1 MODE
|
=head1 MODE
|
||||||
|
|
||||||
Check cpu usage (DEVICE.mib).
|
Check cpu usage (PEPLINK-BALANCE-MIB).
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ __END__
|
||||||
|
|
||||||
=head1 MODE
|
=head1 MODE
|
||||||
|
|
||||||
Check memory usage (Device.mib).
|
Check memory usage (PEPLINK-BALANCE-MIB).
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,10 @@ sub new {
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
%{$self->{modes}} = (
|
||||||
'cpu' => 'network::peplink::balance::snmp::mode::cpu',
|
'cpu' => 'network::peplink::balance::snmp::mode::cpu',
|
||||||
'memory' => 'network::peplink::balance::snmp::mode::memory',
|
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
'memory' => 'network::peplink::balance::snmp::mode::memory',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
|
|
@ -28,7 +28,6 @@ use POSIX;
|
||||||
use centreon::plugins::misc;
|
use centreon::plugins::misc;
|
||||||
use centreon::plugins::statefile;
|
use centreon::plugins::statefile;
|
||||||
|
|
||||||
|
|
||||||
my $instance_mode;
|
my $instance_mode;
|
||||||
|
|
||||||
sub custom_status_threshold {
|
sub custom_status_threshold {
|
||||||
|
@ -44,7 +43,7 @@ sub custom_status_threshold {
|
||||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||||
$status = 'critical';
|
$status = 'critical';
|
||||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||||
$status = 'warning';
|
$status = 'warning';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -74,7 +73,6 @@ sub custom_status_calc {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
@ -86,7 +84,8 @@ sub set_counters {
|
||||||
|
|
||||||
$self->{maps_counters}->{alarm} = [
|
$self->{maps_counters}->{alarm} = [
|
||||||
{ label => 'status', threshold => 0, set => {
|
{ label => 'status', threshold => 0, set => {
|
||||||
key_values => [ { name => 'spsActiveAlarmSource' }, { name => 'spsActiveAlarmDescr' }, { name => 'since' }, { name => 'spsActiveAlarmSeverity' }, { name => 'spsActiveAlarmLogTime' } ],
|
key_values => [ { name => 'spsActiveAlarmSource' }, { name => 'spsActiveAlarmDescr' },
|
||||||
|
{ name => 'since' }, { name => 'spsActiveAlarmSeverity' }, { name => 'spsActiveAlarmLogTime' } ],
|
||||||
closure_custom_calc => $self->can('custom_status_calc'),
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
|
|
|
@ -38,7 +38,7 @@ sub custom_status_threshold {
|
||||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||||
$status = 'critical';
|
$status = 'critical';
|
||||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||||
$status = 'warning';
|
$status = 'warning';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -79,7 +79,6 @@ sub set_counters {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
@ -141,7 +140,7 @@ Trigger warning on %{operStatus} values
|
||||||
=item B<--critical-status>
|
=item B<--critical-status>
|
||||||
|
|
||||||
Trigger critical on %{operStatus} values
|
Trigger critical on %{operStatus} values
|
||||||
(default: '%{operStatus} !~ /(Normal)/')
|
(Default: '%{operStatus} !~ /(Normal)/')
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ sub new {
|
||||||
"warning:s" => { name => 'warning' },
|
"warning:s" => { name => 'warning' },
|
||||||
"critical:s" => { name => 'critical' },
|
"critical:s" => { name => 'critical' },
|
||||||
"force-oid:s" => { name => 'force_oid' },
|
"force-oid:s" => { name => 'force_oid' },
|
||||||
"check-overload" => { name => 'check_overload' },
|
"check-overflow" => { name => 'check_overflow' },
|
||||||
});
|
});
|
||||||
|
|
||||||
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
|
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
|
||||||
|
@ -63,17 +63,17 @@ sub check_options {
|
||||||
$self->{statefile_cache}->check_options(%options);
|
$self->{statefile_cache}->check_options(%options);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_overload {
|
sub check_overflow {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
return $options{timeticks} if (!defined($self->{option_results}->{check_overload}));
|
return $options{timeticks} if (!defined($self->{option_results}->{check_overflow}));
|
||||||
|
|
||||||
my $current_time = floor(time() * 100);
|
my $current_time = floor(time() * 100);
|
||||||
$self->{new_datas} = { last_time => $current_time, uptime => $options{timeticks}, overload => 0 };
|
$self->{new_datas} = { last_time => $current_time, uptime => $options{timeticks}, overflow => 0 };
|
||||||
$self->{statefile_cache}->read(statefile => "cache_" . $self->{snmp}->get_hostname() . '_' . $self->{snmp}->get_port() . '_' . $self->{mode});
|
$self->{statefile_cache}->read(statefile => "cache_" . $self->{snmp}->get_hostname() . '_' . $self->{snmp}->get_port() . '_' . $self->{mode});
|
||||||
my $old_uptime = $self->{statefile_cache}->get(name => 'uptime');
|
my $old_uptime = $self->{statefile_cache}->get(name => 'uptime');
|
||||||
my $last_time = $self->{statefile_cache}->get(name => 'last_time');
|
my $last_time = $self->{statefile_cache}->get(name => 'last_time');
|
||||||
my $overload = $self->{statefile_cache}->get(name => 'overload');
|
my $overflow = $self->{statefile_cache}->get(name => 'overflow');
|
||||||
|
|
||||||
if (defined($old_uptime) && $old_uptime < $current_time) {
|
if (defined($old_uptime) && $old_uptime < $current_time) {
|
||||||
my $diff_time = $current_time - $last_time;
|
my $diff_time = $current_time - $last_time;
|
||||||
|
@ -82,12 +82,12 @@ sub check_overload {
|
||||||
if ($division >= 1 &&
|
if ($division >= 1 &&
|
||||||
$overflow >= ($options{timeticks} - 5000) &&
|
$overflow >= ($options{timeticks} - 5000) &&
|
||||||
$overflow <= ($options{timeticks} + 5000)) {
|
$overflow <= ($options{timeticks} + 5000)) {
|
||||||
$overload++;
|
$overflow++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$options{timeticks} += ($overload * 4294967296);
|
$options{timeticks} += ($overflow * 4294967296);
|
||||||
}
|
}
|
||||||
$self->{new_datas}->{overload} = $overload if (defined($overload));
|
$self->{new_datas}->{overflow} = $overflow if (defined($overflow));
|
||||||
|
|
||||||
$self->{statefile_cache}->write(data => $self->{new_datas});
|
$self->{statefile_cache}->write(data => $self->{new_datas});
|
||||||
return $options{timeticks};
|
return $options{timeticks};
|
||||||
|
@ -97,7 +97,7 @@ sub run {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
# spsSystemUptime from SILVERPEAK-MGMT-MIB 8.0
|
# spsSystemUptime from SILVERPEAK-MGMT-MIB 8.0
|
||||||
my $oid_hrSystemUptime = '.1.3.6.1.4.1.23867.3.1.1.1.5.0';
|
my $oid_hrSystemUptime = '.1.3.6.1.4.1.23867.3.1.1.1.5.0';
|
||||||
my ($result, $value);
|
my ($result, $value);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ sub run {
|
||||||
$value = $result->{$oid_hrSystemUptime};
|
$value = $result->{$oid_hrSystemUptime};
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $self->check_overload(timeticks => $value);
|
$value = $self->check_overflow(timeticks => $value);
|
||||||
$value = floor($value / 100);
|
$value = floor($value / 100);
|
||||||
|
|
||||||
my $exit_code = $self->{perfdata}->threshold_check(value => $value,
|
my $exit_code = $self->{perfdata}->threshold_check(value => $value,
|
||||||
|
@ -150,7 +150,7 @@ Threshold critical in seconds.
|
||||||
|
|
||||||
Can choose your oid (numeric format only).
|
Can choose your oid (numeric format only).
|
||||||
|
|
||||||
=item B<--check-overload>
|
=item B<--check-overflow>
|
||||||
|
|
||||||
Uptime counter limit is 4294967296 and overflow.
|
Uptime counter limit is 4294967296 and overflow.
|
||||||
With that option, we manage the counter going back. But there is a few chance we can miss a reboot.
|
With that option, we manage the counter going back. But there is a few chance we can miss a reboot.
|
||||||
|
|
|
@ -31,11 +31,11 @@ sub new {
|
||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
%{$self->{modes}} = (
|
%{$self->{modes}} = (
|
||||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
'alarms' => 'network::silverpeak::snmp::mode::alarms',
|
||||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||||
'uptime' => 'network::silverpeak::snmp::mode::uptime',
|
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||||
'status' => 'network::silverpeak::snmp::mode::status',
|
'status' => 'network::silverpeak::snmp::mode::status',
|
||||||
'alarms' => 'network::silverpeak::snmp::mode::alarms',
|
'uptime' => 'network::silverpeak::snmp::mode::uptime',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
|
Loading…
Reference in New Issue