| 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::violin::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)$'; |
| 32 |
|
| 33 |
$self->{cb_hook2} = 'snmp_execute'; |
| 34 |
|
| 35 |
$self->{thresholds} = { |
| 36 |
vimm => [ |
| 37 |
['not failed', 'OK'], |
| 38 |
['failed', 'CRITICAL'], |
| 39 |
], |
| 40 |
ca => [ |
| 41 |
['ON', 'CRITICAL'], |
| 42 |
['OFF', 'OK'], |
| 43 |
], |
| 44 |
psu => [ |
| 45 |
['OFF', 'CRITICAL'], |
| 46 |
['Absent', 'OK'], |
| 47 |
['ON', 'OK'], |
| 48 |
], |
| 49 |
fan => [ |
| 50 |
['OFF', 'CRITICAL'], |
| 51 |
['Absent', 'OK'], |
| 52 |
['Low', 'OK'], |
| 53 |
['Medium', 'OK'], |
| 54 |
['High', 'WARNING'], |
| 55 |
], |
| 56 |
gfc => [ |
| 57 |
['Online', 'OK'], |
| 58 |
['Unconfigured', 'OK'], |
| 59 |
['Unknown', 'UNKNOWN'], |
| 60 |
['Not\s*Supported', 'WARNING'], |
| 61 |
['Dead', 'CRITICAL'], |
| 62 |
['Lost', 'CRITICAL'], |
| 63 |
['Failover\s*Failed', 'CRITICAL'], |
| 64 |
['Failover', 'WARNING'], |
| 65 |
], |
| 66 |
lfc => [ |
| 67 |
['Online', 'OK'], |
| 68 |
['Unconfigured', 'OK'], |
| 69 |
['Unknown', 'UNKNOWN'], |
| 70 |
['Not\s*Supported', 'WARNING'], |
| 71 |
['Dead', 'CRITICAL'], |
| 72 |
['Lost', 'CRITICAL'], |
| 73 |
['Failover\s*Failed', 'CRITICAL'], |
| 74 |
['Failover', 'WARNING'], |
| 75 |
], |
| 76 |
}; |
| 77 |
|
| 78 |
$self->{components_path} = 'centreon::common::violin::snmp::mode::components'; |
| 79 |
$self->{components_module} = ['ca', 'psu', 'fan', 'vimm', 'temperature', 'gfc', 'lfc']; |
| 80 |
} |
| 81 |
|
| 82 |
sub snmp_execute { |
| 83 |
my ($self, %options) = @_; |
| 84 |
|
| 85 |
$self->{snmp} = $options{snmp}; |
| 86 |
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); |
| 87 |
} |
| 88 |
|
| 89 |
sub new { |
| 90 |
my ($class, %options) = @_; |
| 91 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options); |
| 92 |
bless $self, $class; |
| 93 |
|
| 94 |
$options{options}->add_options(arguments => { |
| 95 |
}); |
| 96 |
|
| 97 |
return $self; |
| 98 |
} |
| 99 |
|
| 100 |
sub convert_index { |
| 101 |
my ($self, %options) = @_; |
| 102 |
|
| 103 |
my @results = (); |
| 104 |
my $separator = 32; |
| 105 |
my $result = ''; |
| 106 |
foreach (split /\./, $options{value}) { |
| 107 |
if ($_ < $separator) { |
| 108 |
push @results, $result; |
| 109 |
$result = ''; |
| 110 |
} else { |
| 111 |
$result .= chr; |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
push @results, $result; |
| 116 |
return @results; |
| 117 |
} |
| 118 |
|
| 119 |
1; |
| 120 |
|
| 121 |
__END__ |
| 122 |
|
| 123 |
=head1 MODE |
| 124 |
|
| 125 |
Check components (Fans, Power Supplies, Temperatures, Chassis alarm, vimm, global fc, local fc). |
| 126 |
|
| 127 |
=over 8 |
| 128 |
|
| 129 |
=item B<--component> |
| 130 |
|
| 131 |
Which component to check (default: '.*'). |
| 132 |
Can be: 'psu', 'fan', 'ca', 'vimm', 'lfc', 'gfc', 'temperature'. |
| 133 |
|
| 134 |
=item B<--filter> |
| 135 |
|
| 136 |
Exclude the items given as a comma-separated list (example: --filter=fan --filter=psu). |
| 137 |
You can also exclude items from specific instances: --filter=fan,41239F00647-A |
| 138 |
|
| 139 |
=item B<--absent-problem> |
| 140 |
|
| 141 |
Return an error if an entity is not 'present' (default is skipping) (comma separated list) |
| 142 |
Can be specific or global: --absent-problem=fan,41239F00647-fan02 |
| 143 |
|
| 144 |
=item B<--no-component> |
| 145 |
|
| 146 |
Define the expected status if no components are found (default: critical). |
| 147 |
|
| 148 |
|
| 149 |
=item B<--threshold-overload> |
| 150 |
|
| 151 |
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). |
| 152 |
Example: --threshold-overload='gfc,CRITICAL,^(?!(Online)$)' |
| 153 |
|
| 154 |
=item B<--warning> |
| 155 |
|
| 156 |
Set warning threshold for temperatures (syntax: type,regexp,threshold) |
| 157 |
Example: --warning='temperature,41239F00647-vimm46,20' --warning='temperature,41239F00647-vimm5.*,30' |
| 158 |
|
| 159 |
=item B<--critical> |
| 160 |
|
| 161 |
Set critical threshold for temperatures (syntax: type,regexp,threshold) |
| 162 |
Example: --critical='temperature,.*,25' --warning='temperature,.*,35' |
| 163 |
|
| 164 |
=back |
| 165 |
|
| 166 |
=cut |
| 167 |
|