From a995946a6f51221caceb4ee1ba1800522533f7ff Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Thu, 24 Jul 2014 11:47:28 +0200 Subject: [PATCH] Refs #5695 --- network/alcatel/common/mode/cpu.pm | 90 ++++++++----- network/alcatel/common/mode/flashmemory.pm | 149 +++++++++++++++++++++ network/alcatel/common/mode/hardware.pm | 2 +- network/alcatel/common/mode/memory.pm | 89 +++++++----- network/alcatel/common/mode/stack.pm | 135 +++++++++++++++++++ network/alcatel/omniswitch/6850/plugin.pm | 2 + 6 files changed, 392 insertions(+), 75 deletions(-) create mode 100644 network/alcatel/common/mode/flashmemory.pm create mode 100644 network/alcatel/common/mode/stack.pm diff --git a/network/alcatel/common/mode/cpu.pm b/network/alcatel/common/mode/cpu.pm index 3afed8334..b6668c97c 100644 --- a/network/alcatel/common/mode/cpu.pm +++ b/network/alcatel/common/mode/cpu.pm @@ -35,7 +35,7 @@ # #################################################################################### -package network::alcatel::omniswitch::6850::mode::cpu; +package network::alcatel::common::mode::cpu; use base qw(centreon::plugins::mode); @@ -50,8 +50,8 @@ sub new { $self->{version} = '1.0'; $options{options}->add_options(arguments => { - "warning:s" => { name => 'warning', default => '80,90' }, - "critical:s" => { name => 'critical', default => '80,90' }, + "warning:s" => { name => 'warning', default => '' }, + "critical:s" => { name => 'critical', default => '' }, }); return $self; @@ -77,49 +77,65 @@ sub check_options { $self->{output}->option_exit(); } if (($self->{perfdata}->threshold_validate(label => 'crit5h', value => $self->{crit5})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical (1hout) threshold '" . $self->{crit1h} . "'."); + $self->{output}->add_option_msg(short_msg => "Wrong critical (1hour) threshold '" . $self->{crit1h} . "'."); $self->{output}->option_exit(); } } +sub check_cpu { + my ($self, %options) = @_; + + my $exit1 = $self->{perfdata}->threshold_check(value => $options{'1min'}, threshold => [ { label => 'crit1m', exit_litteral => 'critical' }, + { label => 'warn1m', exit_litteral => 'warning' }, + ]); + + my $exit2 = $self->{perfdata}->threshold_check(value => $options{'1hour'}, threshold => [ { label => 'crit1h', exit_litteral => 'critical' }, + { label => 'warn1h', exit_litteral => 'warning' }, + ]); + + my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); + + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("%s: %.2f%% (1min), %.2f%% (1hour)", $options{name}, $options{'1min'}, $options{'1hour'})); + + $self->{output}->perfdata_add(label => "cpu1m" . $options{perf_label} , unit => '%', + value => $options{'1min'}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'), + min => 0, max => 100); + $self->{output}->perfdata_add(label => "cpu1h" . $options{perf_label} , unit => '%', + value => $options{'1hour'}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1h'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1h'), + min => 0, max => 100); +} + sub run { my ($self, %options) = @_; # $options{snmp} = snmp object $self->{snmp} = $options{snmp}; - my $oid_CpuAvg1m = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.14.0'; - my $oid_CpuAvg1h = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.15.0'; - my $result = $self->{snmp}->get_table(oid => [$oid_CpuAvg1m, $oid_CpuAvg1h], nothing_quit => 1); + my $oid_healthDeviceCpu1MinAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.14'; # it's '.0' but it's for walk multiple + my $oid_healthDeviceCpu1HrAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.15'; # it's '.0' but it's for walk multiple + my $oid_healthModuleCpu1MinAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.15'; + my $oid_healthModuleCpu1HrAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.16'; - my $cpu1min = $result->{$oid_CpuAvg1m}; - my $cpu1hour = $result->{$oid_CpuAvg1h}; - - my $exit1 = $self->{perfdata}->threshold_check(value => $cpu1min, threshold => [ { label => 'crit1m', 'exit_litteral' => 'critical' }, - { label => 'warn1m', exit_litteral => 'warning' }, - ]); - - my $exit2 = $self->{perfdata}->threshold_check(value => $cpu1hour, threshold => [ { label => 'crit1h', exit_litteral => 'critical' }, - { label => 'warn1h', exit_litteral => 'warning' }, - ]); - - my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); - - - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("CPU '%s': %.2f%% (1min), %.2f%% (1hour))", $cpu1min, $cpu1hour)); - - $self->{output}->perfdata_add(label => "cpu1m", unit => '%', - value => $cpu1min, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'), - min => 0, max => 100); - $self->{output}->perfdata_add(label => "cpu1h", unit => '%', - value => $cpu1hour, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1h'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1h'), - min => 0, max => 100); - - + my $result = $self->{snmp}->get_multiple_table(oids => [ + { oid => $oid_healthDeviceCpu1MinAvg }, + { oid => $oid_healthDeviceCpu1HrAvg }, + { oid => $oid_healthModuleCpu1MinAvg }, + { oid => $oid_healthModuleCpu1HrAvg }, + ], nothing_quit => 1); + + $self->check_cpu(name => 'Device cpu', perf_label => '_device', + '1min' => $result->{$oid_healthDeviceCpu1MinAvg}->{$oid_healthDeviceCpu1MinAvg . '.' . 0}, + '1hour' => $result->{$oid_healthDeviceCpu1HrAvg}->{$oid_healthDeviceCpu1HrAvg . '.' . 0}); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$result->{$oid_healthModuleCpu1MinAvg}})) { + $oid =~ /^$oid_healthModuleCpu1MinAvg\.(.*)$/; + $self->check_cpu(name => "Module cpu '$1'", perf_label => "_module_$1", + '1min' => $result->{$oid_healthModuleCpu1MinAvg}->{$oid_healthModuleCpu1MinAvg . '.' . $1}, + '1hour' => $result->{$oid_healthModuleCpu1HrAvg}->{$oid_healthModuleCpu1HrAvg . '.' . $1}); + } $self->{output}->display(); $self->{output}->exit(); @@ -131,7 +147,7 @@ __END__ =head1 MODE -Check cpu usage (ALCATEL-IND1-HEALTH-MIB (v2)) +Check cpu usage (AlcatelIND1Health.mib). =over 8 diff --git a/network/alcatel/common/mode/flashmemory.pm b/network/alcatel/common/mode/flashmemory.pm new file mode 100644 index 000000000..47b9e0a06 --- /dev/null +++ b/network/alcatel/common/mode/flashmemory.pm @@ -0,0 +1,149 @@ +################################################################################ +# 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::alcatel::common::mode::flashmemory; + +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_chasSupervisionFlashMemEntry = '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.9.1'; + my $oid_chasSupervisionFlashSize = '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.9.1.2'; # in B + my $oid_chasSupervisionFlashFree = '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.9.1.3'; # in B + my $result = $self->{snmp}->get_table(oid => $oid_chasSupervisionFlashMemEntry, nothing_quit => 1); + + $self->{output}->output_add(severity => 'OK', + short_msg => 'All flash memories are ok.'); + + foreach my $oid (keys %$result) { + next if ($oid !~ /^$oid_chasSupervisionFlashSize\./); + $oid =~ /\.([0-9]+)$/; + my $instance = $1; + + # Skip if total = 0 + next if ($result->{$oid_chasSupervisionFlashSize . '.' . $instance} == 0); + + my $memory_name = $instance; + my $memory_used = $result->{$oid_chasSupervisionFlashSize . '.' . $instance} - $result->{$oid_chasSupervisionFlashFree . '.' . $instance}; + my $memory_free = $result->{$oid_chasSupervisionFlashFree . '.' . $instance}; + + my $total_size = $memory_used + $memory_free; + my $prct_used = $memory_used * 100 / $total_size; + my $prct_free = 100 - $prct_used; + + 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 => $memory_used); + my ($free_value, $free_unit) = $self->{perfdata}->change_bytes(value => $memory_free); + + $self->{output}->output_add(long_msg => sprintf("Memory '%s' Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $memory_name, + $total_value . " " . $total_unit, + $used_value . " " . $used_unit, $prct_used, + $free_value . " " . $free_unit, $prct_free)); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Memory '%s' Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $memory_name, + $total_value . " " . $total_unit, + $used_value . " " . $used_unit, $prct_used, + $free_value . " " . $free_unit, $prct_free)); + } + + $self->{output}->perfdata_add(label => "used_" . $memory_name, + value => $memory_used, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size), + min => 0, max => $total_size); + } + + $self->{output}->display(); + $self->{output}->exit(); +} + +1; + +__END__ + +=head1 MODE + +Check flash memory (AlcatelIND1Chassis.mib). + +=over 8 + +=item B<--warning> + +Threshold warning in percent. + +=item B<--critical> + +Threshold critical in percent. + +=back + +=cut diff --git a/network/alcatel/common/mode/hardware.pm b/network/alcatel/common/mode/hardware.pm index a82f112d3..5dab5ca74 100644 --- a/network/alcatel/common/mode/hardware.pm +++ b/network/alcatel/common/mode/hardware.pm @@ -191,7 +191,7 @@ __END__ =head1 MODE -Check status of alcatel hardware. +Check status of alcatel hardware (AlcatelIND1Chassis.mib). =over 8 diff --git a/network/alcatel/common/mode/memory.pm b/network/alcatel/common/mode/memory.pm index c6c2aca48..fc31b730a 100644 --- a/network/alcatel/common/mode/memory.pm +++ b/network/alcatel/common/mode/memory.pm @@ -35,7 +35,7 @@ # #################################################################################### -package network::alcatel::omniswitch::6850::mode::memory; +package network::alcatel::common::mode::memory; use base qw(centreon::plugins::mode); @@ -50,8 +50,8 @@ sub new { $self->{version} = '1.0'; $options{options}->add_options(arguments => { - "warning:s" => { name => 'warning', default => '80,90' }, - "critical:s" => { name => 'critical', default => '80,90' }, + "warning:s" => { name => 'warning', default => '' }, + "critical:s" => { name => 'critical', default => '' }, }); return $self; @@ -77,49 +77,65 @@ sub check_options { $self->{output}->option_exit(); } if (($self->{perfdata}->threshold_validate(label => 'crit5h', value => $self->{crit5})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical (1hout) threshold '" . $self->{crit1h} . "'."); + $self->{output}->add_option_msg(short_msg => "Wrong critical (1hour) threshold '" . $self->{crit1h} . "'."); $self->{output}->option_exit(); } } +sub check_memory { + my ($self, %options) = @_; + + my $exit1 = $self->{perfdata}->threshold_check(value => $options{'1min'}, threshold => [ { label => 'crit1m', exit_litteral => 'critical' }, + { label => 'warn1m', exit_litteral => 'warning' }, + ]); + + my $exit2 = $self->{perfdata}->threshold_check(value => $options{'1hour'}, threshold => [ { label => 'crit1h', exit_litteral => 'critical' }, + { label => 'warn1h', exit_litteral => 'warning' }, + ]); + + my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); + + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("%s: %.2f%% (1min), %.2f%% (1hour)", $options{name}, $options{'1min'}, $options{'1hour'})); + + $self->{output}->perfdata_add(label => "mem1m" . $options{perf_label} , unit => '%', + value => $options{'1min'}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'), + min => 0, max => 100); + $self->{output}->perfdata_add(label => "mem1h" . $options{perf_label} , unit => '%', + value => $options{'1hour'}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1h'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1h'), + min => 0, max => 100); +} + sub run { my ($self, %options) = @_; # $options{snmp} = snmp object $self->{snmp} = $options{snmp}; - my $oid_healthDeviceMemory1MinAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.10.0'; - my $oid_healthDeviceMemory1HrAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.11.0'; - my $result = $self->{snmp}->get_table(oid => [$oid_healthDeviceMemory1MinAvg, $oid_healthDeviceMemory1HrAvg], nothing_quit => 1); + my $oid_healthDeviceMemory1MinAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.10'; # it's '.0' but it's for walk multiple + my $oid_healthDeviceMemory1HrAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.11'; # it's '.0' but it's for walk multiple + my $oid_healthModuleMemory1MinAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.11'; + my $oid_healthModuleMemory1HrAvg = '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.12'; - my $mem1min = $result->{$oid_healthDeviceMemory1MinAvg}; - my $mem1hour = $result->{$oid_healthDeviceMemory1HrAvg}; - - my $exit1 = $self->{perfdata}->threshold_check(value => $mem1min, threshold => [ { label => 'crit1m', 'exit_litteral' => 'critical' }, - { label => 'warn1m', exit_litteral => 'warning' }, - ]); - - my $exit2 = $self->{perfdata}->threshold_check(value => $mem1hour, threshold => [ { label => 'crit1h', exit_litteral => 'critical' }, - { label => 'warn1h', exit_litteral => 'warning' }, - ]); - - my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); - - - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Memory '%s': %.2f%% (1min), %.2f%% (1hour))", $mem1min, $mem1hour) - ); + my $result = $self->{snmp}->get_multiple_table(oids => [ + { oid => $oid_healthDeviceMemory1MinAvg }, + { oid => $oid_healthDeviceMemory1HrAvg }, + { oid => $oid_healthModuleMemory1MinAvg }, + { oid => $oid_healthModuleMemory1HrAvg }, + ], nothing_quit => 1); - $self->{output}->perfdata_add(label => "memory1m", unit => '%', - value => $mem1min, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'), - min => 0, max => 100); - $self->{output}->perfdata_add(label => "memory1h", unit => '%', - value => $mem1hour, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1h'), - min => 0, max => 100); - + $self->check_memory(name => 'Device memory', perf_label => '_device', + '1min' => $result->{$oid_healthDeviceMemory1MinAvg}->{$oid_healthDeviceMemory1MinAvg . '.' . 0}, + '1hour' => $result->{$oid_healthDeviceMemory1HrAvg}->{$oid_healthDeviceMemory1HrAvg . '.' . 0}); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$result->{$oid_healthModuleMemory1MinAvg}})) { + $oid =~ /^$oid_healthModuleMemory1MinAvg\.(.*)$/; + $self->check_memory(name => "Module memory '$1'", perf_label => "_module_$1", + '1min' => $result->{$oid_healthModuleMemory1MinAvg}->{$oid_healthModuleMemory1MinAvg . '.' . $1}, + '1hour' => $result->{$oid_healthModuleMemory1HrAvg}->{$oid_healthModuleMemory1HrAvg . '.' . $1}); + } $self->{output}->display(); $self->{output}->exit(); @@ -131,7 +147,7 @@ __END__ =head1 MODE -Check cpu usage (ALCATEL-IND1-HEALTH-MIB (v2)) +Check memory usage (AlcatelIND1Health.mib). =over 8 @@ -146,4 +162,3 @@ Threshold critical in percent (1m,1h). =back =cut - diff --git a/network/alcatel/common/mode/stack.pm b/network/alcatel/common/mode/stack.pm new file mode 100644 index 000000000..7d74f99ae --- /dev/null +++ b/network/alcatel/common/mode/stack.pm @@ -0,0 +1,135 @@ +################################################################################ +# 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::alcatel::common::mode::stack; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; + +my %map_role = ( + 1 => 'master', + 2 => 'member', + 3 => 'notMember', + 4 => 'standby' +); +my %states = ( + 1 => ['waiting', 'WARNING'], + 2 => ['progressing', 'WARNING'], + 3 => ['added', 'WARNING'], + 4 => ['ready', 'OK'], + 5 => ['sdmMismatch', 'CRITICAL'], + 6 => ['verMismatch', 'CRITICAL'], + 7 => ['featureMismatch', 'CRITICAL'], + 8 => ['newMasterInit', 'WARNING'], + 9 => ['provisioned', 'OK'], + 10 => ['invalid', 'WARNING'], + 11 => ['removed', 'WARNING'], +); + +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; +} + +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_cswRingRedundant = '.1.3.6.1.4.1.9.9.500.1.1.3.0'; + #my $oid_cswSwitchRole = '.1.3.6.1.4.1.9.9.500.1.2.1.1.3'; + #my $oid_cswSwitchState = '.1.3.6.1.4.1.9.9.500.1.2.1.1.6'; + #my $result = $self->{snmp}->get_leef(oids => [$oid_cswRingRedundant], nothing_quit => 1); + #my $result_state = $self->{snmp}->get_table(oid => $oid_cswSwitchState, nothing_quit => 1); + #my $result_role = $self->{snmp}->get_table(oid => $oid_cswSwitchRole); + + #$self->{output}->output_add(severity => 'OK', + # short_msg => 'Stack ring is redundant'); + #if ($result->{$oid_cswRingRedundant} != 1) { + # $self->{output}->output_add(severity => 'WARNING', + # short_msg => 'Stack ring is not redundant'); + #} + + #foreach my $oid (keys %$result_state) { + # $oid =~ /\.([0-9]+)$/; + # my $instance = $1; + + # my $state = $result_state->{$oid}; + # my $role = defined($result_role->{$oid_cswSwitchRole . '.' . $instance}) ? $result_role->{$oid_cswSwitchRole . '.' . $instance} : 'unknown'; + # .1001, .2001 the instance. + # my $number = int(($instance - 1) / 1000); + + # $self->{output}->output_add(long_msg => sprintf("Member '%s' state is %s [Role is '%s']", $number, + # ${$states{$state}}[0], $map_role{$role})); + # if (${$states{$state}}[1] ne 'OK') { + # $self->{output}->output_add(severity => ${$states{$state}}[1], + # short_msg => sprintf("Member '%s' state is %s", $number, + # ${$states{$state}}[0])); + # } + #} + + $self->{output}->display(); + $self->{output}->exit(); +} + +1; + +__END__ + +=head1 MODE + +Check Cisco Stack (CISCO-STACKWISE-MIB). + +=over 8 + +=back + +=cut + \ No newline at end of file diff --git a/network/alcatel/omniswitch/6850/plugin.pm b/network/alcatel/omniswitch/6850/plugin.pm index 5319b2161..95bd9b861 100644 --- a/network/alcatel/omniswitch/6850/plugin.pm +++ b/network/alcatel/omniswitch/6850/plugin.pm @@ -50,9 +50,11 @@ sub new { 'cpu' => 'network::alcatel::common::mode::cpu', 'hardware' => 'network::alcatel::common::mode::hardware', 'list-interfaces' => 'snmp_standard::mode::listinterfaces', + 'flash-memory' => 'network::alcatel::common::mode::flashmemory', 'memory' => 'network::alcatel::common::mode::memory', 'packet-errors' => 'snmp_standard::mode::packeterrors', 'spanning-tree' => 'snmp_standard::mode::spanningtree', + #'stack' => 'network::alcatel::common::mode::stack', 'traffic' => 'snmp_standard::mode::traffic', );