1 # Copyright (C) 2003 Shawn Ferry
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: NetScreen.pm,v 1.1 2010-12-27 00:03:50 ivan Exp $
18 # Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
22 package Torrus::DevDiscover::NetScreen;
28 $Torrus::DevDiscover::registry{'NetScreen'} = {
30 'checkdevtype' => \&checkdevtype,
31 'discover' => \&discover,
32 'buildConfig' => \&buildConfig
37 'netscreen' => '1.3.6.1.4.1.3224',
38 'nsResSessMaxium' => '1.3.6.1.4.1.3224.16.3.3.0',
39 'nsIfFlowTable' => '1.3.6.1.4.1.3224.9.3',
41 'nsIfMonTable' => '1.3.6.1.4.1.3224.9.4',
42 'nsIfMonIfIdx' => '1.3.6.1.4.1.3224.9.4.1.1',
48 my $devdetails = shift;
50 if( not $dd->checkSnmpTable( 'netscreen' ) )
55 my $data = $devdetails->data();
57 $devdetails->setCap('interfaceIndexingManaged');
66 my $devdetails = shift;
68 my $session = $dd->session();
69 my $data = $devdetails->data();
71 $data->{'nameref'}{'ifDescr'} = '';
72 $data->{'param'}{'ifindex-map'} = '$IFIDX_MAC';
73 Torrus::DevDiscover::RFC2863_IF_MIB::retrieveMacAddresses( $dd,
76 # TODO: do something about these tables in buildConfig
78 if( $dd->checkSnmpTable( 'nsIfFlowTable' ) )
80 $devdetails->setCap('nsIfFlowTable');
83 if( $dd->checkSnmpTable( 'nsIfMonTable' ) )
85 $devdetails->setCap('nsIfMonTable');
88 if( not defined( $data->{'param'}{'snmp-oids-per-pdu'} ) )
90 my $oidsPerPDU = $devdetails->param('NetScreen::snmp-oids-per-pdu');
91 if( $oidsPerPDU == 0 )
95 Debug("Setting snmp-oids-per-pdu to $oidsPerPDU");
96 $data->{'param'}{'snmp-oids-per-pdu'} = $oidsPerPDU;
99 my $result = $dd->retrieveSnmpOIDs('nsResSessMaxium');
100 if( defined($result) and $result->{'nsResSessMaxium'} > 0 )
102 $devdetails->setCap('NetScreen::SessMax');
105 my $max = $result->{'nsResSessMaxium'};
107 $param->{'hrule-value-max'} = $max;
108 $param->{'hrule-legend-max'} = 'Maximum Sessions';
109 # upper limit of graph is 5% higher than max sessions
110 $param->{'graph-upper-limit'} =
112 ( $max * 5 / 100 ) + $max );
114 $data->{'netScreenSessions'} = {
125 my $devdetails = shift;
128 my $data = $devdetails->data();
131 { #Allocated Sessions
133 my $ref = $data->{'netScreenSessions'};
135 $cb->addSubtree( $devNode, "NetScreen_Sessions", $ref->{'param'},
136 [ 'NetScreen::netscreen-sessions-stats' ] );
140 $cb->addTemplateApplication($devNode, 'NetScreen::netscreen-cpu-stats');
141 $cb->addTemplateApplication($devNode, 'NetScreen::netscreen-memory-stats');
150 # indent-tabs-mode: nil
151 # perl-indent-level: 4