| 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 hardware::server::ibm::bladecenter::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} = '^(blower|ambient|fanpack|chassisfan)$'; |
| 32 |
|
| 33 |
$self->{cb_hook2} = 'snmp_execute'; |
| 34 |
|
| 35 |
$self->{thresholds} = { |
| 36 |
chassisstatus => [ |
| 37 |
['testSucceeded', 'OK'], |
| 38 |
['testFailed', 'CRITICAL'], |
| 39 |
], |
| 40 |
systemhealth => [ |
| 41 |
['normal', 'OK'], |
| 42 |
['systemLevel', 'WARNING'], |
| 43 |
['nonCritical', 'WARNING'], |
| 44 |
['critical', 'CRITICAL'], |
| 45 |
], |
| 46 |
powermodule => [ |
| 47 |
['unknown', 'UNKNOWN'], |
| 48 |
['good', 'OK'], |
| 49 |
['warning', 'WARNING'], |
| 50 |
['notAvailable', 'UNKNOWN'], |
| 51 |
], |
| 52 |
fanpack => [ |
| 53 |
['unknown', 'UNKNOWN'], |
| 54 |
['good', 'OK'], |
| 55 |
['warning', 'WARNING'], |
| 56 |
['bad', 'CRITICAL'], |
| 57 |
], |
| 58 |
chassisfan => [ |
| 59 |
['unknown', 'UNKNOWN'], |
| 60 |
['good', 'OK'], |
| 61 |
['warning', 'WARNING'], |
| 62 |
['bad', 'CRITICAL'], |
| 63 |
], |
| 64 |
blower => [ |
| 65 |
['unknown', 'UNKNOWN'], |
| 66 |
['good', 'OK'], |
| 67 |
['warning', 'WARNING'], |
| 68 |
['bad', 'CRITICAL'], |
| 69 |
], |
| 70 |
switchmodule => [ |
| 71 |
['unknown', 'UNKNOWN'], |
| 72 |
['good', 'OK'], |
| 73 |
['warning', 'WARNING'], |
| 74 |
['bad', 'CRITICAL'], |
| 75 |
], |
| 76 |
blowerctrl => [ |
| 77 |
['unknown', 'UNKNOWN'], |
| 78 |
['operational', 'OK'], |
| 79 |
['flashing', 'WARNING'], |
| 80 |
['communicationError', 'CRITICAL'], |
| 81 |
['notPresent', 'UNKNOWN'], |
| 82 |
], |
| 83 |
blade => [ |
| 84 |
['unknown', 'UNKNOWN'], |
| 85 |
['good', 'OK'], |
| 86 |
['warning', 'WARNING'], |
| 87 |
['critical', 'CRITICAL'], |
| 88 |
['kernelMode', 'WARNING'], |
| 89 |
['discovering', 'WARNING'], |
| 90 |
['commError', 'CRITICAL'], |
| 91 |
['noPower', 'WARNING'], |
| 92 |
['flashing', 'WARNING'], |
| 93 |
['initFailure', 'CRITICAL'], |
| 94 |
['insufficientPower', 'CRITICAL'], |
| 95 |
['powerDenied', 'CRITICAL'], |
| 96 |
], |
| 97 |
}; |
| 98 |
|
| 99 |
$self->{components_path} = 'hardware::server::ibm::bladecenter::snmp::mode::components'; |
| 100 |
$self->{components_module} = ['ambient', 'powermodule', 'blade', 'blower', 'fanpack', 'chassisfan', 'systemhealth', 'chassisstatus', 'switchmodule']; |
| 101 |
} |
| 102 |
|
| 103 |
sub snmp_execute { |
| 104 |
my ($self, %options) = @_; |
| 105 |
|
| 106 |
$self->{snmp} = $options{snmp}; |
| 107 |
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); |
| 108 |
} |
| 109 |
|
| 110 |
sub new { |
| 111 |
my ($class, %options) = @_; |
| 112 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options); |
| 113 |
bless $self, $class; |
| 114 |
|
| 115 |
$options{options}->add_options(arguments => |
| 116 |
{ |
| 117 |
}); |
| 118 |
|
| 119 |
return $self; |
| 120 |
} |
| 121 |
|
| 122 |
1; |
| 123 |
|
| 124 |
__END__ |
| 125 |
|
| 126 |
=head1 MODE |
| 127 |
|
| 128 |
Check Hardware (Ambient temperatures, Blowers, Power modules, Blades, System Health, Chassis status, Fanpack). |
| 129 |
|
| 130 |
=over 8 |
| 131 |
|
| 132 |
=item B<--component> |
| 133 |
|
| 134 |
Which component to check (default: 'all'). |
| 135 |
Can be: 'ambient', 'powermodule', 'fanpack', 'chassisfan', |
| 136 |
'blower', 'blade', 'systemhealth', 'chassisstatus', 'switchmodule'. |
| 137 |
|
| 138 |
=item B<--filter> |
| 139 |
|
| 140 |
Exclude the items given as a comma-separated list (example: --filter=blower --filter=powermodule). |
| 141 |
You can also exclude items from specific instances: --filter=blower,1 |
| 142 |
|
| 143 |
=item B<--absent-problem> |
| 144 |
|
| 145 |
Return an error if an entity is not 'notAvailable' (default is skipping) (comma separated list) |
| 146 |
Can be specific or global: --absent-problem=powermodule,2 |
| 147 |
|
| 148 |
=item B<--no-component> |
| 149 |
|
| 150 |
Define the expected status if no components are found (default: critical). |
| 151 |
|
| 152 |
=item B<--threshold-overload> |
| 153 |
|
| 154 |
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). |
| 155 |
Example: --threshold-overload='blade,OK,unknown' |
| 156 |
|
| 157 |
=item B<--warning> |
| 158 |
|
| 159 |
Set warning threshold (syntax: type,regexp,threshold) |
| 160 |
Example: --warning='ambient,mm,30' --warning='ambient,frontpanel,35' |
| 161 |
|
| 162 |
=item B<--critical> |
| 163 |
|
| 164 |
Set critical threshold (syntax: type,regexp,threshold) |
| 165 |
Example: --critical='blower,1,50' |
| 166 |
|
| 167 |
=back |
| 168 |
|
| 169 |
=cut |