| 1 |
# |
| 2 |
# Copyright 2024 Centreon (http://www.centreon.com/) |
| 3 |
# |
| 4 |
# Centreon is a full-fledged industry-strength solution that meets |
| 5 |
# the needs in IT infrastructure and application monitoring for |
| 6 |
# service performance. |
| 7 |
# |
| 8 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 |
# you may not use this file except in compliance with the License. |
| 10 |
# You may obtain a copy of the License at |
| 11 |
# |
| 12 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 13 |
# |
| 14 |
# Unless required by applicable law or agreed to in writing, software |
| 15 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 16 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 |
# See the License for the specific language governing permissions and |
| 18 |
# limitations under the License. |
| 19 |
# |
| 20 |
|
| 21 |
package network::alcatel::omniswitch::snmp::mode::hardware; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::hardware); |
| 24 |
use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids); |
| 25 |
|
| 26 |
sub set_system { |
| 27 |
my ($self, %options) = @_; |
| 28 |
|
| 29 |
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature)$'; |
| 30 |
|
| 31 |
$self->{cb_hook2} = 'snmp_execute'; |
| 32 |
|
| 33 |
$self->{thresholds} = { |
| 34 |
admin => [ |
| 35 |
['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'], |
| 36 |
['^(powerOff)$', 'CRITICAL'], |
| 37 |
['powerOn', 'OK'], |
| 38 |
['standby', 'OK'] |
| 39 |
], |
| 40 |
oper => [ |
| 41 |
['^(testing)$', 'WARNING'], |
| 42 |
['^(unpowered|down|notpresent)$', 'CRITICAL'], |
| 43 |
['up', 'OK'], |
| 44 |
['secondary', 'OK'], |
| 45 |
['master', 'OK'], |
| 46 |
['idle', 'OK'] |
| 47 |
], |
| 48 |
fan => [ |
| 49 |
['noStatus', 'OK'], |
| 50 |
['^notRunning$', 'CRITICAL'], |
| 51 |
['running', 'OK'] |
| 52 |
] |
| 53 |
}; |
| 54 |
|
| 55 |
$self->{components_path} = 'network::alcatel::omniswitch::snmp::mode::components'; |
| 56 |
$self->{components_module} = ['backplane', 'chassis', 'container', 'fan', 'module', 'other', 'port', 'psu', 'sensor', 'stack', 'unknown']; |
| 57 |
} |
| 58 |
|
| 59 |
sub snmp_execute { |
| 60 |
my ($self, %options) = @_; |
| 61 |
|
| 62 |
$self->{snmp} = $options{snmp}; |
| 63 |
|
| 64 |
my $versions = $self->{snmp}->get_leef( |
| 65 |
oids => [ $oids{aos6}->{version}, $oids{aos7}->{version} ] |
| 66 |
); |
| 67 |
|
| 68 |
$self->{type} = ''; |
| 69 |
if (defined($versions->{ $oids{aos6}->{version} })) { |
| 70 |
$self->{type} = 'aos6'; |
| 71 |
} elsif (defined($versions->{ $oids{aos7}->{version} })) { |
| 72 |
$self->{type} = 'aos7'; |
| 73 |
} |
| 74 |
|
| 75 |
if ($self->{type} eq 'aos6') { |
| 76 |
$self->{results} = $self->{snmp}->get_multiple_table( |
| 77 |
oids => [ |
| 78 |
{ oid => $oids{common}->{entPhysicalClass} }, |
| 79 |
{ oid => $oids{aos6}->{alaChasEntPhysFanStatus} } |
| 80 |
] |
| 81 |
); |
| 82 |
|
| 83 |
$self->{results}->{entity} = $self->{snmp}->get_multiple_table( |
| 84 |
oids => [ |
| 85 |
{ oid => $oids{common}->{entPhysicalDescr} }, |
| 86 |
{ oid => $oids{common}->{entPhysicalName} }, |
| 87 |
{ oid => $oids{aos6}->{chasPhysBase}, start => $oids{aos6}->{chasEntPhysAdminStatus}, end => $oids{aos6}->{chasEntPhysOperStatus} }, |
| 88 |
{ oid => $oids{aos6}->{chasEntPhysPower} }, |
| 89 |
{ oid => $oids{aos6}->{chasChassisEntry} } |
| 90 |
], |
| 91 |
return_type => 1 |
| 92 |
); |
| 93 |
} elsif ($self->{type} eq 'aos7') { |
| 94 |
$self->{results} = $self->{snmp}->get_multiple_table( |
| 95 |
oids => [ |
| 96 |
{ oid => $oids{common}->{entPhysicalClass} }, |
| 97 |
{ oid => $oids{aos7}->{alaChasEntPhysFanStatus} } |
| 98 |
] |
| 99 |
); |
| 100 |
|
| 101 |
$self->{results}->{entity} = $self->{snmp}->get_multiple_table( |
| 102 |
oids => [ |
| 103 |
{ oid => $oids{common}->{entPhysicalDescr} }, |
| 104 |
{ oid => $oids{common}->{entPhysicalName} }, |
| 105 |
{ oid => $oids{aos7}->{chasPhysBase}, start => $oids{aos7}->{chasEntPhysAdminStatus}, end => $oids{aos7}->{chasEntPhysPower} }, |
| 106 |
{ oid => $oids{aos7}->{chasChassisEntry} } |
| 107 |
], |
| 108 |
return_type => 1 |
| 109 |
); |
| 110 |
} |
| 111 |
} |
| 112 |
|
| 113 |
sub new { |
| 114 |
my ($class, %options) = @_; |
| 115 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); |
| 116 |
bless $self, $class; |
| 117 |
|
| 118 |
$options{options}->add_options(arguments => {}); |
| 119 |
|
| 120 |
return $self; |
| 121 |
} |
| 122 |
|
| 123 |
1; |
| 124 |
|
| 125 |
__END__ |
| 126 |
|
| 127 |
=head1 MODE |
| 128 |
|
| 129 |
Check status of alcatel hardware (AlcatelIND1Chassis.mib). |
| 130 |
|
| 131 |
=over 8 |
| 132 |
|
| 133 |
=item B<--component> |
| 134 |
|
| 135 |
Which component to check (default: '.*'). |
| 136 |
Can be: 'other', 'unknown', 'chassis', 'backplane', 'container', 'psu', 'fan', |
| 137 |
'sensor', 'module', 'port, 'stack'. |
| 138 |
Some not exists ;) |
| 139 |
|
| 140 |
=item B<--filter> |
| 141 |
|
| 142 |
Exclude the items given as a comma-separated list (example: --filter=fan). |
| 143 |
You can also exclude items from specific instances: --filter=fan,1.2 |
| 144 |
|
| 145 |
=item B<--no-component> |
| 146 |
|
| 147 |
Define the expected status if no components are found (default: critical). |
| 148 |
|
| 149 |
|
| 150 |
=item B<--threshold-overload> |
| 151 |
|
| 152 |
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). |
| 153 |
Example: --threshold-overload='psu.oper,CRITICAL,standby' |
| 154 |
|
| 155 |
=back |
| 156 |
|
| 157 |
=cut |