Merge pull request #448 from Sims24/master
[plugin] [digi] add plugin and mode for standard tree
This commit is contained in:
commit
2dd79ecbbe
|
@ -0,0 +1,103 @@
|
||||||
|
#
|
||||||
|
# Copyright 2016 Centreon (http://www.centreon.com/)
|
||||||
|
#
|
||||||
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
|
# the needs in IT infrastructure and application monitoring for
|
||||||
|
# service performance.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
package network::digi::standard::snmp::mode::cpu;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
$options{options}->add_options(arguments =>
|
||||||
|
{
|
||||||
|
"warning:s" => { name => 'warning' },
|
||||||
|
"critical:s" => { name => 'critical' },
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{critical} . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
# $options{snmp} = snmp object
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
|
my $oid_cpuUtil = '.1.3.6.1.4.1.16378.10000.3.1.0';
|
||||||
|
|
||||||
|
$self->{results} = $self->{snmp}->get_leef(oids => [ $oid_cpuUtil ],
|
||||||
|
nothing_quit => 1);
|
||||||
|
|
||||||
|
my $cpu = $self->{results}->{$oid_cpuUtil};
|
||||||
|
|
||||||
|
my $exit = $self->{perfdata}->threshold_check(value => $cpu,
|
||||||
|
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("CPU Usage is %.2f%%", $cpu));
|
||||||
|
$self->{output}->perfdata_add(label => "cpu", unit => '%',
|
||||||
|
value => $cpu,
|
||||||
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
|
min => 0, max => 100);
|
||||||
|
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check cpu usage (sarian-monitor.mib).
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--warning>
|
||||||
|
|
||||||
|
Threshold warning in percent.
|
||||||
|
|
||||||
|
=item B<--critical>
|
||||||
|
|
||||||
|
Threshold critical in percent.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,272 @@
|
||||||
|
#
|
||||||
|
# Copyright 2016 Centreon (http://www.centreon.com/)
|
||||||
|
#
|
||||||
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
|
# the needs in IT infrastructure and application monitoring for
|
||||||
|
# service performance.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
package network::digi::standard::snmp::mode::gprs;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $instance_mode;
|
||||||
|
|
||||||
|
sub custom_status_threshold_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'ok';
|
||||||
|
my $message;
|
||||||
|
|
||||||
|
eval {
|
||||||
|
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||||
|
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||||
|
|
||||||
|
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||||
|
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||||
|
$status = 'critical';
|
||||||
|
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||||
|
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||||
|
$status = 'warning';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (defined($message)) {
|
||||||
|
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_status_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $msg;
|
||||||
|
|
||||||
|
$msg = 'Attachement : ' . $self->{result_values}->{attachement};
|
||||||
|
$msg .= ', Registration : ' . $self->{result_values}->{registered};
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_status_calc {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{result_values}->{registered} = $options{new_datas}->{$self->{instance} . '_registered'};
|
||||||
|
$self->{result_values}->{attachement} = $options{new_datas}->{$self->{instance} . '_attachement'};
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_tech_threshold_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'ok';
|
||||||
|
my $message;
|
||||||
|
|
||||||
|
eval {
|
||||||
|
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||||
|
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||||
|
|
||||||
|
if (defined($instance_mode->{option_results}->{critical_technology}) && $instance_mode->{option_results}->{critical_technology} ne '' &&
|
||||||
|
eval "$instance_mode->{option_results}->{critical_technology}") {
|
||||||
|
$status = 'critical';
|
||||||
|
} elsif (defined($instance_mode->{option_results}->{warning_technology}) && $instance_mode->{option_results}->{warning_technology} ne '' &&
|
||||||
|
eval "$instance_mode->{option_results}->{warning_technology}") {
|
||||||
|
$status = 'warning';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (defined($message)) {
|
||||||
|
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_tech_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $msg;
|
||||||
|
|
||||||
|
$msg = 'Technology : ' . $self->{result_values}->{technology};
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_tech_calc {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{result_values}->{technology} = $options{new_datas}->{$self->{instance} . '_technology'};
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'gprs', type => 0 },
|
||||||
|
];
|
||||||
|
$self->{maps_counters}->{gprs} = [
|
||||||
|
{ label => 'signal', set => {
|
||||||
|
key_values => [ { name => 'signal' } ],
|
||||||
|
output_template => 'Signal : %d dBm',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'signal_strenght', value => 'signal_absolute', template => '%s',
|
||||||
|
unit => 'dBm' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'status', threshold => 0, set => {
|
||||||
|
key_values => [ { name => 'registered' }, { name => 'attachement' } ],
|
||||||
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
|
closure_custom_perfdata => sub { return 0; },
|
||||||
|
closure_custom_threshold_check => $self->can('custom_status_threshold_output'),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'technology', threshold => 0, set => {
|
||||||
|
key_values => [ { name => 'technology' } ],
|
||||||
|
closure_custom_calc => $self->can('custom_tech_calc'),
|
||||||
|
closure_custom_output => $self->can('custom_tech_output'),
|
||||||
|
closure_custom_perfdata => sub { return 0; },
|
||||||
|
closure_custom_threshold_check => $self->can('custom_tech_threshold_output'),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
$options{options}->add_options(arguments =>
|
||||||
|
{
|
||||||
|
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||||
|
"critical-status:s" => { name => 'critical_status', default => '%{attachement} eq "notAttached" or %{registered} !~ /registeredHostNetwork|registeredRoaming/' },
|
||||||
|
"warning-technology:s" => { name => 'warning_technology', default => '' },
|
||||||
|
"critical-technology:s" => { name => 'critical_technology', default => '%{technology} !~ /2G|3G|4G/' },
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::check_options(%options);
|
||||||
|
|
||||||
|
$instance_mode = $self;
|
||||||
|
$self->change_macros();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub change_macros {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
foreach (('warning_status', 'critical_status', 'warning_technology', 'critical_technology' )) {
|
||||||
|
if (defined($self->{option_results}->{$_})) {
|
||||||
|
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my %map_gprs_registration = (
|
||||||
|
0 => 'notRegisteredNotSearching',
|
||||||
|
1 => 'registeredHostNetwork',
|
||||||
|
2 => 'notRegisteredSearching',
|
||||||
|
3 => 'registrationDenied',
|
||||||
|
4 => 'unknown',
|
||||||
|
5 => 'registeredRoaming',
|
||||||
|
6 => 'unrecognised',
|
||||||
|
);
|
||||||
|
|
||||||
|
my %map_gprs_attachement = (
|
||||||
|
0 => 'notAtached',
|
||||||
|
1 => 'attached',
|
||||||
|
);
|
||||||
|
|
||||||
|
my %map_gprs_technology = (
|
||||||
|
1 => 'unknown',
|
||||||
|
2 => 'GPRS(2G)',
|
||||||
|
3 => 'EDGE(2G)',
|
||||||
|
4 => 'UMTS(3G)',
|
||||||
|
5 => 'HSDPA(3G)',
|
||||||
|
6 => 'HSUPA(3G)',
|
||||||
|
7 => 'DC-HSPA+(3G)',
|
||||||
|
8 => 'LTE(4G)',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $oid_gprsSignalStrength = '.1.3.6.1.4.1.16378.10000.2.1.0';
|
||||||
|
my $oid_gprsRegistered = '.1.3.6.1.4.1.16378.10000.2.2.0';
|
||||||
|
my $oid_gprsAttached = '.1.3.6.1.4.1.16378.10000.2.3.0';
|
||||||
|
my $oid_gprsNetworkTechnology = '.1.3.6.1.4.1.16378.10000.2.7.0';
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{gprs} = {};
|
||||||
|
$self->{results} = $options{snmp}->get_leef(oids => [ $oid_gprsSignalStrength, $oid_gprsRegistered,
|
||||||
|
$oid_gprsAttached, $oid_gprsNetworkTechnology ],
|
||||||
|
nothing_quit => 1);
|
||||||
|
|
||||||
|
$self->{gprs} = { signal => $self->{results}->{$oid_gprsSignalStrength},
|
||||||
|
registered => $map_gprs_registration{$self->{results}->{$oid_gprsRegistered}},
|
||||||
|
attachement => $map_gprs_attachement{$self->{results}->{$oid_gprsAttached}},
|
||||||
|
technology => $map_gprs_technology{$self->{results}->{$oid_gprsNetworkTechnology}},
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check AP status.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-counters>
|
||||||
|
|
||||||
|
Only display some counters (regexp can be used).
|
||||||
|
Example: --filter-counters='signal|technology'
|
||||||
|
|
||||||
|
=item B<--warning-status>
|
||||||
|
|
||||||
|
Set warning threshold for status.
|
||||||
|
Can used special variables like: %{registered}, %{attachement}
|
||||||
|
|
||||||
|
=item B<--critical-status>
|
||||||
|
|
||||||
|
Set critical threshold for status (Default: '%{attachement} eq "attached" and %{registered} !~ /registeredHostNetwork|registeredRoaming/'
|
||||||
|
Can used special variables like: %{registered}, %{attachement}
|
||||||
|
|
||||||
|
=item B<--warning-technology>
|
||||||
|
|
||||||
|
Set warning threshold for technology.
|
||||||
|
Use special variables %{technology}.
|
||||||
|
|
||||||
|
=item B<--critical-technology>
|
||||||
|
|
||||||
|
Set critical threshold for technology (Default: '%{technology} !~ /2G|3G|4G/'
|
||||||
|
Use special variables %{technology}.
|
||||||
|
|
||||||
|
=item B<--warning-signal>
|
||||||
|
|
||||||
|
Threshold warning for signal strength.
|
||||||
|
|
||||||
|
=item B<--critical-signal>
|
||||||
|
|
||||||
|
Threshold critical for signal strength.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,111 @@
|
||||||
|
#
|
||||||
|
# Copyright 2016 Centreon (http://www.centreon.com/)
|
||||||
|
#
|
||||||
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
|
# the needs in IT infrastructure and application monitoring for
|
||||||
|
# service performance.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
package network::digi::standard::snmp::mode::memory;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
$options{options}->add_options(arguments =>
|
||||||
|
{
|
||||||
|
"warning:s" => { name => 'warning' },
|
||||||
|
"critical:s" => { name => 'critical' },
|
||||||
|
});
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
# $options{snmp} = snmp object
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
|
my $oid_totalMemory = '.1.3.6.1.4.1.16378.10000.3.17.0'; # in Kbytes
|
||||||
|
my $oid_freeMemory = '.1.3.6.1.4.1.16378.10000.3.18.0'; # in Kbytes
|
||||||
|
|
||||||
|
my $result = $self->{snmp}->get_leef(oids => [$oid_totalMemory, $oid_freeMemory],
|
||||||
|
nothing_quit => 1);
|
||||||
|
my $free = $result->{$oid_freeMemory} * 1024;
|
||||||
|
my $total_size = $result->{$oid_totalMemory} * 1024;
|
||||||
|
my $used = $total_size - $free;
|
||||||
|
|
||||||
|
my $prct_used = $used * 100 / $total_size;
|
||||||
|
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
|
||||||
|
my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $total_size);
|
||||||
|
my ($used_value, $used_unit) = $self->{perfdata}->change_bytes(value => $used);
|
||||||
|
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Ram used %s (%.2f%%), Total: %s",
|
||||||
|
$used_value . " " . $used_unit, $prct_used,
|
||||||
|
$total_value . " " . $total_unit));
|
||||||
|
|
||||||
|
$self->{output}->perfdata_add(label => "used", unit => 'B',
|
||||||
|
value => $used,
|
||||||
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
|
||||||
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),
|
||||||
|
min => 0, max => $total_size);
|
||||||
|
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check memory usage (sarian-monitor.mib).
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--warning>
|
||||||
|
|
||||||
|
Threshold warning in percent.
|
||||||
|
|
||||||
|
=item B<--critical>
|
||||||
|
|
||||||
|
Threshold critical in percent.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,124 @@
|
||||||
|
#
|
||||||
|
# Copyright 2016 Centreon (http://www.centreon.com/)
|
||||||
|
#
|
||||||
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
|
# the needs in IT infrastructure and temperatureplication monitoring for
|
||||||
|
# service performance.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.temperatureache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by temperatureplicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
package network::digi::standard::snmp::mode::temperature;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'temperature', type => 0, skipped_code => { -10 => 1 } },
|
||||||
|
];
|
||||||
|
$self->{maps_counters}->{temperature} = [
|
||||||
|
{ label => 'device', set => {
|
||||||
|
key_values => [ { name => 'device' } ],
|
||||||
|
output_template => 'Temp Device : %d °C',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'tempDevice', value => 'device_absolute', template => '%d',
|
||||||
|
unit => 'C' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'processor', set => {
|
||||||
|
key_values => [ { name => 'processor' } ],
|
||||||
|
output_template => 'Temp Processor : %d °C',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'tempProcessor', value => 'processor_absolute', template => '%d',
|
||||||
|
unit => 'C' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'modem', set => {
|
||||||
|
key_values => [ { name => 'modem' } ],
|
||||||
|
output_template => 'Temp Modem : %d °C',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'tempModem', value => 'modem_absolute', template => '%d',
|
||||||
|
unit => 'C' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
$options{options}->add_options(arguments =>
|
||||||
|
{
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $oid_temperature = '.1.3.6.1.4.1.16378.10000.3.11.0';
|
||||||
|
my $oid_processorTemperature = '.1.3.6.1.4.1.16378.10000.3.12.0';
|
||||||
|
my $oid_modemTemperature = '.1.3.6.1.4.1.16378.10000.3.13.0';
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{snmp} = $options{snmp};
|
||||||
|
|
||||||
|
$self->{temperature} = {};
|
||||||
|
$self->{results} = $self->{snmp}->get_leef(oids => [ $oid_temperature, $oid_processorTemperature, $oid_modemTemperature ],
|
||||||
|
nothing_quit => 1);
|
||||||
|
|
||||||
|
$self->{temperature} = { device => $self->{results}->{$oid_temperature} > -20 ? $self->{results}->{$oid_temperature} : undef,
|
||||||
|
processor => $self->{results}->{$oid_processorTemperature},
|
||||||
|
modem => $self->{results}->{$oid_modemTemperature} };
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check Digi equipment temperature (sarian-monitor.mib)
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-counters>
|
||||||
|
|
||||||
|
Only display some counters (regexp can be used).
|
||||||
|
Example: --filter-counters='processor|modem'
|
||||||
|
|
||||||
|
=item B<--warning-*>
|
||||||
|
|
||||||
|
Threshold warning.
|
||||||
|
Can be: 'device', 'modem', 'processor' (C).
|
||||||
|
|
||||||
|
=item B<--critical-*>
|
||||||
|
|
||||||
|
Threshold critical.
|
||||||
|
Can be: 'device', 'modem', 'processor' (C).
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,53 @@
|
||||||
|
#
|
||||||
|
# Copyright 2016 Centreon (http://www.centreon.com/)
|
||||||
|
#
|
||||||
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
|
# the needs in IT infrastructure and application monitoring for
|
||||||
|
# service performance.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
package network::digi::standard::snmp::plugin;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use base qw(centreon::plugins::script_snmp);
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
%{$self->{modes}} = (
|
||||||
|
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||||
|
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||||
|
'cpu' => 'network::digi::standard::snmp::mode::cpu',
|
||||||
|
'memory' => 'network::digi::standard::snmp::mode::memory',
|
||||||
|
'temperature' => 'network::digi::standard::snmp::mode::temperature',
|
||||||
|
'gprs' => 'network::digi::standard::snmp::mode::gprs',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 PLUGIN DESCRIPTION
|
||||||
|
|
||||||
|
Check DIGI equipement supporting standard sarian-monitor.mib
|
||||||
|
|
||||||
|
=cut
|
Loading…
Reference in New Issue