Running Cricket On Windows NT

This document provides some help for getting Jeff Allen's Cricket SNMP monitoring package operating under Windows NT. This is a revised version of John Zola's excellent guide which was written in 2000. Additions have been made to support Cricket 1.0.3 and some updated Perl modules.

Read this entire document before you start installing.

As you have likely already found, <http://cricket.sf.net/support/> is the source for Cricket information. Most importantly, you will need to read “Installing Cricket for the Complete Beginner” and “A Gentle Introduction to Cricket” located at <http://cricket.sf.net/support/doc/>. Eventually you will want to read all of the documentation.

Cricket and the Perl are primarily written for a UNIX or Linux environment so you will have to do some investigation and some tweaking to get it to run properly under Windows NT. When you have problems read the FAQ at <http://cricket.sf.net/support/FAQ/> and search the Cricket-Users mail list archives. As a beginner you can be pretty sure that your question has previously been answered on the mail list.

So, let's get started. My installation is on Windows NT 4 Workstation but there are successful installations on Windows NT 4 Server and on Windows 2000. You will need to be at the latest service pack for Windows NT.

Install a Web Server

This guide refers to “MS Peer Web Server” but you can also use IIS or Apache. After you have installed your webserver I would recommend a session with “Windows Update” to bring your system up to some semblance of a secure server.

On Windows NT 4.0 Workstation, install Peer Web Services from the Windows NT 4.0 Workstation CD via “Network Properties”, “Services”, “Add…” dialog. On Windows NT 4.0 Server, install IIS from the Windows NT 4.0 “OptionPack” CD.

Install Perl

Perl for Win32 is available from ActiveState. The version as of this writing is “5.6.1 build 633” and is available for use under the “GNU General Public License” (GPL) and the “ActiveState Community License”.

Once you have installed ActivePerl (hence referred to as Perl) you can refer to the locally installed documentation at “\PerlInstallDir\html\index.html

Installing Modules for Perl

You will need a number of third party packages to enable Cricket to run. Typically these packages are installed from CPAN but in our case we can get most everything from Activestate. See the CPAN FAQ for info on Perl modules.

ActiveState Perl comes with a utility called the Perl Package Manager (PPM) which will install most everything for you. It allows you to search for, download, and install modules.

Type PPM at a command prompt to start the utility. Try these first few commands to get you going:

PPM> help PPM> help search PPM> help install

Note: If you get to the Internet through a proxy server you will need to add an environment variable for PPM. Under the “Environment” tab of the “System” Control Panel, add a variable “HTTP_proxy = http://proxy:8080” The case matters here. The port is optional and will default to 80. If your proxy server requires a login you will need a few additional environment variables. Read your Perl documentation under the section for “Firewalls and Proxies” for more help on this.

Once you can successfully search ActiveState via PPM you are ready to install modules. Make sure all the following are installed and installed correctly:

Install them from ActiveState as follows:

PPM> install digest-md5 PPM> install lwp-attic PPM> install db_file PPM> install timedate PPM> install time-hires

RRD Install

Go to the RRDTool distribution directory and download “rrdtool-1.0.<latest>.x86distr.zip”. Unzip this to a directory where you want RRD to live. This directory will be its final location. Read the readme file. From the command prompt set your directory to “\RRD_dir\perl-shared” and run the command “>PPM install RRDs.ppd”. This should install RRD for you.

Cricket Install

Download the latest version from the Cricket Project Page.

I used version 1.0.3, but the instructions should be identical for 1.0.4. Unzip this to your desired location where it will create a new directory “cricket-1.0.x” where “x” is the latest Cricket revision. This will be the main Cricket directory which you will make available via your web server. Your life will be a lot easier if you put Perl, RRD, and Cricket all on the same drive. I used “C:\cricket-1.0.3”.

Don't worry about “choosing a user” to run Cricket; NT installations do that much later, if at all. Don't worry about running “configure” or making a “softlink” on NT. The “configure” script just makes certain you have your main perl executable in the path.

Add cricket to your windows path. Modify the path to include “;C:\cricket-1.0.3\lib”. The Perl “bin” directory should already be there from the Perl install.

Add the cricket directory to the Perl “@INC” path. If you run “>perl -V” you should get the verbose version information about your Perl install. The last item shown is “@INC C:\perl\lib C:\perl\site\lib

You need to modify the registry to add a string value under the perl key. Modify “HKLM\software\perl” and add a value called “lib” containing your cricket lib path as the data.

lib "C:/cricket-1.0.3/lib"

After a reboot your “@INC” should now include the cricket “lib/” path. Standard warning here about modifying the registry — if you screw it up, your machine may become unbootable and you're on your own!

Also in the “perl -V” output is your architecture value “archname” which is likely set to “MSWin32-x86-multi-thread”. If that is correct, do nothing. If that is not the value, edit the “cricket-1.0.3/lib/RRD/format.pm” file to include your architecture type in the following if statement:

[…] if ($archname eq "sun4-solaris" || $archname eq "MSWin32-x86" || $archname eq "MSWin32-x86-object" || $archname eq "irix-o32" ) […]

Add a "||your_archname_here" to the list. And send a note to Cricket-Users@lists.sf.net with the details so it can be supported in future releases.

SNMP_Session

Download “SNMP_Session” from the SNMP_Session home page. After downloading the “SNMP_Session” modules and extracting them to a sub-directory, install it as follows:

Perl Makefile.PL

Now run the “nmake” utility.

If you don't have the “Nmake” utility installed, you can get it from Microsoft with one of their development kits.

>Nmake >Nmake install

Optional Install Method

If you don't want to use PPM to install modules you can do it the hard way. Go to CPAN to locate modules.

Digest::MD5CPAN:
by-authors/id/GAAS/Digest-MD5-*.tar.gz
LWP-AtticCPAN:
by-authors/id/GAAS/libwww-perl-*.tar.gz
DB_FileCPAN:
by-authors/id/PMQS/DB_File-*.tar.gz
Date::ParseCPAN:
by-authors/id/GBARR/Timedate-*.tar.gz
Time::HiResCPAN:
by-authors/id/DEWEG/Time-HiRes-*.tar.gz

Download and extract the distributions. The resulting files should include a “Makefile.PL”. Run the “Makefile.PL” script. This uses the “MakeMaker” module to build a makefile or any extensions you might need.

>Perl Makefile.PL

Now run the “nmake” utility

>Nmake

If the module has tests, it's a good idea to run them:

>Nmake test

If the test succeed, then run install

>Nmake install

Verify your Installation

By using PPM's “query” command you should see a list of all installed modules. You didn't install SNMP_Session or Cricket so they won't be listed but you should see everything else listed.

PPM> query

Setting Cricket Up on Windows NT

Copy the “cricket-conf.pl.sample” file to “cricket-conf.pl” and edit it to define your installation locations. The pertinent bits of mine are as follows:

$gCricketHome = "/cricket-1.0.3"; $gInstallRoot = "$gCricketHome"; $gConfigRoot = "$gCricketHome/cricket-config"; $gDbAccess = "slurp"; # Slurp the database into memory $gCacheDir = "/temp/cricket-cache";

Note: You will have to create target directories such as “cricket-cache” as you specify them.

Note: When you specify directories in Perl scripts use forward slashes in place of Windows´ back slashes.

Note: RRD doesn't like the colon in “C:/cricket-1.0.3” so omit it. If you want to put your installation on different drives you will need to escape the colon. Search the cricket-users list for help on that.

Edit “grapher.cgi” to show your cricket config root. Search for “||= 'cricket-config';” and edit it as shown below.

[…] eval "require '/usr/local/etc/cricket-conf.pl'" unless $Common::global::gInstallRoot; $Common::global::gInstallRoot ||= $programdir; $Common::global::gConfigRoot ||= '/cricket-1.0.3/cricket-config'; $Common::global::isGrapher = 1; […]

Edit the file “subtree-sets” to indicate which trees will be processed and where your Cricket logs will be. Since I installed Cricket to “C:\cricket-1.0.3” my “subtree-sets” looks like the following:

# This file lists the subtrees that will be processed together in one # set. See the comments at the beginning of collect-subtrees for more info. # This will be passed to collector so it can find the Config Tree. # If this directory does not start with a slash, it will # have $HOME prepended. base: cricket-config # this is where logs will be put. (The $HOME rule applies here too.) logdir: /cricket-1.0.3/cricket-logs set normal: /routers /router-interfaces

Now make a cricket configuration as described in “beginner.txt”. Briefly, the “sample-config” tree gets copied to “cricket-config” and modified so that you're using only two of the subtrees, “routers” and “router-interfaces”, to start with. Pare this down to just one or two devices to get going. Your “cricket-config/” directory hierarchy should look like:

/cricket-config/ Defaults /cricket-config/routers/ Defaults Targets /cricket-config/router-interfaces/ Defaults Interfaces

Edit the “/routers/targets” file to point to your device and remove the sample devices.

Here's an example of a “Targets” file:

target 129.1.1.1 target-type = Cisco-2500-Router short-desc = "Penton Routerman" snmp-community = private #target main-router # target-type = Cisco-7500-Router # short-desc = "Main router"

Set up your “router-interfaces” subtree as described in “beginner.txt”. Briefly:

C:\cricket-1.0.3\util>perl listInterfaces 128.1.4.220 public > Interfaces

This creates an “interfaces” file you place in your “router-interfaces” subtree.

After making any changes to your “cricket-config” you need to run “compile”.

C:\>perl compile
Cricket should compile your router example and create a “/cricket-config/config.db
C:\>perl collector
Cricket should create the RRD files in the newly formed “C:\cricket-1.0.3\cricket-data” directory.

Run collector with the “debug” option to catch potential errors. “C:\cricket-1.0.3>perl collector -loglevel debug

Run the “collector” again to see if you're collecting data. If you're collecting data then congratulations!

Whenever you change the “config tree” remember to run “compile” again.

Set up a scheduled task to run collector every 5 minutes. Create a batch file called “runcricket.bat” as follows:

perl c:\cricket-1.0.3\collector -logLevel error exit

Run the “AddTask” wizard in scheduled tasks and specify the batch file. Click “Yes” to edit the advanced properties and set the task to repeat every 5 minutes for a duration of 24 hours. If you run the task as the logged in user you will see it execute. If you run the task as a different user it will execute invisibly.

Web Server Setup

You want to make your cricket home directory a virtual directory on your web server. Read “/perl/html/faq/windows/ActivePerl-Winfaq6.html” It is ActivePerl's Win32 FAQ for Web Server Configuration. Microsoft IIS is not setup to use Perl CGI scripts by default. You have to configure IIS. Follow the faq to map the “.cgi” and “.pl” extensions to “C:\perl\bin\perl.exe %s %s” and “.rrdcgi” to “\RRD_Dir\src\rrd_cgi_release\rrd_cgi.exe %s $s

I have configured “C:\cricket-1.0.3” as the virtual www directory “/cricket” with execute permission only and “C:/cricket-1.0.3/images” as the virtual www directory “/cricket/images” with read permission.

Test your Cricket installation by using your web browser: “http://yourwebsite/cricket/grapher.cgi”.

Hopefully that's it. Enjoy.