Connecting the world…

switchmap

Step-by-step guide: SwitchMap under CactiEZ

Switchmap is a Perl program that creates HTML pages that show information about a set of Cisco Ethernet switches. It uses SNMP to gather data from the switches. Normally I install Switchmap in conjunction with CactiEZ and every time I am struggling to get Switchmap to work perfectly.

During another installation I wrote this step-by-step guide to configure switchmap correctly. This step-by-step guide is based on switchmap version 11.19. At first you have to download switchmap, extract it to the /var/www/html directory and rename the folder.

tar zxvf switchmap-11.19.tar.gz
mv switchmap-11.19 switchmap

Switchmap depends on multiple Perl modules, so install the necessary modules.

perl -MCPAN -e shell
install Log::Log4perl
install Module::Build
install Net::SNMP
install Log::Dispatch::Screen

Make sure your routers and Catalyst switches are configured to speak SNMP.

snmp-server community read4switchmap RO

Now you have to define your site-specific variables in ThisSite.pm. I changed the following parameters.

@routers = ();
push @routers, ‘10.62.4.2’;

@LocalSwitches = ();
push @LocalSwitches, ‘10.62.4.2’;

$Community = ‘read4switchmap’;

$DnsDomain = ‘.booches.nl’;

$DestinationDirectory = ‘/var/www/html/switchmap’;

$DestinationDirectoryRoot = ‘/switchmap’;

$StateFileDirectory = ‘/var/www/html/switchmap’;

Change the configfile variable in index.php to the following:

$configfile=’/var/www/html/switchmap/ThisSite.pm’;

Switchmap has the option to search for IP addresses and MAC addresses, but you have to alter the configuration to get this functionality working. First change the following in FindOffice.pl.

use lib ‘/var/www/html/switchmap’;

Change the configuration of the web server to allow it to run CGI files from the switchmap directory. I added the following lines above the existing ScriptAlias in /etc/httpd/conf/httpd.conf.

ScriptAlias /cgi/ “/var/www/html/switchmap/”

<Directory “/var/www/html/switchmap”>
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

Edit SearchPortLists.html and change the following lines.

<link href=”/switchmap/SwitchMap.css” rel=”stylesheet”>

<form method=GET action=”/cgi/FindOffice.pl”>

Change the rights on the files FindOffice.pl and ThisSite.pm

chmod 777 FindOffice.pl
chmod 777 ThisSite.pm

Now you can test run your installation by executing the following 3 commands:

perl GetArp.pl
perl ScanSwitch.pl
perl SwitchMap.pl

When the commands are executed you can point your browser to:

http://<cacti-url>/switchmap/index.html

and you should have a working Switchmap configuration.

The last step is configuring a cron job to schedule switchmap. Change the cron configuration using the command

crontab –e

and add the following lines.

44 * * * * perl /var/www/html/switchmap/ScanSwitch.pl
49 * * * * perl /var/www/html/switchmap/GetArp.pl
05 14 * * * perl /var/www/html/switchmap/SwitchMap.pl

You are good to go!! I hope this step-by-step guides makes my life (and hopefully also your life) a bit easier when installing a new Switchmap under CactiEZ.

Cacti, easy going

A decent management server is very important in a network, at least that is my opinion. The most important aspect of a management server is its user friendliness. Our customers are most of the time busy with their own problems and the problems of end users, which include all kind of (silly) problems. So the most of them don’t have a lot of time to spend on configuring a management server.

That is why I like Cacti and especially CactiEZ. CactiEZ is a software appliance, which is up and running in half an hour. After that you just add some devices and you can generate some nice bandwidth statistics with the help of RRDTool. I have also seen a lot of other management servers, like Nagios, HP OpenView and Cisco Works, but the most of them are hard to configure and end up as mp3 player…..

When I configure a management server only for network components like switches, routers and/or firewalls, I always use CactiEZ. It is easy to install and gives me all the things I need. The most important options of Cacti for me are: bandwidth statistics, syslog messages, flow view, mac tracking, reporting and so one. Especially if you combine Cacti(EZ) with SwitchMap, you have a nice, easy to use and robust management server for your network.