| 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::extreme::snmp::mode::hardware; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::hardware); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
|
| 28 |
sub set_system { |
| 29 |
my ($self, %options) = @_; |
| 30 |
|
| 31 |
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan|poe|psu\.power|psu\.fan)$'; |
| 32 |
|
| 33 |
$self->{cb_hook2} = 'snmp_execute'; |
| 34 |
|
| 35 |
$self->{thresholds} = { |
| 36 |
psu => [ |
| 37 |
['notPresent', 'OK'], |
| 38 |
['presentOK', 'OK'], |
| 39 |
['presentPowerOff', 'WARNING'], |
| 40 |
['presentNotOK', 'CRITICAL'], |
| 41 |
], |
| 42 |
fan => [ |
| 43 |
['not operational', 'CRITICAL'], |
| 44 |
['operational', 'OK'], |
| 45 |
], |
| 46 |
slot => [ |
| 47 |
['notPresent', 'OK'], |
| 48 |
['testing', 'OK'], |
| 49 |
['mismatch', 'WARNING'], |
| 50 |
['failed', 'CRITICAL'], |
| 51 |
['operational', 'OK'], |
| 52 |
['powerdown', 'WARNING'], |
| 53 |
['unknown', 'UNKNOWN'], |
| 54 |
['present', 'OK'], |
| 55 |
['poweron', 'OK'], |
| 56 |
['post', 'UNKNOWN'], |
| 57 |
['downloading', 'WARNING'], |
| 58 |
['booting', 'WARNING'], |
| 59 |
['offline', 'WARNING'], |
| 60 |
['initializing', 'OK'], |
| 61 |
['invalid', 'CRITICAL'], |
| 62 |
], |
| 63 |
poe => [ |
| 64 |
['initializing', 'OK'], |
| 65 |
['operational', 'OK'], |
| 66 |
['downloadFail', 'CRITICAL'], |
| 67 |
['calibrationRequired', 'CRITICAL'], |
| 68 |
['invalidFirmware', 'CRITICAL'], |
| 69 |
['mismatchVersion', 'CRITICAL'], |
| 70 |
['updating', 'OK'], |
| 71 |
['invalidDevice', 'CRITICAL'], |
| 72 |
['notOperational', 'CRITICAL'], |
| 73 |
['other', 'CRITICAL'], |
| 74 |
], |
| 75 |
}; |
| 76 |
|
| 77 |
$self->{components_path} = 'network::extreme::snmp::mode::components'; |
| 78 |
$self->{components_module} = ['fan', 'psu', 'slot', 'temperature', 'poe']; |
| 79 |
} |
| 80 |
|
| 81 |
sub snmp_execute { |
| 82 |
my ($self, %options) = @_; |
| 83 |
|
| 84 |
$self->{snmp} = $options{snmp}; |
| 85 |
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); |
| 86 |
} |
| 87 |
|
| 88 |
sub new { |
| 89 |
my ($class, %options) = @_; |
| 90 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options); |
| 91 |
bless $self, $class; |
| 92 |
|
| 93 |
$options{options}->add_options(arguments => {}); |
| 94 |
|
| 95 |
return $self; |
| 96 |
} |
| 97 |
|
| 98 |
1; |
| 99 |
|
| 100 |
__END__ |
| 101 |
|
| 102 |
=head1 MODE |
| 103 |
|
| 104 |
Check Hardware (Fans, Power Supplies, Slot, Temperature, POEs). |
| 105 |
|
| 106 |
=over 8 |
| 107 |
|
| 108 |
=item B<--component> |
| 109 |
|
| 110 |
Which component to check (default: '.*'). |
| 111 |
Can be: 'fan', 'psu', 'slot', 'temperature', 'poe'. |
| 112 |
|
| 113 |
=item B<--filter> |
| 114 |
|
| 115 |
Exclude the items given as a comma-separated list (example: --filter=fan --filter=psu). |
| 116 |
You can also exclude items from specific instances: --filter=fan,101 |
| 117 |
|
| 118 |
=item B<--absent-problem> |
| 119 |
|
| 120 |
Return an error if an entity is not 'present' (default is skipping) (comma separated list) |
| 121 |
Can be specific or global: --absent-problem=psu,1 |
| 122 |
|
| 123 |
=item B<--no-component> |
| 124 |
|
| 125 |
Define the expected status if no components are found (default: critical). |
| 126 |
|
| 127 |
|
| 128 |
=item B<--threshold-overload> |
| 129 |
|
| 130 |
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). |
| 131 |
Example: --threshold-overload='psu,CRITICAL,^(?!(presentOK)$)' |
| 132 |
|
| 133 |
=item B<--warning> |
| 134 |
|
| 135 |
Set warning threshold for 'temperature', 'fan', 'psu.fan', 'psu' (syntax: type,regexp,threshold) |
| 136 |
Example: --warning='psu.fan,1.1,5000' |
| 137 |
|
| 138 |
=item B<--critical> |
| 139 |
|
| 140 |
Set critical threshold for 'temperature', 'fan', 'psu.fan', 'psu' (syntax: type,regexp,threshold) |
| 141 |
Example: --critical='psu,.*,200' |
| 142 |
|
| 143 |
=back |
| 144 |
|
| 145 |
=cut |