1 # Copyright (C) 2003-2004 Stanislav Sinyagin, 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: MicrosoftWindows.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
19 # Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
21 # MS Windows 2000/XP SNMP agent discovery.
22 # ifDescr does not give unique interace mapping, so MAC address mapping
25 package Torrus::DevDiscover::MicrosoftWindows;
31 $Torrus::DevDiscover::registry{'MicrosoftWindows'} = {
33 'checkdevtype' => \&checkdevtype,
34 'discover' => \&discover,
35 'buildConfig' => \&buildConfig
42 'windowsNT' => '1.3.6.1.4.1.311.1.1.3.1',
45 'ms_ftpStatistics' => '1.3.6.1.4.1.311.1.7.2.1',
48 'ms_httpStatistics' => '1.3.6.1.4.1.311.1.7.3.1',
51 # Not all interfaces are normally needed to monitor.
52 # You may override the interface filtering in devdiscover-siteconfig.pl:
53 # redefine $Torrus::DevDiscover::MicrosoftWindows::interfaceFilter
54 # or define $Torrus::DevDiscover::MicrosoftWindows::interfaceFilterOverlay
57 our $interfaceFilterOverlay;
58 my %winNTInterfaceFilter;
60 if( not defined( $interfaceFilter ) )
62 $interfaceFilter = \%winNTInterfaceFilter;
66 # Key is some unique symbolic name, does not mean anything
67 # ifType is the number to match the interface type
68 # ifDescr is the regexp to match the interface description
69 %winNTInterfaceFilter =
71 'MS TCP Loopback interface' => {
72 'ifType' => 24 # softwareLoopback
79 my $devdetails = shift;
81 if( not $dd->oidBaseMatch
83 $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
88 my $data = $devdetails->data();
90 &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
91 ($devdetails, $interfaceFilter);
93 if( defined( $interfaceFilterOverlay ) )
95 &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
96 ($devdetails, $interfaceFilterOverlay);
99 $devdetails->setCap('interfaceIndexingManaged');
108 my $devdetails = shift;
110 my $session = $dd->session();
111 my $data = $devdetails->data();
113 # In Windows SNMP agent, ifDescr is not unique per interface.
114 # We use MAC address as a unique interface identifier.
116 $data->{'nameref'}{'ifComment'} = ''; # suggest?
118 $data->{'param'}{'ifindex-map'} = '$IFIDX_MAC';
119 Torrus::DevDiscover::RFC2863_IF_MIB::retrieveMacAddresses( $dd,
122 $data->{'nameref'}{'ifNick'} = 'MAC';
124 # FTP and HTTP servers, if present
125 if( $dd->checkSnmpTable( 'ms_ftpStatistics' ) )
127 $devdetails->setCap( 'msIIS' );
128 $devdetails->setCap( 'msFtpStats' );
131 if( $dd->checkSnmpTable( 'ms_httpStatistics' ) )
133 $devdetails->setCap( 'msIIS' );
134 $devdetails->setCap( 'msHttpStats' );
141 # Nothing really to do yet
144 my $devdetails = shift;
148 if( $devdetails->hasCap( 'msIIS' ) )
151 'precedence' => -100000,
152 'comment' => 'Microsoft Internet Information Server'
156 if( $devdetails->hasCap( 'msFtpStats' ) )
159 'MicrosoftWindows::microsoft-iis-ftp-stats' );
161 if( $devdetails->hasCap( 'msHttpStats' ) )
164 'MicrosoftWindows::microsoft-iis-http-stats' );
168 my $iisNode = $cb->addSubtree( $devNode, 'MS_IIS', $iisParam,
179 # indent-tabs-mode: nil
180 # perl-indent-level: 4