Debian Codegraph @

src/network/atrica/snmp/mode/listconnections.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 network::atrica::snmp::mode::listconnections;
22
23 use base qw(snmp_standard::mode::listinterfaces);
24
25 use strict;
26 use warnings;
27
28 sub set_oids_status {
29 my ($self, %options) = @_;
30
31 if ($self->{option_results}->{oid_filter} eq 'atrconncepgendescr') {
32 $self->{oid_adminstatus} = '.1.3.6.1.4.1.6110.2.7.5.1.7';
33 $self->{oid_adminstatus_mapping} = {
34 1 => 'up', 2 => 'down',
35 };
36 $self->{oid_opstatus} = '.1.3.6.1.4.1.6110.2.7.5.1.8';
37 $self->{oid_opstatus_mapping} = {
38 1 => 'up', 2 => 'down', 3 => 'oneWay', 4 => 'twoWay', 5 => 'fastProtected',
39 };
40 } else {
41 $self->{oid_adminstatus} = '.1.3.6.1.4.1.6110.2.2.1.1.3';
42 $self->{oid_adminstatus_mapping} = {
43 2 => 'off', # off
44 3 => 'on', # on
45 };
46 $self->{oid_opstatus} = '.1.3.6.1.4.1.6110.2.2.1.1.4';
47 $self->{oid_opstatus_mapping} = {
48 2 => 'off', 3 => 'systemBusy', 4 => 'dependencyBusy', 5 => 'inService', 6 => 'alterInService', 7 => 'failed',
49 8 => 'mainInServiceViaCoreLinkProtec', 9 => 'alterInServiceViaCoreLinkProtec',
50 10 => 'mainAndAltDownConnUpSendingToMain', 11 => 'mainAndAltDownConnUpSendingToAlt',
51 };
52 }
53 }
54
55 sub is_admin_status_down {
56 my ($self, %options) = @_;
57
58 if (defined($self->{option_results}->{use_adminstatus}) && defined($options{admin_status}) &&
59 $self->{oid_adminstatus_mapping}->{$options{admin_status}} !~ /^up|on$/) {
60 return 1;
61 }
62 return 0;
63 }
64
65 sub set_oids_label {
66 my ($self, %options) = @_;
67
68 $self->{oids_label} = {
69 'atrconncepgendescr' => '.1.3.6.1.4.1.6110.2.7.5.1.1',
70 'atrconningdescr' => '.1.3.6.1.4.1.6110.2.2.1.1.2',
71 };
72 }
73
74 sub default_oid_filter_name {
75 my ($self, %options) = @_;
76
77 return 'atrConnCepGenDescr';
78 }
79
80 sub default_oid_display_name {
81 my ($self, %options) = @_;
82
83 return 'atrConnCepGenDescr';
84 }
85
86 sub new {
87 my ($class, %options) = @_;
88 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_speed => 1);
89 bless $self, $class;
90 return $self;
91 }
92
93 1;
94
95 __END__
96
97 =head1 MODE
98
99 =over 8
100
101 =item B<--interface>
102
103 Set the interface (number expected) example: 1,2,... (empty means 'check all interfaces').
104
105 =item B<--name>
106
107 Allows you to define the interface (in option --interface) by name instead of OID index. The name matching mode supports regular expressions.
108
109 =item B<--speed>
110
111 Set interface speed (in Mb).
112
113 =item B<--skip-speed0>
114
115 Don't display interface with speed 0.
116
117 =item B<--filter-status>
118
119 Display interfaces matching the filter (example: 'up').
120
121 =item B<--use-adminstatus>
122
123 Display interfaces with AdminStatus 'up'.
124
125 =item B<--oid-filter>
126
127 Define the OID to be used to filter interfaces (default: atrConnCepGenDescr) (values: atrConnIngDescr, atrConnCepGenDescr).
128
129 =item B<--oid-display>
130
131 Define the OID that will be used to name the interfaces (default: atrConnCepGenDescr) (values: atrConnIngDescr, atrConnCepGenDescr).
132
133 =item B<--display-transform-src> B<--display-transform-dst>
134
135 Modify the interface name displayed by using a regular expression.
136
137 Example: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
138
139 =item B<--add-extra-oid>
140
141 Display an OID. Example: --add-extra-oid='alias,.1.3.6.1.2.1.31.1.1.1.18'
142
143 =back
144
145 =cut