diff --git a/centreon-plugins/network/juniper/common/ive/mode/cpu.pm b/centreon-plugins/network/juniper/common/ive/mode/cpu.pm new file mode 100644 index 000000000..f62cd5fdf --- /dev/null +++ b/centreon-plugins/network/juniper/common/ive/mode/cpu.pm @@ -0,0 +1,115 @@ +################################################################################ +# 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 . +# +# 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 : Quentin Garnier +# +#################################################################################### + +package network::juniper::common::ive::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 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_iveCpuUtil = '.1.3.6.1.4.1.12532.10.0'; + + my $result = $self->{snmp}->get_leef(oids => [$oid_iveCpuUtil], nothing_quit => 1); + my $exit_code = $self->{perfdata}->threshold_check(value => $result->{$oid_iveCpuUtil}, + threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); + $self->{output}->output_add(severity => $exit_code, + short_msg => sprintf("CPU Usage is %.2f%%", + $result->{$oid_iveCpuUtil})); + $self->{output}->perfdata_add(label => 'cpu', unit => '%', + value => sprintf("%.2f", $result->{$oid_iveCpuUtil}), + 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 Utilization of the IVE system (JUNIPER-IVE-MIB). + +=over 8 + +=item B<--warning> + +Threshold warning in percent. + +=item B<--critical> + +Threshold critical in percent. + +=back + +=cut diff --git a/centreon-plugins/network/juniper/common/ive/mode/disk.pm b/centreon-plugins/network/juniper/common/ive/mode/disk.pm new file mode 100644 index 000000000..a320185c7 --- /dev/null +++ b/centreon-plugins/network/juniper/common/ive/mode/disk.pm @@ -0,0 +1,115 @@ +################################################################################ +# 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 . +# +# 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 : Quentin Garnier +# +#################################################################################### + +package network::juniper::common::ive::mode::disk; + +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_diskFullPercent = '.1.3.6.1.4.1.12532.25.0'; + + my $result = $self->{snmp}->get_leef(oids => [$oid_diskFullPercent], nothing_quit => 1); + my $exit_code = $self->{perfdata}->threshold_check(value => $result->{$oid_diskFullPercent}, + threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); + $self->{output}->output_add(severity => $exit_code, + short_msg => sprintf("Disk Usage is %.2f%%", + $result->{$oid_diskFullPercent})); + $self->{output}->perfdata_add(label => 'used', unit => '%', + value => sprintf("%.2f", $result->{$oid_diskFullPercent}), + 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 disk usage (JUNIPER-IVE-MIB). + +=over 8 + +=item B<--warning> + +Threshold warning in percent. + +=item B<--critical> + +Threshold critical in percent. + +=back + +=cut diff --git a/centreon-plugins/network/juniper/common/ive/mode/logfile.pm b/centreon-plugins/network/juniper/common/ive/mode/logfile.pm new file mode 100644 index 000000000..c03e0932c --- /dev/null +++ b/centreon-plugins/network/juniper/common/ive/mode/logfile.pm @@ -0,0 +1,115 @@ +################################################################################ +# 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 . +# +# 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 : Quentin Garnier +# +#################################################################################### + +package network::juniper::common::ive::mode::logfile; + +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_logFullPercent = '.1.3.6.1.4.1.12532.1.0'; + + my $result = $self->{snmp}->get_leef(oids => [$oid_logFullPercent], nothing_quit => 1); + my $exit_code = $self->{perfdata}->threshold_check(value => $result->{$oid_logFullPercent}, + threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); + $self->{output}->output_add(severity => $exit_code, + short_msg => sprintf("Log File Usage is %.2f%%", + $result->{$oid_logFullPercent})); + $self->{output}->perfdata_add(label => 'used', unit => '%', + value => sprintf("%.2f", $result->{$oid_logFullPercent}), + 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 log file usage (JUNIPER-IVE-MIB). + +=over 8 + +=item B<--warning> + +Threshold warning in percent. + +=item B<--critical> + +Threshold critical in percent. + +=back + +=cut diff --git a/centreon-plugins/network/juniper/common/ive/mode/users.pm b/centreon-plugins/network/juniper/common/ive/mode/users.pm new file mode 100644 index 000000000..9b13c2d60 --- /dev/null +++ b/centreon-plugins/network/juniper/common/ive/mode/users.pm @@ -0,0 +1,206 @@ +################################################################################ +# 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 . +# +# 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 : Quentin Garnier +# +#################################################################################### + +package network::juniper::common::ive::mode::users; + +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-web:s" => { name => 'warning_web' }, + "critical-web:s" => { name => 'critical_web' }, + "warning-meeting:s" => { name => 'warning_meeting' }, + "critical-meeting:s" => { name => 'critical_meeting' }, + "warning-node:s" => { name => 'warning_node' }, + "critical-node:s" => { name => 'critical_node' }, + "warning-cluster:s" => { name => 'warning_cluster' }, + "critical-cluster:s" => { name => 'critical_cluster' }, + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); + + if (($self->{perfdata}->threshold_validate(label => 'warning_web', value => $self->{option_results}->{warning_web})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong warning web threshold '" . $self->{option_results}->{warning_web} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'critical_web', value => $self->{option_results}->{critical_web})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong critical web threshold '" . $self->{option_results}->{critical_web} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'warning_meeting', value => $self->{option_results}->{warning_meeting})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong warning meeting threshold '" . $self->{option_results}->{warning_meeting} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'critical_meeting', value => $self->{option_results}->{critical_meeting})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong critical meeting threshold '" . $self->{option_results}->{critical_meeting} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'warning_node', value => $self->{option_results}->{warning_node})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong warning node threshold '" . $self->{option_results}->{warning_node} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'critical_node', value => $self->{option_results}->{critical_node})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong critical node threshold '" . $self->{option_results}->{critical_node} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'warning_cluster', value => $self->{option_results}->{warning_cluster})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong warning cluster threshold '" . $self->{option_results}->{warning_cluster} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'critical_cluster', value => $self->{option_results}->{critical_cluster})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong critical cluster threshold '" . $self->{option_results}->{critical_cluster} . "'."); + $self->{output}->option_exit(); + } +} + +sub run { + my ($self, %options) = @_; + # $options{snmp} = snmp object + $self->{snmp} = $options{snmp}; + + my $oid_signedInWebUsers = '.1.3.6.1.4.1.12532.2.0'; + my $oid_meetingUserCount = '.1.3.6.1.4.1.12532.9.0'; + my $oid_iveConcurrentUsers = '.1.3.6.1.4.1.12532.12.0'; + my $oid_clusterConcurrentUsers = '.1.3.6.1.4.1.12532.13.0'; + my $result = $self->{snmp}->get_leef(oids => [$oid_signedInWebUsers, $oid_meetingUserCount, + $oid_iveConcurrentUsers, $oid_clusterConcurrentUsers], nothing_quit => 1); + + my $exit1 = $self->{perfdata}->threshold_check(value => $result->{$oid_signedInWebUsers}, + threshold => [ { label => 'critical_web', 'exit_litteral' => 'critical' }, { label => 'warning_web', exit_litteral => 'warning' } ]); + my $exit2 = $self->{perfdata}->threshold_check(value => $result->{$oid_meetingUserCount}, + threshold => [ { label => 'critical_meeting', 'exit_litteral' => 'critical' }, { label => 'warning_meeting', exit_litteral => 'warning' } ]); + my $exit3 = $self->{perfdata}->threshold_check(value => $result->{$oid_iveConcurrentUsers}, + threshold => [ { label => 'critical_node', 'exit_litteral' => 'critical' }, { label => 'warning_node', exit_litteral => 'warning' } ]); + my $exit4 = $self->{perfdata}->threshold_check(value => $result->{$oid_clusterConcurrentUsers}, + threshold => [ { label => 'critical_cluster', 'exit_litteral' => 'critical' }, { label => 'warning_cluster', exit_litteral => 'warning' } ]); + + $self->{output}->output_add(severity => $exit1, + short_msg => sprintf("Current concurrent signed-in web users connections: %d, ", + $result->{$oid_signedInWebUsers})); + $self->{output}->output_add(severity => $exit2, + short_msg => sprintf("Current concurrent meeting users connections: %d, ", + $result->{$oid_meetingUserCount})); + $self->{output}->output_add(severity => $exit3, + short_msg => sprintf("Current concurrent node logged users connections: %d, ", + $result->{$oid_iveConcurrentUsers})); + $self->{output}->output_add(severity => $exit4, + short_msg => sprintf("Current concurrent cluster logged users connections: %d, ", + $result->{$oid_clusterConcurrentUsers})); + + $self->{output}->perfdata_add(label => "web", + value => $result->{$oid_signedInWebUsers}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_web'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_web'), + min => 0); + $self->{output}->perfdata_add(label => "meeting", + value => $result->{$oid_meetingUserCount}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_meeting'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_meeting'), + min => 0); + $self->{output}->perfdata_add(label => "node", + value => $result->{$oid_iveConcurrentUsers}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_node'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_node'), + min => 0); + $self->{output}->perfdata_add(label => "cluster", + value => $result->{$oid_clusterConcurrentUsers}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_cluster'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_cluster'), + min => 0); + + $self->{output}->display(); + $self->{output}->exit(); +} + +1; + +__END__ + +=head1 MODE + +Check users connections (web users, cluster users, node users, meeting users) (JUNIPER-IVE-MIB). + +=over 8 + +=item B<--warning-web> + +Threshold warning for users connected and uses the web feature. + +=item B<--critical-web> + +Threshold critical for users connected and uses the web feature. + +=item B<--warning-meeting> + +Threshold warning for secure meeting users connected. + +=item B<--critical-meeting> + +Threshold critical for secure meeting users connected. + +=item B<--warning-node> + +Threshold warning for users in this node that are logged in. + +=item B<--critical-node> + +Threshold critical for users in this node that are logged in. + +=item B<--warning-cluster> + +Threshold warning for users in this cluster that are logged in. + +=item B<--critical-cluster> + +Threshold critical for users in this cluster that are logged in. + +=back + +=cut + \ No newline at end of file diff --git a/centreon-plugins/network/juniper/common/mode/cpsessions.pm b/centreon-plugins/network/juniper/common/junos/mode/cpsessions.pm similarity index 98% rename from centreon-plugins/network/juniper/common/mode/cpsessions.pm rename to centreon-plugins/network/juniper/common/junos/mode/cpsessions.pm index 98a71a6f7..4b613672e 100644 --- a/centreon-plugins/network/juniper/common/mode/cpsessions.pm +++ b/centreon-plugins/network/juniper/common/junos/mode/cpsessions.pm @@ -33,7 +33,7 @@ # #################################################################################### -package network::juniper::common::mode::cpsessions; +package network::juniper::common::junos::mode::cpsessions; use base qw(centreon::plugins::mode); diff --git a/centreon-plugins/network/juniper/common/mode/cpuforwarding.pm b/centreon-plugins/network/juniper/common/junos/mode/cpuforwarding.pm similarity index 98% rename from centreon-plugins/network/juniper/common/mode/cpuforwarding.pm rename to centreon-plugins/network/juniper/common/junos/mode/cpuforwarding.pm index 45880e833..9ec490501 100644 --- a/centreon-plugins/network/juniper/common/mode/cpuforwarding.pm +++ b/centreon-plugins/network/juniper/common/junos/mode/cpuforwarding.pm @@ -33,7 +33,7 @@ # #################################################################################### -package network::juniper::common::mode::cpuforwarding; +package network::juniper::common::junos::mode::cpuforwarding; use base qw(centreon::plugins::mode); diff --git a/centreon-plugins/network/juniper/common/mode/cpurouting.pm b/centreon-plugins/network/juniper/common/junos/mode/cpurouting.pm similarity index 99% rename from centreon-plugins/network/juniper/common/mode/cpurouting.pm rename to centreon-plugins/network/juniper/common/junos/mode/cpurouting.pm index c5e104280..e0f9a84a6 100644 --- a/centreon-plugins/network/juniper/common/mode/cpurouting.pm +++ b/centreon-plugins/network/juniper/common/junos/mode/cpurouting.pm @@ -33,7 +33,7 @@ # #################################################################################### -package network::juniper::common::mode::cpurouting; +package network::juniper::common::junos::mode::cpurouting; use base qw(centreon::plugins::mode); diff --git a/centreon-plugins/network/juniper/common/mode/flowsessions.pm b/centreon-plugins/network/juniper/common/junos/mode/flowsessions.pm similarity index 98% rename from centreon-plugins/network/juniper/common/mode/flowsessions.pm rename to centreon-plugins/network/juniper/common/junos/mode/flowsessions.pm index a93af914f..223bde9eb 100644 --- a/centreon-plugins/network/juniper/common/mode/flowsessions.pm +++ b/centreon-plugins/network/juniper/common/junos/mode/flowsessions.pm @@ -33,7 +33,7 @@ # #################################################################################### -package network::juniper::common::mode::flowsessions; +package network::juniper::common::junos::mode::flowsessions; use base qw(centreon::plugins::mode); diff --git a/centreon-plugins/network/juniper/common/mode/hardware.pm b/centreon-plugins/network/juniper/common/junos/mode/hardware.pm similarity index 99% rename from centreon-plugins/network/juniper/common/mode/hardware.pm rename to centreon-plugins/network/juniper/common/junos/mode/hardware.pm index c52573130..24e45babe 100644 --- a/centreon-plugins/network/juniper/common/mode/hardware.pm +++ b/centreon-plugins/network/juniper/common/junos/mode/hardware.pm @@ -33,7 +33,7 @@ # #################################################################################### -package network::juniper::common::mode::hardware; +package network::juniper::common::junos::mode::hardware; use base qw(centreon::plugins::mode); diff --git a/centreon-plugins/network/juniper/common/mode/memoryforwarding.pm b/centreon-plugins/network/juniper/common/junos/mode/memoryforwarding.pm similarity index 98% rename from centreon-plugins/network/juniper/common/mode/memoryforwarding.pm rename to centreon-plugins/network/juniper/common/junos/mode/memoryforwarding.pm index eb0c0c159..49c1837fc 100644 --- a/centreon-plugins/network/juniper/common/mode/memoryforwarding.pm +++ b/centreon-plugins/network/juniper/common/junos/mode/memoryforwarding.pm @@ -33,7 +33,7 @@ # #################################################################################### -package network::juniper::common::mode::memoryforwarding; +package network::juniper::common::junos::mode::memoryforwarding; use base qw(centreon::plugins::mode); diff --git a/centreon-plugins/network/juniper/common/mode/memoryrouting.pm b/centreon-plugins/network/juniper/common/junos/mode/memoryrouting.pm similarity index 99% rename from centreon-plugins/network/juniper/common/mode/memoryrouting.pm rename to centreon-plugins/network/juniper/common/junos/mode/memoryrouting.pm index 4dd0564c9..7c84da4a4 100644 --- a/centreon-plugins/network/juniper/common/mode/memoryrouting.pm +++ b/centreon-plugins/network/juniper/common/junos/mode/memoryrouting.pm @@ -33,7 +33,7 @@ # #################################################################################### -package network::juniper::common::mode::memoryrouting; +package network::juniper::common::junos::mode::memoryrouting; use base qw(centreon::plugins::mode); diff --git a/centreon-plugins/network/juniper/mag/mode/bladetemperature.pm b/centreon-plugins/network/juniper/mag/mode/bladetemperature.pm new file mode 100644 index 000000000..43db83050 --- /dev/null +++ b/centreon-plugins/network/juniper/mag/mode/bladetemperature.pm @@ -0,0 +1,114 @@ +################################################################################ +# 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 . +# +# 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 : Quentin Garnier +# +#################################################################################### + +package network::juniper::mag::plugin::mode::bladetemperature; + +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_iveTemperature = '.1.3.6.1.4.1.12532.42.0'; + + my $result = $self->{snmp}->get_leef(oids => [$oid_iveTemperature], nothing_quit => 1); + my $exit_code = $self->{perfdata}->threshold_check(value => $result->{$oid_iveTemperature}, + threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); + $self->{output}->output_add(severity => $exit_code, + short_msg => sprintf("Blade Temperautre is %.2f%% C", + $result->{$oid_iveTemperature})); + $self->{output}->perfdata_add(label => 'temperature', unit => 'C', + value => sprintf("%.2f", $result->{$oid_iveTemperature}), + 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 temperature of MAG application blade (JUNIPER-IVE-MIB). + +=over 8 + +=item B<--warning> + +Threshold warning in degree celsius. + +=item B<--critical> + +Threshold critical in degree celsius. + +=back + +=cut diff --git a/centreon-plugins/network/juniper/mag/plugin.pm b/centreon-plugins/network/juniper/mag/plugin.pm new file mode 100644 index 000000000..7cfc36942 --- /dev/null +++ b/centreon-plugins/network/juniper/mag/plugin.pm @@ -0,0 +1,70 @@ +################################################################################ +# 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 . +# +# 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 : Quentin Garnier +# +#################################################################################### + +package network::juniper::mag::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 + + $self->{version} = '1.0'; + %{$self->{modes}} = ( + 'cpu' => 'network::juniper::common::ive::mode::cpu', + 'disk' => 'network::juniper::common::ive::mode::disk', + 'logfile' => 'network::juniper::common::ive::mode::logfile', + 'users' => 'network::juniper::common::ive::mode::users', + 'memory' => 'snmp_standard::mode::memory', + 'swap' => 'snmp_standard::mode::swap', + 'blade-temperature' => 'network::juniper::mag::plugin::mode::bladetemperature', + ); + + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Juniper MAG in SNMP. + +=cut diff --git a/centreon-plugins/network/juniper/srx/plugin.pm b/centreon-plugins/network/juniper/srx/plugin.pm index c4616f45f..79f9d3bac 100644 --- a/centreon-plugins/network/juniper/srx/plugin.pm +++ b/centreon-plugins/network/juniper/srx/plugin.pm @@ -47,17 +47,17 @@ sub new { $self->{version} = '1.0'; %{$self->{modes}} = ( - 'hardware' => 'network::juniper::common::mode::hardware', - 'cpu-routing' => 'network::juniper::common::mode::cpurouting', # routing engine - 'cpu-forwarding' => 'network::juniper::common::mode::cpuforwarding', # packet forwarding engine - 'memory-routing' => 'network::juniper::common::mode::memoryrouting', # routing engine - 'memory-forwarding' => 'network::juniper::common::mode::memoryforwarding', # packet forwarding engine - 'cp-sessions' => 'network::juniper::common::mode::cpsessions', # CP = 'central point' - 'flow-sessions' => 'network::juniper::common::mode::flowsessions', - 'traffic' => 'snmp_standard::mode::traffic', - 'list-interfaces' => 'snmp_standard::mode::listinterfaces', - 'list-storages' => 'snmp_standard::mode::liststorages', - 'storage' => 'snmp_standard::mode::storage', + 'hardware' => 'network::juniper::common::junos::mode::hardware', + 'cpu-routing' => 'network::juniper::common::junos::mode::cpurouting', # routing engine + 'cpu-forwarding' => 'network::juniper::common::junos::mode::cpuforwarding', # packet forwarding engine + 'memory-routing' => 'network::juniper::common::junos::mode::memoryrouting', # routing engine + 'memory-forwarding' => 'network::juniper::common::junos::mode::memoryforwarding', # packet forwarding engine + 'cp-sessions' => 'network::juniper::common::junos::mode::cpsessions', # CP = 'central point' + 'flow-sessions' => 'network::juniper::common::junos::mode::flowsessions', + 'traffic' => 'snmp_standard::mode::traffic', + 'list-interfaces' => 'snmp_standard::mode::listinterfaces', + 'list-storages' => 'snmp_standard::mode::liststorages', + 'storage' => 'snmp_standard::mode::storage', ); return $self;