| 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::citrix::netscaler::snmp::mode::connections; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::counter); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
|
| 28 |
sub set_counters { |
| 29 |
my ($self, %options) = @_; |
| 30 |
|
| 31 |
$self->{maps_counters_type} = [ |
| 32 |
{ name => 'global', type => 0, message_separator => ' - ' } |
| 33 |
]; |
| 34 |
|
| 35 |
$self->{maps_counters}->{global} = [ |
| 36 |
{ label => 'active', nlabel => 'connections.server.active.count', set => { |
| 37 |
key_values => [ { name => 'active' } ], |
| 38 |
output_template => 'Active Server TCP connections: %s', |
| 39 |
perfdatas => [ |
| 40 |
{ label => 'active_server', template => '%s', unit => 'con', min => 0 } |
| 41 |
] |
| 42 |
} |
| 43 |
}, |
| 44 |
{ label => 'established', nlabel => 'connections.server.established.count', set => { |
| 45 |
key_values => [ { name => 'established' } ], |
| 46 |
output_template => 'Established Server TCP connections: %s', |
| 47 |
perfdatas => [ |
| 48 |
{ label => 'established_server', template => '%s', unit => 'con', min => 0 } |
| 49 |
] |
| 50 |
} |
| 51 |
}, |
| 52 |
{ label => 'server', nlabel => 'connections.server.count', set => { |
| 53 |
key_values => [ { name => 'server' } ], |
| 54 |
output_template => 'Server TCP connections: %s', |
| 55 |
perfdatas => [ |
| 56 |
{ label => 'server', template => '%s', unit => 'con', min => 0 } |
| 57 |
] |
| 58 |
} |
| 59 |
}, |
| 60 |
{ label => 'client', nlabel => 'connections.client.count', set => { |
| 61 |
key_values => [ { name => 'client' } ], |
| 62 |
output_template => 'Client TCP connections: %s', |
| 63 |
perfdatas => [ |
| 64 |
{ label => 'client', template => '%s', unit => 'con', min => 0 } |
| 65 |
] |
| 66 |
} |
| 67 |
} |
| 68 |
]; |
| 69 |
} |
| 70 |
|
| 71 |
sub new { |
| 72 |
my ($class, %options) = @_; |
| 73 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options); |
| 74 |
bless $self, $class; |
| 75 |
|
| 76 |
$options{options}->add_options(arguments => { |
| 77 |
}); |
| 78 |
|
| 79 |
return $self; |
| 80 |
} |
| 81 |
|
| 82 |
sub manage_selection { |
| 83 |
my ($self, %options) = @_; |
| 84 |
|
| 85 |
$self->{global} = { client => 0, server => 0, active => 0 }; |
| 86 |
my $oid_tcpCurServerConn = '.1.3.6.1.4.1.5951.4.1.1.46.1.0'; |
| 87 |
my $oid_tcpCurServerConnEstablished = '.1.3.6.1.4.1.5951.4.1.1.46.10.0'; |
| 88 |
my $oid_tcpCurClientConn = '.1.3.6.1.4.1.5951.4.1.1.46.2.0'; |
| 89 |
my $oid_tcpActiveServerConn = '.1.3.6.1.4.1.5951.4.1.1.46.8.0'; |
| 90 |
my $result = $options{snmp}->get_leef(oids => [$oid_tcpCurServerConn, $oid_tcpCurServerConnEstablished, $oid_tcpCurClientConn, $oid_tcpActiveServerConn ], nothing_quit => 1); |
| 91 |
$self->{global}->{client} = $result->{$oid_tcpCurClientConn}; |
| 92 |
$self->{global}->{established} = $result->{$oid_tcpCurServerConnEstablished}; |
| 93 |
$self->{global}->{server} = $result->{$oid_tcpCurServerConn}; |
| 94 |
$self->{global}->{active} = $result->{$oid_tcpActiveServerConn}; |
| 95 |
} |
| 96 |
|
| 97 |
1; |
| 98 |
|
| 99 |
__END__ |
| 100 |
|
| 101 |
=head1 MODE |
| 102 |
|
| 103 |
Check connections usage (Client, Server, ActiveServer) (NS-ROOT-MIBv2). |
| 104 |
|
| 105 |
=over 8 |
| 106 |
|
| 107 |
=item B<--warning-*> |
| 108 |
|
| 109 |
Warning threshold. |
| 110 |
Can be: 'server', 'active', 'client', 'established'. |
| 111 |
|
| 112 |
=item B<--critical-*> |
| 113 |
|
| 114 |
Critical threshold. |
| 115 |
Can be: 'server', 'active', 'client', 'established'. |
| 116 |
|
| 117 |
=back |
| 118 |
|
| 119 |
=cut |