| 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::umbrella::snmp::mode::appliance; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::counter); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); |
| 28 |
|
| 29 |
sub custom_status_output { |
| 30 |
my ($self, %options) = @_; |
| 31 |
|
| 32 |
return "'Virtual Appliance health: " . $self->{result_values}->{status} . "' "; |
| 33 |
} |
| 34 |
|
| 35 |
sub set_counters { |
| 36 |
my ($self, %options) = @_; |
| 37 |
|
| 38 |
$self->{maps_counters_type} = [ |
| 39 |
{ name => 'global', type => 0 } |
| 40 |
]; |
| 41 |
|
| 42 |
$self->{maps_counters}->{global} = [ |
| 43 |
{ |
| 44 |
label => 'status', type => 2, |
| 45 |
critical_default => '%{status} =~ /red/' , |
| 46 |
warning_default => '%{status} =~ /yellow/', |
| 47 |
unknown_default => '%{status} !~ /(green|yellow|red|white)/', |
| 48 |
set => { |
| 49 |
key_values => [ { name => 'status' } ], |
| 50 |
closure_custom_output => $self->can('custom_status_output'), |
| 51 |
closure_custom_perfdata => sub { return 0; }, |
| 52 |
closure_custom_threshold_check => \&catalog_status_threshold_ng |
| 53 |
} |
| 54 |
} |
| 55 |
]; |
| 56 |
} |
| 57 |
|
| 58 |
sub new { |
| 59 |
my ($class, %options) = @_; |
| 60 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options); |
| 61 |
bless $self, $class; |
| 62 |
|
| 63 |
$options{options}->add_options(arguments => { }); |
| 64 |
|
| 65 |
return $self; |
| 66 |
} |
| 67 |
|
| 68 |
sub manage_selection { |
| 69 |
my ($self, %options) = @_; |
| 70 |
|
| 71 |
my $oid_AVstatus = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.116.104.105.115.100.110.115.1'; |
| 72 |
my $result = $options{snmp}->get_leef( |
| 73 |
oids => [ $oid_AVstatus ], |
| 74 |
nothing_quit => 1 |
| 75 |
); |
| 76 |
|
| 77 |
my $status_output = $result->{$oid_AVstatus}; |
| 78 |
$self->{global} = { status => 'unknown' }; |
| 79 |
if ($status_output =~ /\((.*?)\)/){ |
| 80 |
$self->{global} = { status => $1 }; |
| 81 |
} |
| 82 |
|
| 83 |
} |
| 84 |
|
| 85 |
1; |
| 86 |
|
| 87 |
__END__ |
| 88 |
|
| 89 |
=head1 MODE |
| 90 |
|
| 91 |
Check VA health. |
| 92 |
|
| 93 |
=over 8 |
| 94 |
|
| 95 |
=item B<--warning-status> |
| 96 |
|
| 97 |
Define the conditions to match for the status to be WARNING. (default: '%{status} =~ /yellow/') |
| 98 |
You can use the following variables: %{status} |
| 99 |
|
| 100 |
=item B<--critical-status> |
| 101 |
|
| 102 |
Define the conditions to match for the status to be CRITICAL. (default: '%{status} =~ /red/'). |
| 103 |
You can use the following variables: %{status} |
| 104 |
|
| 105 |
=back |
| 106 |
|
| 107 |
=cut |