Add plugin riverbed steelhead

Thanks to afriqs
This commit is contained in:
garnier-quentin 2015-05-08 22:59:12 +02:00
parent 52061bbd7e
commit f5375a5c75
10 changed files with 1279 additions and 0 deletions

View File

@ -0,0 +1,151 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::bwoptimization;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use POSIX;
use centreon::plugins::statefile;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '0.1';
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
$self->{statefile_value}->check_options(%options);
}
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
$self->{hostname} = $self->{snmp}->get_hostname();
$self->{snmp_port} = $self->{snmp}->get_port();
my $oid_bwHCAggInLan = '.1.3.6.1.4.1.17163.1.1.5.6.1.1.0'; # in bytes, 64 bits
my $oid_bwHCAggInWan = '.1.3.6.1.4.1.17163.1.1.5.6.1.2.0'; # in bytes, 64 bits
my $oid_bwHCAggOutLan = '.1.3.6.1.4.1.17163.1.1.5.6.1.3.0'; # in bytes, 64 bits
my $oid_bwHCAggOutWan = '.1.3.6.1.4.1.17163.1.1.5.6.1.4.0'; # in bytes, 64 bits
my ($result, $bw_in_lan, $bw_out_lan, $bw_in_wan, $bw_out_wan);
$result = $self->{snmp}->get_leef(oids => [ $oid_bwHCAggInLan, $oid_bwHCAggInWan, $oid_bwHCAggOutLan, $oid_bwHCAggOutWan ], nothing_quit => 1);
$bw_in_lan = $result->{$oid_bwHCAggInLan};
$bw_in_wan = $result->{$oid_bwHCAggInWan};
$bw_out_lan = $result->{$oid_bwHCAggOutLan};
$bw_out_wan = $result->{$oid_bwHCAggOutWan};
$self->{statefile_value}->read(statefile => 'steelhead_' . $self->{hostname} . '_' . $self->{snmp_port} . '_' . $self->{mode});
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
my $old_bwHCAggInLan = $self->{statefile_value}->get(name => 'bwHCAggInLan');
my $old_bwHCAggInWan = $self->{statefile_value}->get(name => 'bwHCAggInWan');
my $old_bwHCAggOutLan = $self->{statefile_value}->get(name => 'bwHCAggOutLan');
my $old_bwHCAggOutWan = $self->{statefile_value}->get(name => 'bwHCAggOutWan');
my $new_datas = {};
$new_datas->{last_timestamp} = time();
$new_datas->{bwHCAggInLan} = $bw_in_lan;
$new_datas->{bwHCAggInWan} = $bw_in_wan;
$new_datas->{bwHCAggOutLan} = $bw_out_lan;
$new_datas->{bwHCAggOutWan} = $bw_out_wan;
$self->{statefile_value}->write(data => $new_datas);
if (!defined($old_timestamp) || !defined($old_bwHCAggInLan) || !defined($old_bwHCAggInWan) || !defined($old_bwHCAggOutLan) || !defined($old_bwHCAggOutWan)) {
$self->{output}->output_add(severity => 'OK',
short_msg => "Buffer creation...");
$self->{output}->display();
$self->{output}->exit();
}
$old_bwHCAggInLan = 0 if ($old_bwHCAggInLan > $new_datas->{bwHCAggInLan});
$old_bwHCAggInWan = 0 if ($old_bwHCAggInWan > $new_datas->{bwHCAggInWan});
$old_bwHCAggOutLan = 0 if ($old_bwHCAggOutLan > $new_datas->{bwHCAggOutLan});
$old_bwHCAggOutWan = 0 if ($old_bwHCAggOutWan > $new_datas->{bwHCAggOutWan});
my $delta_time = $new_datas->{last_timestamp} - $old_timestamp;
$delta_time = 1 if ($delta_time == 0);
my $bwHCAggInLanPerSec = int(($new_datas->{bwHCAggInLan} - $old_bwHCAggInLan) / $delta_time);
my $bwHCAggInWanPerSec = int(($new_datas->{bwHCAggInWan} - $old_bwHCAggInWan) / $delta_time);
my $bwHCAggOutLanPerSec = int(($new_datas->{bwHCAggOutLan} - $old_bwHCAggOutLan) / $delta_time);
my $bwHCAggOutWanPerSec = int(($new_datas->{bwHCAggOutWan} - $old_bwHCAggOutWan) / $delta_time);
$self->{output}->perfdata_add(label => 'wan2lan_lan',
value => $bwHCAggInLanPerSec,
min => 0);
$self->{output}->perfdata_add(label => 'wan2lan_wan',
value => $bwHCAggInWanPerSec,
min => 0);
$self->{output}->perfdata_add(label => 'lan2wan_lan',
value => $bwHCAggOutLanPerSec,
min => 0);
$self->{output}->perfdata_add(label => 'lan2wan_wan',
value => $bwHCAggOutWanPerSec,
min => 0);
$self->{output}->output_add(severity => 'OK',
short_msg => sprintf("Optimized: Wan2Lan on Lan - %s bytes/sec, Wan2Lan on Wan - %s bytes/sec, Lan2Wan on Lan - %s bytes/sec, Lan2Wan on Wan - %s bytes/sec.",
$bwHCAggInLanPerSec, $bwHCAggInWanPerSec, $bwHCAggOutLanPerSec, $bwHCAggOutWanPerSec));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Total optimized bytes across all application ports in both directions and on both sides, in bytes per second (STEELHEAD-MIB).
=over 8
=back
=cut

View File

@ -0,0 +1,184 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::bwpassthrough;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use POSIX;
use centreon::plugins::statefile;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '0.1';
$options{options}->add_options(arguments =>
{
"warning-in:s" => { name => 'warning_in', },
"critical-in:s" => { name => 'critical_in', },
"warning-out:s" => { name => 'warning_out', },
"critical-out:s" => { name => 'critical_out', },
});
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning_in', value => $self->{option_results}->{warning_in})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold for Wan2Lan'" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical_in', value => $self->{option_results}->{critical_in})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold for Wan2Lan'" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warning_out', value => $self->{option_results}->{warning_in})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold for Wan2Lan'" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical_in', value => $self->{option_results}->{critical_in})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold for Wan2Lan'" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{statefile_value}->check_options(%options);
}
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
$self->{hostname} = $self->{snmp}->get_hostname();
$self->{snmp_port} = $self->{snmp}->get_port();
my $oid_bwPassThroughIn = '.1.3.6.1.4.1.17163.1.1.5.3.3.1.0';
my $oid_bwPassThroughOut = '.1.3.6.1.4.1.17163.1.1.5.3.3.2.0';
my ($result, $bw_inn, $bw_out);
$result = $self->{snmp}->get_leef(oids => [ $oid_bwPassThroughIn, $oid_bwPassThroughOut ], nothing_quit => 1);
$bw_inn = $result->{$oid_bwPassThroughIn};
$bw_out = $result->{$oid_bwPassThroughOut};
$self->{statefile_value}->read(statefile => 'steelhead_' . $self->{hostname} . '_' . $self->{snmp_port} . '_' . $self->{mode});
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
my $old_bwPassThroughIn = $self->{statefile_value}->get(name => 'bwPassThroughIn');
my $old_bwPassThroughOut = $self->{statefile_value}->get(name => 'bwPassThroughOut');
my $new_datas = {};
$new_datas->{last_timestamp} = time();
$new_datas->{bwPassThroughIn} = $bw_inn;
$new_datas->{bwPassThroughOut} = $bw_out;
$self->{statefile_value}->write(data => $new_datas);
if (!defined($old_timestamp) || !defined($old_bwPassThroughIn) || !defined($old_bwPassThroughOut)) {
$self->{output}->output_add(severity => 'OK',
short_msg => "Buffer creation...");
$self->{output}->display();
$self->{output}->exit();
}
$old_bwPassThroughIn = 0 if ($old_bwPassThroughIn > $new_datas->{bwPassThroughIn});
$old_bwPassThroughOut = 0 if ($old_bwPassThroughOut > $new_datas->{bwPassThroughOut});
my $delta_time = $new_datas->{last_timestamp} - $old_timestamp;
$delta_time = 1 if ($delta_time == 0);
my $bwPassThroughInPerSec = int(($new_datas->{bwPassThroughIn} - $old_bwPassThroughIn) / $delta_time);
my $bwPassThroughOutPerSec = int(($new_datas->{bwPassThroughOut} - $old_bwPassThroughOut) / $delta_time);
my $exit1 = $self->{perfdata}->threshold_check(value => $bwPassThroughInPerSec,
threshold => [ { label => 'critical_in', exit_litteral => 'critical' }, { label => 'warning_in', exit_litteral => 'warning' } ]);
my $exit2 = $self->{perfdata}->threshold_check(value => $bwPassThroughOutPerSec,
threshold => [ { label => 'critical_out', exit_litteral => 'critical' }, { label => 'warning_out', exit_litteral => 'warning' } ]);
my $exit_code = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]);
$self->{output}->perfdata_add(label => 'Traffic_In',
value => $bwPassThroughInPerSec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_in'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_in'),
min => 0);
$self->{output}->perfdata_add(label => 'Traffic_Out',
value => $bwPassThroughOutPerSec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_out'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_out'),
min => 0);
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("Passthrough: Wan2Lan - %s bytes/sec, Lan2Wan - %s bytes/sec.",
$bwPassThroughInPerSec, $bwPassThroughOutPerSec));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check passthrough bandwidth in both directions (STEELHEAD-MIB).
=over 8
=item B<--warning-in>
Threshold warning for Wan2Lan passthrough in bytes per second.
=item B<--critical-in>
Threshold critical for Wan2Lan passthrough in bytes per second.
=item B<--warning-out>
Threshold warning for Lan2Wan passthrough in bytes per second.
=item B<--critical-out>
Threshold critical for Lan2Wan passthrough in bytes per second.
=back
=cut

View File

@ -0,0 +1,155 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::connections;
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} = '0.1';
$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_optimizedConnections = '.1.3.6.1.4.1.17163.1.1.5.2.1.0';
my $oid_passthroughConnections = '.1.3.6.1.4.1.17163.1.1.5.2.2.0';
my $oid_halfOpenedConnections = '.1.3.6.1.4.1.17163.1.1.5.2.3.0';
my $oid_halfClosedConnections = '.1.3.6.1.4.1.17163.1.1.5.2.4.0';
my $oid_establishedConnections = '.1.3.6.1.4.1.17163.1.1.5.2.5.0';
my $oid_activeConnections = '.1.3.6.1.4.1.17163.1.1.5.2.6.0';
my $oid_totalConnections = '.1.3.6.1.4.1.17163.1.1.5.2.7.0';
my $result = $self->{snmp}->get_leef(oids => [$oid_optimizedConnections, $oid_passthroughConnections, $oid_halfOpenedConnections, $oid_halfClosedConnections,
$oid_establishedConnections, $oid_activeConnections, $oid_totalConnections, ], nothing_quit => 1);
my $optimized = $result->{$oid_optimizedConnections};
my $passthrough = $result->{$oid_passthroughConnections};
my $halfOpened = $result->{$oid_halfOpenedConnections};
my $halfClosed = $result->{$oid_halfClosedConnections};
my $established = $result->{$oid_establishedConnections};
my $active = $result->{$oid_activeConnections};
my $total = $result->{$oid_totalConnections};
my $exit = $self->{perfdata}->threshold_check(value => $total, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Connections: total %d, established %d, active %d, optimized %d, passthrough %d, half opened %d, half closed %d ",
$total, $established, $active, $optimized, $passthrough, $halfOpened, $halfClosed));
$self->{output}->perfdata_add(label => "total",
value => $total,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0
);
$self->{output}->perfdata_add(label => "established",
value => $established,
min => 0
);
$self->{output}->perfdata_add(label => "active",
value => $active,
min => 0
);
$self->{output}->perfdata_add(label => "optimized",
value => $optimized,
min => 0
);
$self->{output}->perfdata_add(label => "passthrough",
value => $passthrough,
min => 0
);
$self->{output}->perfdata_add(label => "half opened",
value => $halfOpened,
min => 0
);
$self->{output}->perfdata_add(label => "half closed",
value => $halfClosed,
min => 0
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Current connections: total, established, active, optimized, passthrough, half opened and half closed ones (STEELHEAD-MIB).
=over 8
=item B<--warning>
Threshold warning for total connections.
=item B<--critical>
Threshold critical for total connections.
=back
=cut

View File

@ -0,0 +1,117 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::diskutilization;
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} = '0.1';
$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_dsAveDiskUtilization = '.1.3.6.1.4.1.17163.1.1.5.4.4.0'; # in %
my $result = $self->{snmp}->get_leef(oids => [$oid_dsAveDiskUtilization], nothing_quit => 1);
my $disk_usage = $result->{$oid_dsAveDiskUtilization};
my $exit = $self->{perfdata}->threshold_check(value => $disk_usage, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Datastore usage: %d %%",
$disk_usage));
$self->{output}->perfdata_add(label => "used", unit => '%',
value => $disk_usage,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Average disk utilization, a more accurate measurement of the underlying disk activities, and correlates directly to disk pressure (STEELHEAD-MIB).
=over 8
=item B<--warning>
Threshold warning in %.
=item B<--critical>
Threshold critical in %.
=back
=cut

View File

@ -0,0 +1,94 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::health;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
my %states = (
10000 => ['healthy', 'OK'],
30000 => ['degraded', 'WARNING'],
31000 => ['admissionControl', 'WARNING'],
50000 => ['critical', 'CRITICAL']
);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
my $oid_systemHealth = '.1.3.6.1.4.1.17163.1.1.2.7.0';
my $result = $self->{snmp}->get_leef(oids => [ $oid_systemHealth ], nothing_quit => 1);
$self->{output}->output_add(severity => ${$states{$result->{$oid_systemHealth}}}[1],
short_msg => sprintf("System health is '%s'",
${$states{$result->{$oid_systemHealth}}}[0]));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check the current health of the system. The value is one amongst Healthy, Admission Control, Degraded or Critical (STEELHEAD-MIB).
=over 8
=back
=cut

View File

@ -0,0 +1,161 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::loadaverage;
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', default => '' },
"critical:s" => { name => 'critical', default => '' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
($self->{warn1}, $self->{warn5}, $self->{warn15}) = split /,/, $self->{option_results}->{warning};
($self->{crit1}, $self->{crit5}, $self->{crit15}) = split /,/, $self->{option_results}->{critical};
if (($self->{perfdata}->threshold_validate(label => 'warn1', value => $self->{warn1})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning (1min) threshold '" . $self->{warn1} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn5', value => $self->{warn5})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning (5min) threshold '" . $self->{warn5} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn15', value => $self->{warn15})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning (15min) threshold '" . $self->{warn15} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit1', value => $self->{crit1})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical (1min) threshold '" . $self->{crit1} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit5', value => $self->{crit5})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical (5min) threshold '" . $self->{crit5} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit15', value => $self->{crit15})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical (15min) threshold '" . $self->{crit15} . "'.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
my $oid_cpuLoad1 = '.1.3.6.1.4.1.17163.1.1.5.1.1.0';
my $oid_cpuLoad5 = '.1.3.6.1.4.1.17163.1.1.5.1.2.0';
my $oid_cpuLoad15 = '.1.3.6.1.4.1.17163.1.1.5.1.3.0';
my $result = $self->{snmp}->get_leef(oids => [$oid_cpuLoad1, $oid_cpuLoad5, $oid_cpuLoad15], nothing_quit => 1);
my $cpu_load1 = $result->{$oid_cpuLoad1};
my $cpu_load5 = $result->{$oid_cpuLoad5};
my $cpu_load15 = $result->{$oid_cpuLoad15};
my $msg = sprintf("Load averages: %s %% (1min), %s %% (5min), %s %% (15min)", $cpu_load1, $cpu_load5, $cpu_load15);
$self->{output}->perfdata_add(label => 'load1',
value => $cpu_load1,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1'),
min => 0,
max => 100);
$self->{output}->perfdata_add(label => 'load5',
value => $cpu_load5,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5'),
min => 0,
max => 100);
$self->{output}->perfdata_add(label => 'load15',
value => $cpu_load15,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn15'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit15'),
min => 0,
max => 100);
my $exit1 = $self->{perfdata}->threshold_check(value => $cpu_load1,
threshold => [ { label => 'crit1', exit_litteral => 'critical' }, { label => 'warn1', exit_litteral => 'warning' } ]);
my $exit2 = $self->{perfdata}->threshold_check(value => $cpu_load5,
threshold => [ { label => 'crit5', exit_litteral => 'critical' }, { label => 'warn5', exit_litteral => 'warning' } ]);
my $exit3 = $self->{perfdata}->threshold_check(value => $cpu_load15,
threshold => [ { label => 'crit15', exit_litteral => 'critical' }, { label => 'warn15', exit_litteral => 'warning' } ]);
my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2, $exit3 ]);
$self->{output}->output_add(severity => $exit,
short_msg => $msg);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check system load-average.
=over 8
=item B<--warning>
Threshold warning (1min,5min,15min).
=item B<--critical>
Threshold critical (1min,5min,15min).
=back
=cut

View File

@ -0,0 +1,99 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::servicestatus;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
my %states = (
0 => ['none', 'CRITICAL'],
1 => ['unmanaged', 'CRITICAL'],
2 => ['running', 'OK'],
3 => ['sentCom1', 'CRITICAL'],
4 => ['sentTerm1', 'CRITICAL'],
5 => ['sentTerm2', 'CRITICAL'],
6 => ['sentTerm3', 'CRITICAL'],
7 => ['pending', 'CRITICAL'],
8 => ['stopped', 'CRITICAL'],
);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '0.1';
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
my $oid_optServiceStatus = '.1.3.6.1.4.1.17163.1.1.2.8.0';
my $result = $self->{snmp}->get_leef(oids => [ $oid_optServiceStatus ], nothing_quit => 1);
$self->{output}->output_add(severity => ${$states{$result->{$oid_optServiceStatus}}}[1],
short_msg => sprintf("Optimization service status is '%s'",
${$states{$result->{$oid_optServiceStatus}}}[0]));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check the current status of the optimization service (STEELHEAD-MIB).
=over 8
=back
=cut

View File

@ -0,0 +1,125 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::serviceuptime;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use POSIX;
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', },
"seconds" => { name => 'seconds', }
});
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_serviceUptime = '.1.3.6.1.4.1.17163.1.1.2.4.0';
my ($result, $value);
$result = $self->{snmp}->get_leef(oids => [ $oid_serviceUptime ], nothing_quit => 1);
$value = $result->{$oid_serviceUptime};
my $exit_code = $self->{perfdata}->threshold_check(value => floor($value / 100),
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->perfdata_add(label => 'uptime',
value => floor($value / 100),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0);
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("Service uptime is: %s",
defined($self->{option_results}->{seconds}) ? floor($value / 100) . " seconds" : floor($value / 86400 / 100) . " days" ));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Uptime of the optimization service (STEELHEAD-MIB).
=over 8
=item B<--warning>
Threshold warning in seconds.
=item B<--critical>
Threshold critical in seconds.
=item B<--seconds>
Display uptime in seconds.
=back
=cut

View File

@ -0,0 +1,117 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::snmp::mode::temperature;
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_systemTemperature = '.1.3.6.1.4.1.17163.1.1.2.9.0'; # in Celsius
my $result = $self->{snmp}->get_leef(oids => [$oid_systemTemperature], nothing_quit => 1);
my $temp = $result->{$oid_systemTemperature};
my $exit = $self->{perfdata}->threshold_check(value => $temp, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Device Temperature is %d C degrees",
$temp));
$self->{output}->perfdata_add(label => "temperature", unit => 'C',
value => $temp,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check the temperature of the system in Celcius (STEELHEAD-MIB).
=over 8
=item B<--warning>
Threshold warning for temperature in Celsius.
=item B<--critical>
Threshold critical for temperature in Celsius.
=back
=cut

View File

@ -0,0 +1,76 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Alexandre Friquet <centreon@infopiiaf.fr>
#
####################################################################################
package network::riverbed::steelhead::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;
# $options->{options} = options object
# Plugin version
$self->{version} = '0.1';
# Modes association
%{$self->{modes}} = (
'temperature' => 'network::riverbed::steelhead::snmp::mode::temperature',
'service-uptime' => 'network::riverbed::steelhead::snmp::mode::serviceuptime',
'health' => 'network::riverbed::steelhead::snmp::mode::health',
'service-status' => 'network::riverbed::steelhead::snmp::mode::servicestatus',
'load-average' => 'network::riverbed::steelhead::snmp::mode::loadaverage',
'bandwidth-passthrough' => 'network::riverbed::steelhead::snmp::mode::bwpassthrough',
'bandwidth-optimization' => 'network::riverbed::steelhead::snmp::mode::bwoptimization',
'disk-utilization' => 'network::riverbed::steelhead::snmp::mode::diskutilization',
'connections' => 'network::riverbed::steelhead::snmp::mode::connections',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Riverbed SteelHead WAN optimizer using SNMP.
=cut