diff --git a/network/alcatel/common/mode/components/backplane.pm b/network/alcatel/common/mode/components/backplane.pm deleted file mode 100644 index e0368b0cc..000000000 --- a/network/alcatel/common/mode/components/backplane.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::backplane; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking backplane"); - $self->{components}->{backplane} = {name => 'backplanes', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'backplane')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 4) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'backplane', instance => $instance)); - $self->{components}->{backplane}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("backplane '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("backplane '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("backplane '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/chassis.pm b/network/alcatel/common/mode/components/chassis.pm deleted file mode 100644 index 258f68c67..000000000 --- a/network/alcatel/common/mode/components/chassis.pm +++ /dev/null @@ -1,140 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::chassis; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking chassis"); - $self->{components}->{chassis} = {name => 'chassis', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'chassis')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 3) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - return if (scalar(@instances) == 0); - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'chassis', instance => $instance)); - $self->{components}->{chassis}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("chassis '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("chassis '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("chassis '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } - - # Check board temp - $self->{snmp}->load(oids => [$oids{chasHardwareBoardTemp}, $oids{chasTempThreshold}, $oids{chasDangerTempThreshold}], - instances => [@instances]); - my $result = $self->{snmp}->get_leef(); - foreach my $instance (@instances) { - my $value = defined($result->{$oids{chasHardwareBoardTemp} . '.' . $instance}) ? - $result->{$oids{chasHardwareBoardTemp} . '.' . $instance} : undef; - my $warn = defined($result->{$oids{chasTempThreshold} . '.' . $instance}) ? - $result->{$oids{chasTempThreshold} . '.' . $instance} : undef; - my $crit = defined($result->{$oids{chasDangerTempThreshold} . '.' . $instance}) ? - $result->{$oids{chasDangerTempThreshold} . '.' . $instance} : undef; - - next if (!defined($value)); - - $self->{perfdata}->threshold_validate(label => 'warning_' . $instance, value => $warn); - $self->{perfdata}->threshold_validate(label => 'critical_' . $instance, value => $crit); - - my $exit = $self->{perfdata}->threshold_check(value => $value, threshold => [ { label => 'critical_' . $instance, 'exit_litteral' => 'critical' }, { label => 'warning_' . $instance, exit_litteral => 'warning' } ]); - $self->{output}->output_add(long_msg => sprintf("Temperature board '%s' value is %s C.", - $instance, $value)); - if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Temperature board '%s' value is %s C", $instance, $value)); - } - - $self->{output}->perfdata_add(label => 'temp_board_' . $instance, unit => 'C', - value => $value, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_' . $instance), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_' . $instance), - ); - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/container.pm b/network/alcatel/common/mode/components/container.pm deleted file mode 100644 index 4dc5c6cd6..000000000 --- a/network/alcatel/common/mode/components/container.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::container; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking container"); - $self->{components}->{container} = {name => 'containers', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'container')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 5) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'container', instance => $instance)); - $self->{components}->{container}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("container '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("container '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("container '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/fan.pm b/network/alcatel/common/mode/components/fan.pm deleted file mode 100644 index 8ac72436d..000000000 --- a/network/alcatel/common/mode/components/fan.pm +++ /dev/null @@ -1,146 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::fan; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -my @fan_conditions = ( - ['^noStatus$', 'UNKNOWN'], - ['^notRunning$', 'CRITICAL'], - ['^(?!(running)$)', 'UNKNOWN'], -); - -my %fan_status = ( - 0 => 'noStatus', - 1 => 'notRunning', - 2 => 'running', -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking fan"); - $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'fan')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 7) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'fan', instance => $instance)); - $self->{components}->{fan}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("fan '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("fan '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("fan '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } - - foreach my $key (keys %{$self->{results}->{$oids{alaChasEntPhysFanStatus}}}) { - next if ($key !~ /^$oids{alaChasEntPhysFanStatus}\.(.*?)\.(.*?)$/); - my ($phys_index, $loc_index) = ($1, $2); - my $status = $self->{results}->{$oids{alaChasEntPhysFanStatus}}->{$key}; - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $phys_index}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $phys_index} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $phys_index}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $phys_index} : 'unknown'; - - next if ($self->check_exclude(section => 'fan', instance => $phys_index . '.' . $loc_index)); - $self->{components}->{fan}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("fan '%s/%s' [instance: %s] status is %s.", - $name, $descr, $loc_index, - $fan_status{$status}) - ); - foreach (@fan_conditions) { - if ($fan_status{$status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("fan '%s/%s/%s' status is %s.", - $name, $descr, $loc_index, - $fan_status{$status}) - ); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/module.pm b/network/alcatel/common/mode/components/module.pm deleted file mode 100644 index 98f982805..000000000 --- a/network/alcatel/common/mode/components/module.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::module; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking module"); - $self->{components}->{module} = {name => 'modules', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'module')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 9) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'module', instance => $instance)); - $self->{components}->{module}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("module '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("module '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("module '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/other.pm b/network/alcatel/common/mode/components/other.pm deleted file mode 100644 index fe3cc10ce..000000000 --- a/network/alcatel/common/mode/components/other.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::other; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking other"); - $self->{components}->{other} = {name => 'others', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'other')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 1) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'other', instance => $instance)); - $self->{components}->{other}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("other '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("other '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("other '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/port.pm b/network/alcatel/common/mode/components/port.pm deleted file mode 100644 index a3a720b5f..000000000 --- a/network/alcatel/common/mode/components/port.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::port; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking port"); - $self->{components}->{port} = {name => 'ports', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'port')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 10) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'port', instance => $instance)); - $self->{components}->{port}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("port '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("port '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("port '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/powersupply.pm b/network/alcatel/common/mode/components/powersupply.pm deleted file mode 100644 index 0a96b523e..000000000 --- a/network/alcatel/common/mode/components/powersupply.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::powersupply; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking psu"); - $self->{components}->{psu} = {name => 'power supplies', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'psu')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 6) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'psu', instance => $instance)); - $self->{components}->{psu}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("power supply '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("power supply '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("power supply '%s/%s/%s' operationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; diff --git a/network/alcatel/common/mode/components/sensor.pm b/network/alcatel/common/mode/components/sensor.pm deleted file mode 100644 index 3d7f9c742..000000000 --- a/network/alcatel/common/mode/components/sensor.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::sensor; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking sensor"); - $self->{components}->{sensor} = {name => 'sensors', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'sensor')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 8) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'sensor', instance => $instance)); - $self->{components}->{sensor}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("sensor '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("sensor '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("sensor '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/stack.pm b/network/alcatel/common/mode/components/stack.pm deleted file mode 100644 index dee4bafc3..000000000 --- a/network/alcatel/common/mode/components/stack.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::stack; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking stack"); - $self->{components}->{stack} = {name => 'stacks', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'stack')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 11) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'stack', instance => $instance)); - $self->{components}->{stack}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("stack '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("stack '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("stack '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/unknown.pm b/network/alcatel/common/mode/components/unknown.pm deleted file mode 100644 index ed4fc7637..000000000 --- a/network/alcatel/common/mode/components/unknown.pm +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::components::unknown; - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%physical_class %phys_oper_status %phys_admin_status %oids); - -my @admin_conditions = ( - ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], - ['^(powerOff)$', 'CRITICAL'], - ['^(?!(powerOn|standby)$)', 'UNKNOWN'], -); - -my @oper_conditions = ( - ['^(testing)$', 'WARNING'], - ['^(unpowered|down|notpresent)$', 'CRITICAL'], - ['^(?!(up|secondary|master|idle)$)', 'UNKNOWN'], -); - -sub check { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking unknown"); - $self->{components}->{unknown} = {name => 'unknowns', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'unknown')); - - my @instances = (); - foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { - if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 2) { - next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); - push @instances, $1; - } - } - - foreach my $instance (@instances) { - next if (!defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); - - my $descr = defined($self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $instance} : 'unknown'; - my $name = defined($self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance}) ? - $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $instance} : 'unknown'; - my $admin_status = defined($self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysAdminStatus}}->{$oids{chasEntPhysAdminStatus} . '.' . $instance} : 1; - my $oper_status = defined($self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysOperStatus}}->{$oids{chasEntPhysOperStatus} . '.' . $instance} : 4; - my $power = defined($self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance}) ? - $self->{results}->{$oids{chasEntPhysPower}}->{$oids{chasEntPhysPower} . '.' . $instance} : -1; - - next if ($self->check_exclude(section => 'unknown', instance => $instance)); - $self->{components}->{unknown}->{total}++; - - $self->{output}->output_add(long_msg => sprintf("unknown '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", - $name, $descr, $instance, - $phys_admin_status{$admin_status}, $phys_oper_status{$oper_status}) - ); - - my $go_forward = 1; - foreach (@admin_conditions) { - if ($phys_admin_status{$admin_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("unknown '%s/%s/%s' admin status is %s", - $name, $descr, $instance, $phys_admin_status{$admin_status})); - $go_forward = 0; - last; - } - } - - if ($power > 0) { - $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', - value => $power, - min => 0); - } - - next if ($go_forward == 0); - - foreach (@oper_conditions) { - if ($phys_oper_status{$oper_status} =~ /$$_[0]/i) { - $self->{output}->output_add(severity => $$_[1], - short_msg => sprintf("unknown '%s/%s/%s' oeprationnal status is %s", - $name, $descr, $instance, $phys_oper_status{$oper_status})); - last; - } - } - } -} - -1; \ No newline at end of file diff --git a/network/alcatel/common/mode/hardware.pm b/network/alcatel/common/mode/hardware.pm deleted file mode 100644 index d531c11e5..000000000 --- a/network/alcatel/common/mode/hardware.pm +++ /dev/null @@ -1,202 +0,0 @@ -# -# Copyright 2017 Centreon (http://www.centreon.com/) -# -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for -# service performance. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -package network::alcatel::common::mode::hardware; - -use base qw(centreon::plugins::mode); - -use strict; -use warnings; -use network::alcatel::common::mode::components::resources qw(%oids); -use network::alcatel::common::mode::components::backplane; -use network::alcatel::common::mode::components::chassis; -use network::alcatel::common::mode::components::container; -use network::alcatel::common::mode::components::fan; -use network::alcatel::common::mode::components::module; -use network::alcatel::common::mode::components::other; -use network::alcatel::common::mode::components::port; -use network::alcatel::common::mode::components::powersupply; -use network::alcatel::common::mode::components::sensor; -use network::alcatel::common::mode::components::stack; -use network::alcatel::common::mode::components::unknown; - -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 => - { - "exclude:s" => { name => 'exclude' }, - "component:s" => { name => 'component', default => 'all' }, - "no-component:s" => { name => 'no_component' }, - }); - - $self->{components} = {}; - $self->{no_components} = undef; - - return $self; -} - -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); - - if (defined($self->{option_results}->{no_component})) { - if ($self->{option_results}->{no_component} ne '') { - $self->{no_components} = $self->{option_results}->{no_component}; - } else { - $self->{no_components} = 'critical'; - } - } -} - -sub component { - my ($self, %options) = @_; - - if ($self->{option_results}->{component} eq 'all') { - network::alcatel::common::mode::components::backplane::check($self); - network::alcatel::common::mode::components::chassis::check($self); - network::alcatel::common::mode::components::container::check($self); - network::alcatel::common::mode::components::fan::check($self); - network::alcatel::common::mode::components::module::check($self); - network::alcatel::common::mode::components::other::check($self); - network::alcatel::common::mode::components::port::check($self); - network::alcatel::common::mode::components::powersupply::check($self); - network::alcatel::common::mode::components::sensor::check($self); - network::alcatel::common::mode::components::stack::check($self); - network::alcatel::common::mode::components::unknown::check($self); - } elsif ($self->{option_results}->{component} eq 'backplane') { - network::alcatel::common::mode::components::backplane::check($self); - } elsif ($self->{option_results}->{component} eq 'chassis') { - network::alcatel::common::mode::components::chassis::check($self); - } elsif ($self->{option_results}->{component} eq 'container') { - network::alcatel::common::mode::components::container::check($self); - } elsif ($self->{option_results}->{component} eq 'fan') { - network::alcatel::common::mode::components::fan::check($self); - } elsif ($self->{option_results}->{component} eq 'module') { - network::alcatel::common::mode::components::module::check($self); - } elsif ($self->{option_results}->{component} eq 'other') { - network::alcatel::common::mode::components::other::check($self); - } elsif ($self->{option_results}->{component} eq 'port') { - network::alcatel::common::mode::components::port::check($self); - } elsif ($self->{option_results}->{component} eq 'psu') { - network::alcatel::common::mode::components::powersupply::check($self); - } elsif ($self->{option_results}->{component} eq 'sensor') { - network::alcatel::common::mode::components::sensor::check($self); - } elsif ($self->{option_results}->{component} eq 'stack') { - network::alcatel::common::mode::components::stack::check($self); - } elsif ($self->{option_results}->{component} eq 'unknown') { - network::alcatel::common::mode::components::unknown::check($self); - } else { - $self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'."); - $self->{output}->option_exit(); - } - - my $total_components = 0; - my $display_by_component = ''; - my $display_by_component_append = ''; - foreach my $comp (sort(keys %{$self->{components}})) { - # Skipping short msg when no components - next if ($self->{components}->{$comp}->{total} == 0 && $self->{components}->{$comp}->{skip} == 0); - $total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip}; - my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip}; - $display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name}; - $display_by_component_append = ', '; - } - - $self->{output}->output_add(severity => 'OK', - short_msg => sprintf("All %s components [%s] are ok.", - $total_components, - $display_by_component) - ); - - if (defined($self->{option_results}->{no_component}) && $total_components == 0) { - $self->{output}->output_add(severity => $self->{no_components}, - short_msg => 'No components are checked.'); - } -} - -sub run { - my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - - $self->{results} = $self->{snmp}->get_multiple_table(oids => [ - { oid => $oids{entPhysicalDescr} }, - { oid => $oids{entPhysicalClass} }, - { oid => $oids{entPhysicalName} }, - { oid => $oids{chasEntPhysAdminStatus} }, - { oid => $oids{chasEntPhysOperStatus} }, - { oid => $oids{chasEntPhysPower} }, - { oid => $oids{alaChasEntPhysFanStatus} }, - ]); - $self->component(); - - $self->{output}->display(); - $self->{output}->exit(); -} - -sub check_exclude { - my ($self, %options) = @_; - - if (defined($options{instance})) { - if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) { - $self->{components}->{$options{section}}->{skip}++; - $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance.")); - return 1; - } - } elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) { - $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section.")); - return 1; - } - return 0; -} - -1; - -__END__ - -=head1 MODE - -Check status of alcatel hardware (AlcatelIND1Chassis.mib). - -=over 8 - -=item B<--component> - -Which component to check (Default: 'all'). -Can be: 'other', 'unknown', 'chassis', 'backplane', 'container', 'psu', 'fan', -'sensor', 'module', 'port, 'stack'. -Some not exists ;) - -=item B<--exclude> - -Exclude some parts (comma seperated list) (Example: --exclude=fan) -Can also exclude specific instance: --exclude=fan#1.2#,module - -=item B<--no-component> - -Return an error if no compenents are checked. -If total (with skipped) is 0. (Default: 'critical' returns). - -=back - -=cut diff --git a/network/alcatel/omniswitch/snmp/mode/components/backplane.pm b/network/alcatel/omniswitch/snmp/mode/components/backplane.pm new file mode 100644 index 000000000..4d167a861 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/backplane.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::backplane; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking backplane"); + $self->{components}->{backplane} = {name => 'backplanes', total => 0, skip => 0}; + return if ($self->check_filter(section => 'backplane')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 4) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'backplane', instance => $instance)); + $self->{components}->{backplane}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("backplane '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'backplane.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("backplane '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'backplane.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("backplane '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/chassis.pm b/network/alcatel/omniswitch/snmp/mode/components/chassis.pm new file mode 100644 index 000000000..2918e5867 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/chassis.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::chassis; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking chassis"); + $self->{components}->{chassis} = {name => 'chassis', total => 0, skip => 0}; + return if ($self->check_filter(section => 'chassis')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 3) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'chassis', instance => $instance)); + $self->{components}->{chassis}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("chassis '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'chassis.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("chassis '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'chassis.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("chassis '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/container.pm b/network/alcatel/omniswitch/snmp/mode/components/container.pm new file mode 100644 index 000000000..883b6a749 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/container.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::container; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking container"); + $self->{components}->{container} = {name => 'containers', total => 0, skip => 0}; + return if ($self->check_filter(section => 'container')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 5) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'container', instance => $instance)); + $self->{components}->{container}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("container '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'container.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("container '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'container.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("container '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/fan.pm b/network/alcatel/omniswitch/snmp/mode/components/fan.pm new file mode 100644 index 000000000..2e02f79f6 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/fan.pm @@ -0,0 +1,113 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::fan; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +my %fan_status = ( + 0 => 'noStatus', + 1 => 'notRunning', + 2 => 'running', +); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking fan"); + $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0}; + return if ($self->check_filter(section => 'fan')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 7) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'fan', instance => $instance)); + $self->{components}->{fan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("fan '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'fan.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("fan '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'fan.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("fan '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } + + foreach my $key (keys %{$self->{results}->{$oids{alaChasEntPhysFanStatus}}}) { + next if ($key !~ /^$oids{alaChasEntPhysFanStatus}\.(.*?)\.(.*?)$/); + my ($phys_index, $loc_index) = ($1, $2); + my $status = $self->{results}->{$oids{alaChasEntPhysFanStatus}}->{$key}; + my $descr = defined($self->{results}->{entity}->{$oids{entPhysicalDescr} . '.' . $phys_index}) ? + $self->{results}->{$oids{entPhysicalDescr}}->{$oids{entPhysicalDescr} . '.' . $phys_index} : 'unknown'; + my $name = defined($self->{results}->{entity}->{$oids{entPhysicalName} . '.' . $phys_index}) ? + $self->{results}->{$oids{entPhysicalName}}->{$oids{entPhysicalName} . '.' . $phys_index} : 'unknown'; + + next if ($self->check_filter(section => 'fan', instance => $phys_index . '.' . $loc_index)); + $self->{components}->{fan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("fan '%s/%s' [instance: %s] status is %s", + $name, $descr, $loc_index, + $fan_status{$status}) + ); + my $exit = $self->get_severity(label => 'fan', section => 'fan.status', value => $fan_status{$status}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("fan '%s/%s/%s' status is %s", + $name, $descr, $loc_index, + $fan_status{$status})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/module.pm b/network/alcatel/omniswitch/snmp/mode/components/module.pm new file mode 100644 index 000000000..ff631571c --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/module.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::module; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking module"); + $self->{components}->{module} = {name => 'modules', total => 0, skip => 0}; + return if ($self->check_filter(section => 'module')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 9) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'module', instance => $instance)); + $self->{components}->{module}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("module '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'module.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("module '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'module.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("module '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/other.pm b/network/alcatel/omniswitch/snmp/mode/components/other.pm new file mode 100644 index 000000000..cdb704a9d --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/other.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::other; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking other"); + $self->{components}->{other} = {name => 'others', total => 0, skip => 0}; + return if ($self->check_filter(section => 'other')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 1) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'other', instance => $instance)); + $self->{components}->{other}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("other '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'other.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("other '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'other.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("other '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/port.pm b/network/alcatel/omniswitch/snmp/mode/components/port.pm new file mode 100644 index 000000000..d8ad20bc3 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/port.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::port; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking port"); + $self->{components}->{port} = {name => 'ports', total => 0, skip => 0}; + return if ($self->check_filter(section => 'port')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 10) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'port', instance => $instance)); + $self->{components}->{port}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("port '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'port.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("port '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'port.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("port '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/psu.pm b/network/alcatel/omniswitch/snmp/mode/components/psu.pm new file mode 100644 index 000000000..04921e1fa --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/psu.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::psu; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking power supplies"); + $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; + return if ($self->check_filter(section => 'psu')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 6) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'psu', instance => $instance)); + $self->{components}->{psu}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("power supply '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'psu.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("power supply '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'psu.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("power supply '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/common/mode/components/resources.pm b/network/alcatel/omniswitch/snmp/mode/components/resources.pm similarity index 80% rename from network/alcatel/common/mode/components/resources.pm rename to network/alcatel/omniswitch/snmp/mode/components/resources.pm index 58b41aaea..cbd15b15a 100644 --- a/network/alcatel/common/mode/components/resources.pm +++ b/network/alcatel/omniswitch/snmp/mode/components/resources.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::common::mode::components::resources; +package network::alcatel::omniswitch::snmp::mode::components::resources; use strict; use warnings; @@ -28,9 +28,10 @@ our %physical_class; our %phys_oper_status; our %phys_admin_status; our %oids; +our $mapping; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(%physical_class %phys_oper_status %phys_admin_status %oids); +our @EXPORT_OK = qw(%physical_class %phys_oper_status %phys_admin_status %oids $mapping); %physical_class = ( 1 => 'other', @@ -86,4 +87,12 @@ our @EXPORT_OK = qw(%physical_class %phys_oper_status %phys_admin_status %oids); alaChasEntPhysFanStatus => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.11.1.2', ); +$mapping = { + entPhysicalDescr => { oid => $oids{entPhysicalDescr} }, + entPhysicalName => { oid => $oids{entPhysicalName} }, + chasEntPhysAdminStatus => { oid => $oids{chasEntPhysAdminStatus}, map => \%phys_admin_status, default => 'unknown' }, + chasEntPhysOperStatus => { oid => $oids{chasEntPhysOperStatus}, map => \%phys_oper_status, default => 'unknown' }, + chasEntPhysPower => { oid => $oids{chasEntPhysPower}, default => -1 }, +}; + 1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/sensor.pm b/network/alcatel/omniswitch/snmp/mode/components/sensor.pm new file mode 100644 index 000000000..5a6a1f5f2 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/sensor.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::sensor; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking sensors"); + $self->{components}->{sensor} = {name => 'sensors', total => 0, skip => 0}; + return if ($self->check_filter(section => 'sensor')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 8) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'sensor', instance => $instance)); + $self->{components}->{sensor}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("sensor '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'sensor.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("sensor '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'sensor.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("sensor '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/stack.pm b/network/alcatel/omniswitch/snmp/mode/components/stack.pm new file mode 100644 index 000000000..5b24ec8d6 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/stack.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::stack; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking stack"); + $self->{components}->{stack} = {name => 'stacks', total => 0, skip => 0}; + return if ($self->check_filter(section => 'stack')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 11) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'stack', instance => $instance)); + $self->{components}->{stack}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("stack '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'stack.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("stack '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'stack.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("stack '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/omniswitch/snmp/mode/components/unknown.pm b/network/alcatel/omniswitch/snmp/mode/components/unknown.pm new file mode 100644 index 000000000..fe18d7a17 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/components/unknown.pm @@ -0,0 +1,82 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::components::unknown; + +use strict; +use warnings; +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $mapping); + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking unknown"); + $self->{components}->{unknown} = {name => 'unknowns', total => 0, skip => 0}; + return if ($self->check_filter(section => 'unknown')); + + my @instances = (); + foreach my $key (keys %{$self->{results}->{$oids{entPhysicalClass}}}) { + if ($self->{results}->{$oids{entPhysicalClass}}->{$key} == 2) { + next if ($key !~ /^$oids{entPhysicalClass}\.(.*)$/); + push @instances, $1; + } + } + + foreach my $instance (@instances) { + next if (!defined($self->{results}->{entity}->{$oids{chasEntPhysAdminStatus} . '.' . $instance})); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{entity}, instance => $instance); + + next if ($self->check_filter(section => 'unknown', instance => $instance)); + $self->{components}->{unknown}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("unknown '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}) + ); + + if ($result->{chasEntPhysPower} > 0) { + $self->{output}->perfdata_add(label => "power_" . $instance, unit => 'W', + value => $result->{chasEntPhysPower}, + min => 0); + } + + my $exit = $self->get_severity(label => 'admin', section => 'unknown.admin', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("unknown '%s/%s/%s' admin status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysAdminStatus})); + next; + } + + $exit = $self->get_severity(label => 'oper', section => 'unknown.oper', value => $result->{chasEntPhysAdminStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("unknown '%s/%s/%s' operational status is %s", + $result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance, + $result->{chasEntPhysOperStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/network/alcatel/common/mode/cpu.pm b/network/alcatel/omniswitch/snmp/mode/cpu.pm similarity index 99% rename from network/alcatel/common/mode/cpu.pm rename to network/alcatel/omniswitch/snmp/mode/cpu.pm index 0c738ce1c..720a59003 100644 --- a/network/alcatel/common/mode/cpu.pm +++ b/network/alcatel/omniswitch/snmp/mode/cpu.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::common::mode::cpu; +package network::alcatel::omniswitch::snmp::mode::cpu; use base qw(centreon::plugins::mode); diff --git a/network/alcatel/common/mode/flashmemory.pm b/network/alcatel/omniswitch/snmp/mode/flashmemory.pm similarity index 98% rename from network/alcatel/common/mode/flashmemory.pm rename to network/alcatel/omniswitch/snmp/mode/flashmemory.pm index 9d8a7349d..c16bce2a5 100644 --- a/network/alcatel/common/mode/flashmemory.pm +++ b/network/alcatel/omniswitch/snmp/mode/flashmemory.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::common::mode::flashmemory; +package network::alcatel::omniswitch::snmp::mode::flashmemory; use base qw(centreon::plugins::mode); diff --git a/network/alcatel/omniswitch/snmp/mode/hardware.pm b/network/alcatel/omniswitch/snmp/mode/hardware.pm new file mode 100644 index 000000000..0d5dfe540 --- /dev/null +++ b/network/alcatel/omniswitch/snmp/mode/hardware.pm @@ -0,0 +1,124 @@ +# +# Copyright 2017 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package network::alcatel::omniswitch::snmp::mode::hardware; + +use base qw(centreon::plugins::templates::hardware); +use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids); + +sub set_system { + my ($self, %options) = @_; + + $self->{regexp_threshold_overload_check_section_option} = '^(backplane|chassis|container|fan|module|other|port|psu|sensor|stack|unknown)$'; + + $self->{cb_hook2} = 'snmp_execute'; + + $self->{thresholds} = { + admin => [ + ['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], + ['^(powerOff)$', 'CRITICAL'], + ['powerOn', 'OK'], + ['standby', 'OK'], + ], + oper => [ + ['^(testing)$', 'WARNING'], + ['^(unpowered|down|notpresent)$', 'CRITICAL'], + ['up', 'OK'], + ['secondary', 'OK'], + ['master', 'OK'], + ['idle', 'OK'], + ], + fan => [ + ['^noStatus$', 'UNKNOWN'], + ['^notRunning$', 'CRITICAL'], + ['running', 'OK'], + ], + }; + + $self->{components_path} = 'network::alcatel::omniswitch::snmp::mode::components'; + $self->{components_module} = ['backplane', 'chassis', 'container', 'fan', 'module', 'other', 'port', 'psu', 'sensor', 'stack', 'unknown']; +} + +sub snmp_execute { + my ($self, %options) = @_; + + $self->{snmp} = $options{snmp}; + $self->{results} = $self->{snmp}->get_multiple_table(oids => [ + { oid => $oids{entPhysicalClass} }, + { oid => $oids{alaChasEntPhysFanStatus} }, + ]); + $self->{results}->{entity} = $self->{snmp}->get_multiple_table(oids => [ + { oid => $oids{entPhysicalDescr} }, + { oid => $oids{entPhysicalName} }, + { oid => $oids{chasEntPhysAdminStatus} }, + { oid => $oids{chasEntPhysOperStatus} }, + { oid => $oids{chasEntPhysPower} }, + ], return_type => 1); +} + +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; +} + +1; + +__END__ + +=head1 MODE + +Check status of alcatel hardware (AlcatelIND1Chassis.mib). + +=over 8 + +=item B<--component> + +Which component to check (Default: '.*'). +Can be: 'other', 'unknown', 'chassis', 'backplane', 'container', 'psu', 'fan', +'sensor', 'module', 'port, 'stack'. +Some not exists ;) + +=item B<--filter> + +Exclude some parts (comma seperated list) (Example: --filter=fan) +Can also exclude specific instance: --filter=fan,1.2 + +=item B<--no-component> + +Return an error if no compenents are checked. +If total (with skipped) is 0. (Default: 'critical' returns). + +=item B<--threshold-overload> + +Set to overload default threshold values (syntax: section,[instance,]status,regexp) +It used before default thresholds (order stays). +Example: --threshold-overload='psu.oper,CRITICAL,standby' + +=back + +=cut diff --git a/network/alcatel/common/mode/memory.pm b/network/alcatel/omniswitch/snmp/mode/memory.pm similarity index 99% rename from network/alcatel/common/mode/memory.pm rename to network/alcatel/omniswitch/snmp/mode/memory.pm index 7426eb43d..9176f3c18 100644 --- a/network/alcatel/common/mode/memory.pm +++ b/network/alcatel/omniswitch/snmp/mode/memory.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::common::mode::memory; +package network::alcatel::omniswitch::snmp::mode::memory; use base qw(centreon::plugins::mode); diff --git a/network/alcatel/omniswitch/6850/plugin.pm b/network/alcatel/omniswitch/snmp/plugin.pm similarity index 86% rename from network/alcatel/omniswitch/6850/plugin.pm rename to network/alcatel/omniswitch/snmp/plugin.pm index 1c5cefc60..aa3fbbbe5 100644 --- a/network/alcatel/omniswitch/6850/plugin.pm +++ b/network/alcatel/omniswitch/snmp/plugin.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::omniswitch::6850::plugin; +package network::alcatel::omniswitch::snmp::plugin; use strict; use warnings; @@ -29,14 +29,14 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $self->{version} = '0.5'; + $self->{version} = '0.1'; %{$self->{modes}} = ( - 'cpu' => 'network::alcatel::common::mode::cpu', - 'hardware' => 'network::alcatel::common::mode::hardware', + 'cpu' => 'network::alcatel::omniswitch::snmp::mode::cpu', + 'hardware' => 'network::alcatel::omniswitch::snmp::mode::hardware', 'interfaces' => 'snmp_standard::mode::interfaces', 'list-interfaces' => 'snmp_standard::mode::listinterfaces', - 'flash-memory' => 'network::alcatel::common::mode::flashmemory', - 'memory' => 'network::alcatel::common::mode::memory', + 'flash-memory' => 'network::alcatel::omniswitch::snmp::mode::flashmemory', + 'memory' => 'network::alcatel::omniswitch::snmp::mode::memory', 'spanning-tree' => 'snmp_standard::mode::spanningtree', ); @@ -49,6 +49,6 @@ __END__ =head1 PLUGIN DESCRIPTION -Check Alcatel Omniswitch 6850 in SNMP. +Check Alcatel Omniswitch in SNMP. =cut