SNM Installation Guide

Prerequisites and Tools
Win32 Installation
Linux Installation
Mac (OS X/Darwin) Installation
Installing SNM as a Win32 Service
Installing SNM as a Linux Service

An understanding of xml, ip networking and snmp is assumed.

  • Editing Tool:
    ConTEXT is used to develop SNM, hence is recommended if you do not already have a preferred editor.
  • snmp Query Tool:
    Getif for Win32 or net-snmp for Linux are recommended for the snmp querying of devices to assist in determining OIDs, etc.
Hardware and Software Requirements for Installing SNM
  1. The minimum hardware and software requirements for installing SNM on Windows are:
    • A Windows 2000 Workstation, 2000/2003 Server, or Windows XP with:
    • a network connection and the Internet Protocol (TCP/IP) installed, also
    • IIS Web Service or Apache HTTP Service installed.
Installation Summary
  1. Install Perl 5.8 (Activestate's MSI)
  2. Install RRDtool 1.2.x (C:\rrdtool>install)
  3. Install HTML::Template (C:\Perl>ppm install HTML-Template)
  4. If snmp v3 or authentication to the e-mail server is required, refer to optional Perl Modules
  5. Install SNM (unzip to C:\Program Files\snm\ and C:\Inetpub\wwwroot\snm\ for IIS, or C:\Program Files\Apache Group\Apache2\snm\ for Apache)
  6. Configure Web Server
Install Perl 5.8
  1. Download and install Perl 5.8 (ActiveState's MSI is recommended for Win32 installations)
Install RRDtool including RRDs
  1. Download RRDtool-1.2.10 or later (eg: rrdtool-1.2.10-win32-perl58.zip) and unzip into a directory (e.g. C:\rrdtool\)

Note: SNM does not support versions 1.0.xx of RRDtool.

  1. Install RRDs:
    	C:\rrdtool>install
    	RRD module for activestate perl 5.8.x
    	-------------------------------------
    	====================
    	Install 'RRDs' version 1.201 in ActivePerl 5.8.3.809.
    	====================
    	Installing C:\Perl\site\lib\auto\rrds\rrds.bs
    	Installing C:\Perl\site\lib\auto\rrds\rrds.dll
    	Installing C:\Perl\site\lib\auto\rrds\rrds.exp
    	Installing C:\Perl\site\lib\auto\rrds\rrds.lib
    	Installing C:\Perl\site\lib\auto\rrds\rrds.pdb
    	Files found in blib\arch: installing files in blib\lib into
    	  architecture dependent library tree
    	Installing C:\Perl\site\lib\makefile.pl
    	Installing C:\Perl\site\lib\ntmakefile.pl
    	Installing C:\Perl\site\lib\rrds.pm
    	Successfully installed RRDs version 1.201 in ActivePerl 5.8.3.809.
    	Press any key to continue . . .
    	1..7
    	ok 1 loading
    	...
    	Press any key to continue . . .
Install CPAN modules
XML::Simple
(mandatory)

ActivePerl usually includes XML::Simple hence installation may not be required.
To search to see if XML::Simple is installed: C:\Perl>ppm search XML-Simple

If it is missing and you are on-line, then:

   C:\Perl>ppm install XML-Simple

Or, to unpack and install XML::Simple:

  1. Unpack the enclosed XML-Simple-2.14.tar.gz or download XML::Simple from CPAN
  2. Install as per the README, or simply copy the Simple.pm file to your C:\Perl\site\lib\XML\ directory (where Parser.pm lives).
HTML::Template
(mandatory)

If you are using ActivePerl and on-line, then:

   C:\Perl>ppm install HTML-Template

Or, to unpack and install HTML::Template from the enclosed file:

  1. Unpack the enclosed HTML-Template-2.6.tar.gz or download HTML::Template from CPAN
  2. Download NMAKE.EXE and NMAKE.ERR from http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084 to C:\perl\bin\
  3. Install HTML-Template-2.6.tar.gz as per the README, eg:
       C:\downloads\perl\HTML-Template-2.6>perl makefile.pl
       Checking if your kit is complete...
       Looks good
       Writing Makefile for HTML::Template
        
       C:\downloads\perl\HTML-Template-2.6>nmake
        
       Microsoft (R) Program Maintenance Utility Version 1.50
       Copyright (c) Microsoft Corp 1988-94. All rights reserved.
        
       cp Template.pm blib\lib\HTML\Template.pm
        
       C:\downloads\perl\HTML-Template-2.6>nmake test
        
       Microsoft (R) Program Maintenance Utility Version 1.50
       Copyright (c) Microsoft Corp 1988-94. All rights reserved.
        
       C:\Perl\bin\perl.exe "-Iblib\lib" "-Iblib\arch" test.pl
       1..57
       ok 1
       ok 2
       ..skipped..
       ok 59
       ok 60
        
       C:\downloads\perl\HTML-Template-2.6>nmake install
        
       Microsoft (R) Program Maintenance Utility Version 1.50
       Copyright (c) Microsoft Corp 1988-94. All rights reserved. 
        
       Installing C:\Perl\site\lib\HTML\Template.pm
       Writing C:\Perl\site\lib\auto\HTML\Template\.packlist
       Appending installation info to C:\Perl\lib/perllocal.pod
Time::HiRes
(mandatory)

ActivePerl usually includes Time::HiRes hence installation may not be required.
To search to see if Time::HiRes is installed: C:\Perl>ppm search Time-HiRes

If it is missing and you are on-line, then:

   C:\Perl>ppm install Time-HiRes

Or, to unpack and install Time::HiRes:

  1. Unpack the enclosed Time-HiRes-1.87.tar.gz or download Time::HiRes from CPAN
  2. Install as per README: perl Makefile.PL, nmake, nmake test and nmake install.
Crypt::DES
(optional)

Crypt-DES is only required if SNMP v3 is used.

Crypt-DES is currently not available at ActiveState, hence use the enclosed copy

   C:\Perl>ppm rep add local "C:\Program Files\snm"
   C:\Perl>ppm install crypt-des

Or, to unpack and install Crypt::DES:

  1. Unpack the enclosed Crypt-DES-2.05.tar.gz or download Crypt::DES from CPAN
  2. Install as per README: perl Makefile.PL, nmake, nmake test and nmake install.
Authen::SASL
(optional)

Authen-SASL is only required if authentication to the SMTP e-mail server is required.

   C:\Perl>ppm install Authen-SASL

Or, to unpack and install Authen::SASL from the enclosed file:

  1. Unpack the enclosed Authen-SASL-2.10.tar.gz or download Authen::SASL from CPAN
  2. Install as per the README: perl Makefile.PL, nmake, nmake test and nmake install.
MIME::Base64
(optional)

MIME-Base64 is only required if authentication to the SMTP e-mail server is required.

MIME-Base64 is currently not available at ActiveState, hence use the enclosed copy

   C:\Perl>ppm rep add local "C:\Program Files\snm"
   C:\Perl>ppm install MIME-Base64

Or, to unpack and install MIME::Base64 from the enclosed file:

  1. Unpack the enclosed MIME-Base64-3.07.tar.gz or download MIME::Base64 from CPAN
  2. Install as per the README: perl Makefile.PL, nmake, nmake test and nmake install.

Note: The CPAN modules Net::SNMP, Net::Ping and Net::Syslog are supplied and installed with SNM. Separate installation is not required.

Install SNM
  1. Download SNM from http://snm.sourceforge.net
  2. unzip into program and web directories:
    • C:\Program Files\snm\ and C:\Inetpub\wwwroot\snm\ for Win32/IIS, or
    • C:\Program Files\snm\ and C:\Program Files\Apache Group\Apache2\snm\ for Win32/Apache

Note: Ensure folders are activated when SNM is unzipped.

Web Server Configuration
  1. For IIS 5:
    1. cgi configuration
      • Goto Internet Information Services using the MMC: Administrative Tools >> Internet Services Manager
      • Right click the 'Default Web Site' >> Properties >> Home Directory >> Configuration...
      • Add an Extension '.cgi' if it does not exist, with the following properties:
    2. In File Manager, create a folder under the web directory, as defined in <graphfolder> eg: C:\Inetpub\wwwroot\snm\graphs.
      • Select, then right click the 'graphfolder' >> Sharing... >> Security
      • Enable 'Read' and 'Write' for the user Internet Guest Account
    3. In Internet Services Manager, select the folder under the web directory, as defined in <graphfolder> eg: C:\Inetpub\wwwroot\snm\graphs.
      • Select, then right click the 'graphfolder' >> Properties >> Directory
      • Enable 'Read' and 'Write'
    4. To stop IIS caching the rrd images (allows the images in browsers to refresh each 5 minutes)
      • Goto Internet Information Services using the MMC: Administrative Tools >>  Internet Services Manager
      • In the 'Default Web Site', right click the 'snm' folder >> Properties >> HTTP Headers
      • Select 'Enable Content Expiration' and 'Expire Immediately'
  2. For IIS 6:
    1. cgi configuration as per above (IIS 5)
    2. In File Manager
      • Select, then right click the 'graphfolder' >> Properties >> Security
      • Allow 'Read' and 'Write' for 'Internet Guest Account'
    3. Web Service Extensions
      • Goto Internet Information Services using the MMC: Administrative Tools >> Internet Services Manager
      • Select the 'Web Service Extensions'
      • Allow 'Perl CGI Extension' (visible after ActivePerl is installed).

    Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;245225

    Hint: To increase security an option is to use Perl's taint features. To implement taint, in IIS Configuration... set the Executable to C:\Perl\bin\perl.exe -T %s %s, also change the first line in snm.cgi to #!/usr/bin/perl -Tw.

  3. For Apache 2:
    Refer to the Apache 2 Manual, specifically the "Apache Tutorial: Dynamic Content with CGI" for several methods on configuring Apache for CGI programs. The following is one method:
    1. Add a sub-directory (C:\Program Files\Apache Group\Apache2\snm) and copy the web files to it (snm.cgi, .htmt and .png files)
    2. In the SNM configuration file (config.xml), set <web_dir> to C:\Program Files\Apache Group\Apache2\snm
    3. Add an Alias to the Apache configuration file (httpd.conf) which permits the execution of CGI files:
         Alias /snm/ "C:/Program Files/Apache Group/Apache2/snm/"
         <Directory "C:/Program Files/Apache Group/Apache2/snm">
             Options Indexes ExecCGI
             AllowOverride None
             Order allow,deny
             Allow from all
         </Directory>
    4. Add to the Apache configuration file (httpd.conf) a directive to treat all files with the cgi extension as CGI programs:
      AddHandler cgi-script cgi
    5. Ensure the file snm.cgi is associated with Perl Command Line Interpreter via Windows Explorer:
      My Computer >> select snm.cgi >> File >> Properties >> General >> Opens with: Perl Command Line Interpreter,
      also ensure Perl is in the path (e.g. from the command console: PATH=C:\Perl\bin\;C:\WINNT\system32;C...)
    6. Change the first line of snm.cgi
      from:  #!/usr/bin/perl -w
      to:     #!c:/perl/bin/perl.exe -w

Hint: Only those files needed should be copied to the web directory. Placing additional files in the web directory potentially exposes sources of attack.

Hardware and Software Requirements for Installing SNM
  1. The minimum hardware and software requirements for installing SNM on Linux are:
    • Fedora Core 3 Linux (other Linux distributions should work) with:
    • a network connection and the Internet Protocol (TCP/IP) installed, also
    • Apache HTTP Service installed and
    • Perl 5.8 installed.
Install RRDtool including RRDs
  1. Download and install RRDtool 1.2.x for Perl 5.8 using the build instructions or an rpm (e.g. rpm -Uvh rrdtool-1.2.12-1.1.fc3.test.i386.rpm).

Note: SNM only supports RRDtool v1.2.10 and later.

Install CPAN modules
XML::Simple
(mandatory)
  1. Unpack the enclosed XML-Simple-2.14.tar.gz or download XML::Simple from CPAN
  2. Install as per the README, eg:
       >perl Makefile.PL
       >make
       >make test
       >make install
HTML::Template
(mandatory)
  1. Unpack the enclosed HTML-Template-2.6.tar.gz or download HTML::Template from CPAN
  2. Install as per the README, eg:
       >perl Makefile.PL
       >make
       >make test
       >make install
Time::HiRes
(mandatory)
  1. Unpack the enclosed Time-HiRes-1.87.tar.gz or download Time::HiRes from CPAN
  2. Install, eg:
       >perl Makefile.PL
       >make
       >make test
       >make install
Crypt::DES
(optional)

Crypt-DES is only required if SNMP v3 is used.

  1. Unpack the enclosed Crypt-DES-2.05.tar.gz or download Crypt::DES from CPAN
  2. Install, eg:
       >perl Makefile.PL
       >make
       >make test
       >make install
Authen::SASL
(optional)

Authen-SASL is only required if authentication to the SMTP e-mail server is required.

  1. Unpack the enclosed Authen-SASL-2.10.tar.gz or download Authen::SASL from CPAN
  2. Install, eg:
       >perl Makefile.PL
       >make
       >make test
       >make install
MIME::Base64
(optional)

MIME-Base64 is only required if authentication to the SMTP e-mail server is required.

  1. Unpack the enclosed MIME-Base64-3.07.tar.gz or download MIME::Base64 from CPAN
  2. Install, eg:
       >perl Makefile.PL
       >make
       >make test
       >make install

Note: The CPAN modules Net::SNMP, Net::Ping and Net::Syslog are supplied and installed with SNM. Separate installation is not required.

Install SNM
  1. Download SNM from snm.sourceforge.net
  2. Unpack into program and web directories. The recommended structure is as per FHS:
    • /opt/snm/ for the core application files (snm.pl, test_*.rrd files and /lib directory including contents)
    • /etc/opt/snm for the configuration files (config.xml, targets.xml and graphs.xml)
    • /var/opt/snm for the alert file (SNM will create alerts.xml when started)
    • /var/www/html/snm/ for the web files (.cgi, .htmt and .png files), and
    • /var/log for the log file (If configured, SNM will create snm.log when started).
  3. Set permissions for the Apache group:
    • read for <web_dir>, eg /var/www/html/snm/,
    • execute for snm.cgi
    • read-write for <graphfolder>, eg /var/www/html/snm/graphs/
Web Server Configuration
  1. For Apache (httpd):
    • It is recommended to start Apache as a service, refer to redhat-config-service or equivalent
  2. Configure Apache to permit CGI execution:
    Use the Options directive, inside your Apache server configuration file (/etc/httpd/conf/httpd.conf), to specify that CGI execution is permitted in the snm directory:
       <Directory /var/www/html/snm>
         Options ExecCGI
       </Directory>
    Also direct the server to treat all files with the cgi extension as CGI programs:
       AddHandler cgi-script .cgi

    Refer to the Apache manual for more information.

Hint: Only those files needed should be copied to the web directory. Placing additional files in the web directory potentially exposes sources of attack.

Modifications have been kindly provided to enable SNM to run on Mac OS X / Darwin, refer: SourceForge.net: Open Discussion.

Using the Linux Installation as a base, a summary of changes required to run under OS X 10.4 are:

  1. In snm.pl and snm.cgi, modify shebang to #!/opt/local/bin/perl
  2. Modify installation paths (for compatibility with darwinports and OS X Apache)
    • snm.pl in /opt/local/bin,
    • config files in /opt/local/etc/snm,
    • perl modules (Apachestats, etc.) in /opt/local/lib/snm,
    • snm.cgi in /Library/WebServer/Documents/snm
  3. Insert path to perl modules, i.e. in snm.pl and snm.cgi, modify from:
    • use lib qw(/lib/perl/5.8.5/i386-linux-thread-multi); to:
    • use lib qw(/lib/perl/5.8.5/i386-linux-thread-multi /opt/local/lib/snm);

Microsoft Resource Kit tools instsrv.exe and srvany.exe are used to setup SNM to run as a service under NT/2K/XP/2K3:

  1. Open up an MS-DOS command prompt.
    Type the following command:
       C:\>instsrv SNM C:\WINNT\srvany.exe
       The service was successfuly added!
       ...
     
    Note1: The service name can be whatever you want, (SNM is recommended).
    Note2: To remove the service: C:\>instsrv SNM REMOVE.
    Refer to Microsoft's srvany.wri for further details.
  2. Open up the Registry Editor (Start Button >> Run >> type REGEDT32)
    Select the key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNM
  3. From the Edit menu >> Add Key.
    Key Name: Parameters
    Class :<leave blank>
  4. (Optional) Within the key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNM
    From the Edit menu >> Add Value.
    Value Name: Description
    Type : REG_SZ
    String : System and Network Monitor
  5. Select the key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNM\Parameters
    From the Edit menu >> Add Value (3 times).
    Value Name Type String
    Application REG_SZ C:\Perl\bin\wperl.exe
    AppDirectory REG_SZ C:\Program Files\snm
    AppParameters REG_SZ snm.pl -c config.xml
  6. Close the Registry Editor
  7. Open up Services (Administrative Tools >> Services)
    Select the service SNM and "Start Service"
  8. To validate SNM is running goto Task Manager... >> Processes and a new wperl.exe process should be running.

Note: It is strongly recommended that SNM is implemented successfully in a console before attempting to run it as a service.

To install SNM as a service on Linux, two solutions have been developed:

  • rc.local, and
  • init.d

It is strongly recommended that SNM is implemented successfully in a console before attempting to run it as a service.

rc.local

rc.local is the simplest of the two:

  1. Login as root.
  2. In the startup file /etc/rc.d/rc.local, add the line:
       /usr/bin/perl /opt/snm/snm.pl -c /etc/opt/snm/config.xml >/dev/null &
  3. Logout and reboot. SNM will start automatically.
  4. To confirm that SNM has started, from the console: ps -e |grep "perl" will result in "1089 ? 00:00:09 perl" or similar.
init.d

init.d (/etc/rc.d/init.d/snmd) provides greater flexibility but is more complex:

The snmd script may require modification to suit your environment. The posting of any modifications along with the environment it suits to the snm forum would be greatly appreciated.

  1. Login as root.
  2. Add the file snmd to the folder /etc/rc.d/init.d/snmd,
  3. Logout and reboot. SNM will start automatically, you will also see snmd in the service list and be able to stop and start it.
  4. To confirm that SNM has started, from the console: ps -e |grep "perl" will result in "1089 ? 00:00:09 perl" or similar.