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 # $Id: AscendMax.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
20 # Ascend (Lucent) MAX device discovery.
24 # MAX 4000, TAOS version 7.0.26
26 # NOTE: SNMP version 1 is only supported. Because of version 1 and numerous
27 # WAN DS0 interfaces, the discovery process may take few minutes.
29 package Torrus::DevDiscover::AscendMax;
35 $Torrus::DevDiscover::registry{'AscendMax'} = {
37 'checkdevtype' => \&checkdevtype,
38 'discover' => \&discover,
39 'buildConfig' => \&buildConfig
46 'ASCEND-MIB::max' => '1.3.6.1.4.1.529.1.2',
47 # ASCEND-ADVANCED-AGENT-MIB
48 'ASCEND-ADVANCED-AGENT-MIB::wanLineTable' =>
49 '1.3.6.1.4.1.529.4.21',
50 'ASCEND-ADVANCED-AGENT-MIB::wanLineState' =>
51 '1.3.6.1.4.1.529.4.21.1.5',
52 'ASCEND-ADVANCED-AGENT-MIB::wanLineActiveChannels' =>
53 '1.3.6.1.4.1.529.4.21.1.7',
54 'ASCEND-ADVANCED-AGENT-MIB::wanLineSwitchedChannels' =>
55 '1.3.6.1.4.1.529.4.21.1.13'
58 # Not all interfaces are normally needed to monitor.
59 # You may override the interface filtering in devdiscover-siteconfig.pl:
60 # redefine $Torrus::DevDiscover::AscendMax::interfaceFilter
61 # or define $Torrus::DevDiscover::AscendMax::interfaceFilterOverlay
64 our $interfaceFilterOverlay;
65 my %ascMaxInterfaceFilter;
67 if( not defined( $interfaceFilter ) )
69 $interfaceFilter = \%ascMaxInterfaceFilter;
73 # Key is some unique symbolic name, does not mean anything
74 # ifType is the number to match the interface type
75 # ifDescr is the regexp to match the interface description
76 %ascMaxInterfaceFilter =
79 'ifType' => 33 # rs232
86 'ifDescr' => '^wan\d+'
89 'ifType' => 1, # other
90 'ifDescr' => '^wan\d+'
93 'ifType' => 1, # other
94 'ifDescr' => '^wanidle\d+'
97 'ifType' => 24 # softwareLoopback
105 my $devdetails = shift;
107 if( not $dd->oidBaseMatch
109 $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
114 &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
115 ($devdetails, $interfaceFilter);
117 if( defined( $interfaceFilterOverlay ) )
119 &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
120 ($devdetails, $interfaceFilterOverlay);
123 $devdetails->setCap('interfaceIndexingPersistent');
132 my $devdetails = shift;
134 my $data = $devdetails->data();
135 my $session = $dd->session();
137 my $wanTableOid = $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineTable' );
139 $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineState' );
141 $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineSwitchedChannels' );
143 my $wanTable = $session->get_table( -baseoid => $wanTableOid );
144 if( defined( $wanTable ) )
146 $devdetails->storeSnmpVars( $wanTable );
147 $devdetails->setCap('wanLineTable');
149 $data->{'ascend_wanLines'} = {};
151 foreach my $ifIndex ( $devdetails->getSnmpIndices( $stateOid ) )
153 # Check if the line State is 13(active)
154 if( $devdetails->snmpVar( $stateOid . '.' . $ifIndex) == 13 )
156 my $descr = $devdetails->snmpVar($dd->oiddef('ifDescr') .
159 $data->{'ascend_wanLines'}{$ifIndex}{'description'} = $descr;
160 $data->{'ascend_wanLines'}{$ifIndex}{'channels'} =
161 $devdetails->snmpVar( $totalOid . '.' . $ifIndex );
172 my $devdetails = shift;
176 my $data = $devdetails->data();
178 my $callStatsNode = $cb->addSubtree( $devNode, 'Call_Statistics', undef,
179 ['AscendMax::ascend-totalcalls']);
181 foreach my $ifIndex ( sort {$a<=>$b} keys %{$data->{'ascend_wanLines'}} )
184 $param->{'precedence'} = sprintf('%d', -10000 - $ifIndex);
185 $param->{'ascend-ifidx'} = $ifIndex;
187 my $nChannels = $data->{'ascend_wanLines'}{$ifIndex}{'channels'};
188 $param->{'upper-limit'} = $nChannels;
189 $param->{'graph-upper-limit'} = $nChannels;
191 my $subtreeName = $data->{'ascend_wanLines'}{$ifIndex}{'description'};
192 $subtreeName =~ s/\W/_/g;
194 $cb->addLeaf( $callStatsNode, $subtreeName, $param,
195 ['AscendMax::ascend-line-stats']);
205 # indent-tabs-mode: nil
206 # perl-indent-level: 4