| 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::dell::openmanage::snmp::mode::hardware; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::hardware); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
use centreon::plugins::misc; |
| 28 |
|
| 29 |
sub set_system { |
| 30 |
my ($self, %options) = @_; |
| 31 |
|
| 32 |
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan|psu\.power)$'; |
| 33 |
|
| 34 |
$self->{cb_hook2} = 'snmp_execute'; |
| 35 |
|
| 36 |
$self->{thresholds} = { |
| 37 |
default => [ |
| 38 |
['other', 'CRITICAL'], |
| 39 |
['unknown', 'UNKNOWN'], |
| 40 |
['ok', 'OK'], |
| 41 |
['nonCritical', 'WARNING'], # nonCriticalUpper # nonCriticalLower |
| 42 |
['critical', 'CRITICAL'], # criticalUpper |
| 43 |
['nonRecoverable', 'CRITICAL'], # nonRecoverableUpper # nonRecoverableLower |
| 44 |
['failed', 'CRITICAL'] |
| 45 |
], |
| 46 |
physicaldisk_smartalert => [ |
| 47 |
['yes', 'WARNING'], |
| 48 |
['no', 'OK'] |
| 49 |
] |
| 50 |
}; |
| 51 |
|
| 52 |
$self->{components_path} = 'hardware::server::dell::openmanage::snmp::mode::components'; |
| 53 |
$self->{components_module} = [ |
| 54 |
'globalstatus', 'fan', 'psu', 'temperature', 'cpu', 'cachebattery', 'memory', |
| 55 |
'physicaldisk', 'logicaldrive', 'esmlog', 'battery', 'controller', 'connector' |
| 56 |
]; |
| 57 |
} |
| 58 |
|
| 59 |
sub snmp_execute { |
| 60 |
my ($self, %options) = @_; |
| 61 |
|
| 62 |
# In '10892-MIB' |
| 63 |
my $oid_chassisModelName = '.1.3.6.1.4.1.674.10892.1.300.10.1.9'; |
| 64 |
|
| 65 |
$self->{snmp} = $options{snmp}; |
| 66 |
push @{$self->{request}}, { oid => $oid_chassisModelName }; |
| 67 |
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); |
| 68 |
|
| 69 |
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_chassisModelName}})) { |
| 70 |
my $name = defined($self->{results}->{$oid_chassisModelName}->{$oid}) ? |
| 71 |
centreon::plugins::misc::trim($self->{results}->{$oid_chassisModelName}->{$oid}) : 'unknown'; |
| 72 |
$self->{output}->output_add(long_msg => sprintf("Product Name: %s", $name)); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
sub new { |
| 77 |
my ($class, %options) = @_; |
| 78 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options); |
| 79 |
bless $self, $class; |
| 80 |
|
| 81 |
$options{options}->add_options(arguments => {}); |
| 82 |
|
| 83 |
return $self; |
| 84 |
} |
| 85 |
|
| 86 |
1; |
| 87 |
|
| 88 |
__END__ |
| 89 |
|
| 90 |
=head1 MODE |
| 91 |
|
| 92 |
Check Hardware (Global status, Fans, CPUs, Power Supplies, Temperature, Storage). |
| 93 |
|
| 94 |
=over 8 |
| 95 |
|
| 96 |
=item B<--component> |
| 97 |
|
| 98 |
Which component to check (default: '.*'). |
| 99 |
Can be: 'globalstatus', 'fan', 'cpu', 'psu', 'temperature', 'cachebattery', |
| 100 |
'physicaldisk', 'logicaldrive', 'battery', 'controller', 'connector'. |
| 101 |
|
| 102 |
=item B<--filter> |
| 103 |
|
| 104 |
Exclude the items given as a comma-separated list (example: --filter=fan). |
| 105 |
You can also exclude items from specific instances: --filter=fan,1 |
| 106 |
|
| 107 |
=item B<--no-component> |
| 108 |
|
| 109 |
Define the expected status if no components are found (default: critical). |
| 110 |
|
| 111 |
=item B<--threshold-overload> |
| 112 |
|
| 113 |
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,status,regexp). |
| 114 |
Example: --threshold-overload='temperature,CRITICAL,^(?!(ok)$)' |
| 115 |
|
| 116 |
=item B<--warning> |
| 117 |
|
| 118 |
Set warning threshold for temperature, psu.power or fan (syntax: type,regexp,threshold) |
| 119 |
Example: --warning='temperature,.*,30' |
| 120 |
|
| 121 |
=item B<--critical> |
| 122 |
|
| 123 |
Set critical threshold for temperature, psu.power or fan (syntax: type,regexp,threshold) |
| 124 |
Example: --critical='temperature,.*,40' |
| 125 |
|
| 126 |
=back |
| 127 |
|
| 128 |
=cut |
| 129 |
|