| 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::cisco::firepower::fxos::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} = |
| 32 |
'^(?:(?:fanmodule|memoryunit|cpuunit|psu)\.temperature|fan\.speed|chassis\.(?:input|output)power)$'; |
| 33 |
|
| 34 |
$self->{cb_hook2} = 'snmp_execute'; |
| 35 |
|
| 36 |
$self->{thresholds} = { |
| 37 |
operability => [ |
| 38 |
['operable', 'OK'], |
| 39 |
['unknown', 'OK'], |
| 40 |
['inoperable', 'CRITICAL'], |
| 41 |
['degraded', 'WARNING'], |
| 42 |
['poweredOff', 'OK'], |
| 43 |
['powerProblem', 'CRITICAL'], |
| 44 |
['removed', 'OK'], |
| 45 |
['voltageProblem', 'CRITICAL'], |
| 46 |
['thermalProblem', 'CRITICAL'], |
| 47 |
['performanceProblem', 'CRITICAL'], |
| 48 |
['accessibilityProblem', 'WARNING'], |
| 49 |
['identityUnestablishable', 'CRITICAL'], |
| 50 |
['biosPostTimeout', 'CRITICAL'], |
| 51 |
['disabled', 'OK'], |
| 52 |
['malformedFru', 'CRITICAL'], |
| 53 |
['fabricConnProblem', 'WARNING'], |
| 54 |
['fabricUnsupportedConn', 'CRITICAL'], |
| 55 |
['config', 'OK'], |
| 56 |
['equipmentProblem', 'CRITICAL'], |
| 57 |
['decomissioning', 'OK'], |
| 58 |
['chassisLimitExceeded', 'WARNING'], |
| 59 |
['notSupported', 'WARNING'], |
| 60 |
['discovery', 'OK'], |
| 61 |
['discoveryFailed', 'WARNING'], |
| 62 |
['identify', 'OK'], |
| 63 |
['postFailure', 'WARNING'], |
| 64 |
['upgradeProblem', 'CRITICAL'], |
| 65 |
['peerCommProblem', 'CRITICAL'], |
| 66 |
['autoUpgrade', 'WARNING'], |
| 67 |
['linkActivateBlocked', 'WARNING'] |
| 68 |
] |
| 69 |
}; |
| 70 |
|
| 71 |
$self->{components_path} = 'network::cisco::firepower::fxos::snmp::mode::components'; |
| 72 |
$self->{components_module} = ['chassis', 'fan', 'fanmodule', 'psu', 'cpuunit', 'memoryunit']; |
| 73 |
} |
| 74 |
|
| 75 |
sub snmp_execute { |
| 76 |
my ($self, %options) = @_; |
| 77 |
|
| 78 |
$self->{snmp} = $options{snmp}; |
| 79 |
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); |
| 80 |
} |
| 81 |
|
| 82 |
sub new { |
| 83 |
my ($class, %options) = @_; |
| 84 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1); |
| 85 |
bless $self, $class; |
| 86 |
|
| 87 |
$options{options}->add_options(arguments => {}); |
| 88 |
|
| 89 |
return $self; |
| 90 |
} |
| 91 |
|
| 92 |
sub compare_dn { |
| 93 |
my ($self, %options) = @_; |
| 94 |
|
| 95 |
my $result_stats; |
| 96 |
foreach (%{$options{results}}) { |
| 97 |
next if (! /^$options{mapping}->{ $options{lookup} }->{oid}\.(.*)$/); |
| 98 |
my $instance = $1; |
| 99 |
if ($options{results}->{$_} =~ /$options{regexp}/) { |
| 100 |
$result_stats = $self->{snmp}->map_instance(mapping => $options{mapping}, results => $options{results}, instance => $instance); |
| 101 |
last; |
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
return $result_stats; |
| 106 |
} |
| 107 |
|
| 108 |
1; |
| 109 |
|
| 110 |
__END__ |
| 111 |
|
| 112 |
=head1 MODE |
| 113 |
|
| 114 |
Check hardware. |
| 115 |
|
| 116 |
=over 8 |
| 117 |
|
| 118 |
=item B<--component> |
| 119 |
|
| 120 |
Which component to check (default: '.*'). |
| 121 |
Can be: 'chassis', 'fan', 'fanmodule', 'psu', 'cpuunit', 'memoryunit'. |
| 122 |
|
| 123 |
=item B<--filter> |
| 124 |
|
| 125 |
Exclude the items given as a comma-separated list (example: --filter=fan). |
| 126 |
You can also exclude items from specific instances: --filter=fan,chassis-1 |
| 127 |
|
| 128 |
=item B<--no-component> |
| 129 |
|
| 130 |
Define the expected status if no components are found (default: critical). |
| 131 |
|
| 132 |
|
| 133 |
=item B<--threshold-overload> |
| 134 |
|
| 135 |
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). |
| 136 |
Example: --threshold-overload='fan,WARNING,removed' |
| 137 |
|
| 138 |
=item B<--warning> |
| 139 |
|
| 140 |
Set warning threshold (syntax: type,regexp,threshold) |
| 141 |
Example: --warning='temperature,.*,30' |
| 142 |
|
| 143 |
=item B<--critical> |
| 144 |
|
| 145 |
Set critical threshold (syntax: type,regexp,threshold) |
| 146 |
Example: --critical='temperature,.*,40' |
| 147 |
|
| 148 |
=back |
| 149 |
|
| 150 |
=cut |