1 # Copyright (C) 2002 Stanislav Sinyagin
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 # Stanislav Sinyagin <ssinyagin@yahoo.com>
19 # Ascend (Lucent) MAX device discovery.
23 # MAX 4000, TAOS version 7.0.26
25 # NOTE: SNMP version 1 is only supported. Because of version 1 and numerous
26 # WAN DS0 interfaces, the discovery process may take few minutes.
28 package Torrus
::DevDiscover
::AscendMax
;
37 $Torrus::DevDiscover
::registry
{'AscendMax'} = {
39 'checkdevtype' => \
&checkdevtype
,
40 'discover' => \
&discover
,
41 'buildConfig' => \
&buildConfig
48 'ASCEND-MIB::max' => '1.3.6.1.4.1.529.1.2',
49 # ASCEND-ADVANCED-AGENT-MIB
50 'ASCEND-ADVANCED-AGENT-MIB::wanLineTable' =>
51 '1.3.6.1.4.1.529.4.21',
52 'ASCEND-ADVANCED-AGENT-MIB::wanLineState' =>
53 '1.3.6.1.4.1.529.4.21.1.5',
54 'ASCEND-ADVANCED-AGENT-MIB::wanLineActiveChannels' =>
55 '1.3.6.1.4.1.529.4.21.1.7',
56 'ASCEND-ADVANCED-AGENT-MIB::wanLineSwitchedChannels' =>
57 '1.3.6.1.4.1.529.4.21.1.13'
60 # Not all interfaces are normally needed to monitor.
61 # You may override the interface filtering in devdiscover-siteconfig.pl:
62 # redefine $Torrus::DevDiscover::AscendMax::interfaceFilter
63 # or define $Torrus::DevDiscover::AscendMax::interfaceFilterOverlay
66 our $interfaceFilterOverlay;
67 my %ascMaxInterfaceFilter;
69 if( not defined( $interfaceFilter ) )
71 $interfaceFilter = \
%ascMaxInterfaceFilter;
75 # Key is some unique symbolic name, does not mean anything
76 # ifType is the number to match the interface type
77 # ifDescr is the regexp to match the interface description
78 %ascMaxInterfaceFilter =
81 'ifType' => 33 # rs232
88 'ifDescr' => '^wan\d+'
91 'ifType' => 1, # other
92 'ifDescr' => '^wan\d+'
95 'ifType' => 1, # other
96 'ifDescr' => '^wanidle\d+'
99 'ifType' => 24 # softwareLoopback
107 my $devdetails = shift;
109 if( not $dd->oidBaseMatch
111 $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
116 &Torrus
::DevDiscover
::RFC2863_IF_MIB
::addInterfaceFilter
117 ($devdetails, $interfaceFilter);
119 if( defined( $interfaceFilterOverlay ) )
121 &Torrus
::DevDiscover
::RFC2863_IF_MIB
::addInterfaceFilter
122 ($devdetails, $interfaceFilterOverlay);
125 $devdetails->setCap('interfaceIndexingPersistent');
134 my $devdetails = shift;
136 my $data = $devdetails->data();
137 my $session = $dd->session();
139 my $wanTableOid = $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineTable' );
141 $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineState' );
143 $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineSwitchedChannels' );
145 my $wanTable = $session->get_table( -baseoid
=> $wanTableOid );
146 if( defined( $wanTable ) )
148 $devdetails->storeSnmpVars( $wanTable );
149 $devdetails->setCap('wanLineTable');
151 $data->{'ascend_wanLines'} = {};
153 for my $ifIndex ( $devdetails->getSnmpIndices( $stateOid ) )
155 # Check if the line State is 13(active)
156 if( $devdetails->snmpVar( $stateOid . '.' . $ifIndex) == 13 )
158 my $descr = $devdetails->snmpVar($dd->oiddef('ifDescr') .
161 $data->{'ascend_wanLines'}{$ifIndex}{'description'} = $descr;
162 $data->{'ascend_wanLines'}{$ifIndex}{'channels'} =
163 $devdetails->snmpVar( $totalOid . '.' . $ifIndex );
174 my $devdetails = shift;
178 my $data = $devdetails->data();
180 my $callStatsNode = $cb->addSubtree( $devNode, 'Call_Statistics', undef,
181 ['AscendMax::ascend-totalcalls']);
183 for my $ifIndex ( sort {$a<=>$b} keys %{$data->{'ascend_wanLines'}} )
186 $param->{'precedence'} = sprintf('%d', -10000 - $ifIndex);
187 $param->{'ascend-ifidx'} = $ifIndex;
189 my $nChannels = $data->{'ascend_wanLines'}{$ifIndex}{'channels'};
190 $param->{'upper-limit'} = $nChannels;
191 $param->{'graph-upper-limit'} = $nChannels;
193 my $subtreeName = $data->{'ascend_wanLines'}{$ifIndex}{'description'};
194 $subtreeName =~ s/\W/_/g;
196 $cb->addLeaf( $callStatsNode, $subtreeName, $param,
197 ['AscendMax::ascend-line-stats']);
209 # indent-tabs-mode: nil
210 # perl-indent-level: 4