| 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 centreon::common::bluearc::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)$'; |
| 32 |
|
| 33 |
$self->{cb_hook2} = 'snmp_execute'; |
| 34 |
|
| 35 |
$self->{thresholds} = { |
| 36 |
psu => [ |
| 37 |
['ok', 'OK'], |
| 38 |
['failed', 'CRITICAL'], |
| 39 |
['notFitted', 'WARNING'], |
| 40 |
['unknown', 'UNKNOWN'] |
| 41 |
], |
| 42 |
'fan.speed' => [ |
| 43 |
['ok', 'OK'], |
| 44 |
['warning', 'WARNING'], |
| 45 |
['severe', 'CRITICAL'], |
| 46 |
['unknown', 'UNKNOWN'] |
| 47 |
], |
| 48 |
temperature => [ |
| 49 |
['ok', 'OK'], |
| 50 |
['tempWarning', 'WARNING'], |
| 51 |
['tempSevere', 'CRITICAL'], |
| 52 |
['tempSensorFailed', 'CRITICAL'], |
| 53 |
['tempSensorWarning', 'CRITICAL'], |
| 54 |
['unknown', 'UNKNOWN'] |
| 55 |
], |
| 56 |
sysdrive => [ |
| 57 |
['online', 'OK'], |
| 58 |
['corrupt', 'WARNING'], |
| 59 |
['failed', 'CRITICAL'], |
| 60 |
['notPresent', 'OK'], |
| 61 |
['disconnected', 'WARNING'], |
| 62 |
['offline', 'OK'], |
| 63 |
['initializing', 'OK'], |
| 64 |
['formatting', 'OK'], |
| 65 |
['unknown', 'UNKNOWN'] |
| 66 |
], |
| 67 |
battery => [ |
| 68 |
['ok', 'OK'], |
| 69 |
['fault', 'CRITICAL'], |
| 70 |
['notFitted', 'WARNING'], |
| 71 |
['initializing', 'OK'], |
| 72 |
['normalCharging', 'OK'], |
| 73 |
['discharged', 'CRITICAL'], |
| 74 |
['cellTesting', 'OK'], |
| 75 |
['notResponding', 'CRITICAL'], |
| 76 |
['low', 'WARNING'], |
| 77 |
['veryLow', 'CRITICAL'], |
| 78 |
['ignore', 'UNKNOWN'] |
| 79 |
] |
| 80 |
}; |
| 81 |
|
| 82 |
$self->{components_path} = 'centreon::common::bluearc::snmp::mode::components'; |
| 83 |
$self->{components_module} = ['temperature', 'fan', 'psu', 'sysdrive', 'battery' ]; |
| 84 |
} |
| 85 |
|
| 86 |
sub snmp_execute { |
| 87 |
my ($self, %options) = @_; |
| 88 |
|
| 89 |
my $oid_clusterPNodeName = '.1.3.6.1.4.1.11096.6.1.1.1.2.5.9.1.2'; |
| 90 |
push @{$self->{request}}, { oid => $oid_clusterPNodeName }; |
| 91 |
|
| 92 |
$self->{snmp} = $options{snmp}; |
| 93 |
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); |
| 94 |
|
| 95 |
$self->{pnodes} = {}; |
| 96 |
foreach (keys %{$self->{results}->{$oid_clusterPNodeName}}) { |
| 97 |
/^$oid_clusterPNodeName\.(.*)$/; |
| 98 |
$self->{pnodes}->{$1} = $self->{results}->{$oid_clusterPNodeName}->{$_}; |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
sub new { |
| 103 |
my ($class, %options) = @_; |
| 104 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1); |
| 105 |
bless $self, $class; |
| 106 |
|
| 107 |
$options{options}->add_options(arguments => {}); |
| 108 |
|
| 109 |
return $self; |
| 110 |
} |
| 111 |
|
| 112 |
1; |
| 113 |
|
| 114 |
__END__ |
| 115 |
|
| 116 |
=head1 MODE |
| 117 |
|
| 118 |
Check Hardware. |
| 119 |
|
| 120 |
=over 8 |
| 121 |
|
| 122 |
=item B<--component> |
| 123 |
|
| 124 |
Which component to check (default: '.*'). |
| 125 |
Can be: 'temperature', 'fan', 'psu', 'sysdrive', 'battery'. |
| 126 |
|
| 127 |
=item B<--filter> |
| 128 |
|
| 129 |
Exclude the items given as a comma-separated list (example: --filter=sysdrive). |
| 130 |
You can also exclude items from specific instances: --filter=sysdrive,1 |
| 131 |
|
| 132 |
=item B<--no-component> |
| 133 |
|
| 134 |
Define the expected status if no components are found (default: critical). |
| 135 |
|
| 136 |
|
| 137 |
=item B<--threshold-overload> |
| 138 |
|
| 139 |
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). |
| 140 |
Example: --threshold-overload='sysdrive,OK,formatting' |
| 141 |
|
| 142 |
=item B<--warning> |
| 143 |
|
| 144 |
Set warning threshold (syntax: type,regexp,threshold) |
| 145 |
Example: --warning='temperature,.*,30' |
| 146 |
|
| 147 |
=item B<--critical> |
| 148 |
|
| 149 |
Set critical threshold (syntax: type,regexp,threshold) |
| 150 |
Example: --critical='temperature,.*,40' |
| 151 |
|
| 152 |
=back |
| 153 |
|
| 154 |
=cut |