| 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 storage::netapp::ontap::snmp::mode::sharecalls; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::counter); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
use Digest::MD5 qw(md5_hex); |
| 28 |
|
| 29 |
sub set_counters { |
| 30 |
my ($self, %options) = @_; |
| 31 |
|
| 32 |
$self->{maps_counters_type} = [ |
| 33 |
{ name => 'global', type => 0, skipped_code => { -10 => 1 } } |
| 34 |
]; |
| 35 |
|
| 36 |
$self->{maps_counters}->{global} = [ |
| 37 |
{ label => 'cifs', nlabel => 'storage.cifs.calls.persecond', set => { |
| 38 |
key_values => [ { name => 'cifs', per_second => 1 } ], |
| 39 |
output_template => 'CIFS : %s calls/s', |
| 40 |
perfdatas => [ |
| 41 |
{ template => '%d', min => 0 } |
| 42 |
] |
| 43 |
} |
| 44 |
}, |
| 45 |
{ label => 'nfs', nlabel => 'storage.nfs.calls.persecond', set => { |
| 46 |
key_values => [ { name => 'nfs', per_second => 1 } ], |
| 47 |
output_template => 'NFS : %s calls/s', |
| 48 |
perfdatas => [ |
| 49 |
{ template => '%d', min => 0 } |
| 50 |
] |
| 51 |
} |
| 52 |
} |
| 53 |
]; |
| 54 |
} |
| 55 |
|
| 56 |
sub new { |
| 57 |
my ($class, %options) = @_; |
| 58 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); |
| 59 |
bless $self, $class; |
| 60 |
|
| 61 |
$options{options}->add_options(arguments => { |
| 62 |
}); |
| 63 |
|
| 64 |
return $self; |
| 65 |
} |
| 66 |
|
| 67 |
my $oid_miscHighNfsOps = '.1.3.6.1.4.1.789.1.2.2.5.0'; |
| 68 |
my $oid_miscLowNfsOps = '.1.3.6.1.4.1.789.1.2.2.6.0'; |
| 69 |
my $oid_miscHighCifsOps = '.1.3.6.1.4.1.789.1.2.2.7.0'; |
| 70 |
my $oid_miscLowCifsOps = '.1.3.6.1.4.1.789.1.2.2.8.0'; |
| 71 |
my $oid_misc64NfsOps = '.1.3.6.1.4.1.789.1.2.2.27.0'; |
| 72 |
my $oid_misc64CifsOps = '.1.3.6.1.4.1.789.1.2.2.28.0'; |
| 73 |
|
| 74 |
sub manage_selection { |
| 75 |
my ($self, %options) = @_; |
| 76 |
|
| 77 |
my $request = [ |
| 78 |
$oid_miscHighNfsOps, $oid_miscLowNfsOps, |
| 79 |
$oid_miscHighCifsOps, $oid_miscLowCifsOps |
| 80 |
]; |
| 81 |
if (!$options{snmp}->is_snmpv1()) { |
| 82 |
push @{$request}, ($oid_misc64NfsOps, $oid_misc64CifsOps); |
| 83 |
} |
| 84 |
|
| 85 |
my $snmp_result = $options{snmp}->get_leef(oids => $request, nothing_quit => 1); |
| 86 |
|
| 87 |
$self->{global} = {}; |
| 88 |
$self->{global}->{cifs} = defined($snmp_result->{$oid_misc64CifsOps}) ? |
| 89 |
$snmp_result->{$oid_misc64CifsOps} : |
| 90 |
($snmp_result->{$oid_miscHighCifsOps} << 32) + $snmp_result->{$oid_miscLowCifsOps}; |
| 91 |
$self->{global}->{nfs} = defined($snmp_result->{$oid_misc64NfsOps}) ? |
| 92 |
$snmp_result->{$oid_misc64NfsOps} : |
| 93 |
($snmp_result->{$oid_miscHighNfsOps} << 32) + $snmp_result->{$oid_miscLowNfsOps}; |
| 94 |
|
| 95 |
$self->{cache_name} = "cache_netapp_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' . |
| 96 |
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); |
| 97 |
} |
| 98 |
|
| 99 |
1; |
| 100 |
|
| 101 |
__END__ |
| 102 |
|
| 103 |
=head1 MODE |
| 104 |
|
| 105 |
Check cifs and nfs calls per seconds. |
| 106 |
If you are in cluster mode, the following mode doesn't work. Ask to netapp to add it :) |
| 107 |
|
| 108 |
=over 8 |
| 109 |
|
| 110 |
=item B<--warning-*> |
| 111 |
|
| 112 |
Warning threshold. |
| 113 |
Can be: 'cifs', 'nfs'. |
| 114 |
|
| 115 |
=item B<--critical-*> |
| 116 |
|
| 117 |
Critical threshold. |
| 118 |
Can be: 'cifs', 'nfs'. |
| 119 |
|
| 120 |
=back |
| 121 |
|
| 122 |
=cut |
| 123 |
|