Debian Codegraph @

src/hardware/devices/polycom/hdx/snmp/mode/viewstationstats.pm

raw
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::devices::polycom::hdx::snmp::mode::viewstationstats;
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, cb_prefix_output => 'prefix_global_output' }
33 ];
34
35 $self->{maps_counters}->{global} = [
36 { label => 'h323-packet-loss', nlabel => 'viewstation.h323.packet.loss.percentage', set => {
37 key_values => [ { name => 'polycomVSPercentPacketLoss' } ],
38 output_template => 'H323 Packet Loss %.2f %%',
39 perfdatas => [
40 { template => '%.2f', min => 0, max => 100, unit => '%' }
41 ]
42 }
43 },
44 { label => 'h323-jitter', nlabel => 'viewstation.h323.jitter.milliseconds', set => {
45 key_values => [ { name => 'polycomVSJitter' } ],
46 output_template => 'H323 (audio/video) Jitter %.2f ms',
47 perfdatas => [
48 { template => '%.2f', min => 0, unit => 'ms' }
49 ]
50 }
51 },
52 { label => 'h323-latency', nlabel => 'viewstation.h323.latency.count', set => {
53 key_values => [ { name => 'polycomVSLatency' }],
54 output_template => 'H323 (audio/video) Latency %.2f',
55 perfdatas => [
56 { template => '%.2f', min => 0 }
57 ]
58 }
59 }
60 ];
61 }
62
63 sub prefix_global_output {
64 my ($self, %options) = @_;
65
66 return "View Station Phone Number: '" . $options{instance_value}->{display} . "' Stats: ";
67 }
68
69 sub check_options {
70 my ($self, %options) = @_;
71 $self->SUPER::check_options(%options);
72
73 return $self;
74 }
75
76 sub new {
77 my ($class, %options) = @_;
78 my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
79 bless $self, $class;
80
81 $options{options}->add_options();
82
83 return $self;
84 }
85
86 sub manage_selection {
87 my ($self, %options) = @_;
88
89 my $oid_polycomVSPhoneNumber = '.1.3.6.1.4.1.2684.1.1.2.0';
90 my $oid_polycomVSPercentPacketLoss = '.1.3.6.1.4.1.2684.1.1.21.0';
91 my $oid_polycomVSJitter = '.1.3.6.1.4.1.2684.1.1.22.0';
92 my $oid_polycomVSLatency = '.1.3.6.1.4.1.2684.1.1.23.0';
93
94 my $result = $options{snmp}->get_leef(
95 oids => [
96 $oid_polycomVSPhoneNumber,
97 $oid_polycomVSPercentPacketLoss,
98 $oid_polycomVSJitter,
99 $oid_polycomVSLatency
100 ],
101 nothing_quit => 1
102 );
103
104 $self->{global} = {
105 display => $result->{$oid_polycomVSPhoneNumber},
106 polycomVSPercentPacketLoss => $result->{$oid_polycomVSPercentPacketLoss},
107 polycomVSJitter => $result->{$oid_polycomVSJitter},
108 polycomVSLatency => $result->{$oid_polycomVSLatency}
109 };
110 }
111 1;
112
113 __END__
114
115 =head1 MODE
116
117 Check HDX ViewStation statistics during H323 communications
118
119 =over 8
120
121 =item B<--warning-* --critical-*>
122
123 Warning and Critical thresholds.
124 Possible values are: h323-packet-loss, h323-jitter, h323-latency
125
126 =back
127
128 =cut