Installing Cricket on NT 4.0

Revised 3/29/00

Note: This document tells you how to take perfectly good software and scripts (Cricket by Jeff Allen), tweaking, editing, fiddling so it will run on Windows NT. I cannot guarantee that these steps will work for you, but it describes what worked for me. Jz.

(Along with this document, print or read the 'FAQ' and 'beginner.txt')

This all starts with Perl. You should be using Perl 5.004 or higher. Check it by running

C:\>perl -V

From the Command Prompt. The following is an example of mine:

Characteristics of this binary (from libperl):

Locally applied patches:

ActivePerl Build 516

Built under MSWin32

Compiled at May 14 1999 19:54:31

@INC:

C:/Perl/lib

C:/Perl/site/lib

Notice I'm using "ActivePerl" from "http://www.activestate.com/ActivePerl". "ActivePerl" is available under the GNU General Public License. For the sake of this document, I'll be referring to setting up Cricket for "ActivePerl".

Installing Modules for Perl

My Perl came with a "Perl Package Manager". By typing in "PPM" from the Command Prompt I could enter the package manager and "query" which modules were already installed with my copy of Perl. However it is that you install Perl modules for your copy of Perl, the following are the modules that you without a doubt need. Make no shortcuts here. Make sure all the following are installed and installed correctly.

Module From

MD5 CPAN: by-authors/id/GAAS/Digest-MD5-*.tar.gz

LWP CPAN: by-authors/id/GAAS/libwww-perl-*.tar.gz

DB_File CPAN: by-authors/id/PMQS/DB_File-*.tar.gz

Date::Parse CPAN: by-authors/id/GBARR/Timedate-*.tar.gz

Time::HiRes CPAN: by-authors/id/DEWEG/Time-HiRes-*.tar.gz

SNMP_Session http://www.switch.ch/misc/leinen/snmp/perl

RRD http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool

CPAN is the "Comprehensive Perl Archive Network". I did a web search for CPAN sites to download modules from. Check out the Perl FAQ at :

ftp://ftp.cs.colorado.edu/pub/perl/CPAN/doc/FAQs/FAQ/PerlFAQ.html

Installing RRDTools Modules for Perl

Read Carefully! Read you Perl documentation!

Change directory to where you have RRD Tools unzipped, untarred, whatever.

Change directory to the 'perl-shared' directory. There should be a 'Makefile' in this directory as well as 'Makefile.PL'. If not, you need to download a version of RRD Tools that has all these makefile goodies. 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 'make' utility, (if you don't have it, get it from ftp://ftp.microsoft.com/SoftLib/MSLfiles/nmake15.exe)

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

By using PPM's "query" command you should see a list of all installed modules. 

Extract Cricket to 'Your Working Directory'

Extract the Cricket 'tar.gz' files. The Cricket files should automatically be placed in 'C:\Cricket-X.XX'. (Where 'X.XX' is the version number. If not, put them there.)

Read 'beginner.txt'. Read the 'FAQ'.

Although much of 'beginner.txt' may not apply to NT installations it is still a good thing to read it.

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 makes certain you have your main perl executable in the path.

Installing SNMP_Session

After downloading the SNMP_Session modules and extracting them to a sub-directory, copy the perl modules to your 'C:\cricket-0.72\lib' directory. (In this case, copying is 'OK').

BER.pm

SNMP_Session.pm

SNMP_util.pm

 

Setting Cricket Up on NT

Edit the file 'subtree-sets' to describe exactly where your Cricket installation is. Since I installed Cricket to 'C:\cricket-0.72' my 'subtree-sets' looks like what follows:

# 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-0.72/cricket-config

# this is where logs will be put. (The $HOME rule applies here too.)

logdir: /cricket-0.72/cricket-logs

set normal:

/routers

/router-interfaces

I hardcoded the 'HOME' variable in the file 'c:\cricket-0.72\lib\common\options.pm'. I changed the line

$ENV{'HOME'} = '' unless (defined($ENV{'HOME'}));

to

$ENV{'HOME'} = '/cricket-0.72';

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. Here's an example of my '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"

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

 C:\>perl compile

 (Cricket should compile your router example)

 C:\>perl collector

 (Cricket should create the RRD files in the newly formed 'C:\cricket-0.72\cricket-data').

 What I saw on my screen looked like this:

 C:\cricket-0.72>perl cricket-compile

[13-Mar-2000 16:29:17 ] Starting compile: Cricket version 0.72 ( Sun Jan 23 23:54:35 PST 2000 )

[13-Mar-2000 16:29:17 ] Processed 3 nodes (in 3 files) in 1 seconds.

C:\cricket-0.72>

 Run collector with the 'debug' option to catch potential errors.

 C:\cricket-0.72>perl collector -loglevel debug

 

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

C:\cricket-0.72\util>perl listinterfaces 128.1.4.220 public > interfaces

Creates an 'interfaces' file you place in your 'router-interfaces' subtree. Whenever you change the 'config tree' remember to run 'compile' again. Run the 'collector' again to see if you're collecting data. If you're collecting data then congratulations!

Run 'collector' from 'cron'

In 'NT' speak 'cron' would mean 'NT Scheduler service'. Create a batch file and run it every five minutes.

@echo off

c:

cd\cricket-0.72

call c:\perl\bin\perl.exe c:\cricket-0.72\collector

exit

 

Grapher.cgi

To run the grapher you need to have a working web-site on your NT server.

Since I'm using Microsoft IIS 4.0 my root directory for my web server is ' C:\InetPub\wwwroot'. I copied the following to my web server root-directory.

Grapher.cgi, Mini-graph.cgi, Version, C:\cricket-072\lib (cricket's lib directory), C:\cricket-0.72\images (cricket's images directory)

It's far better to make your cricket home directory a virtual directory on your web server.

Read 'PerlWin32Faq6.html' from ActiveState's 'ActivePerl'. 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.

Edit 'grapher.cgi'. Change:

# If this variable does not start with /, $HOME will

# be prepended. Special care is taken to set $HOME right,

# even when running as user nobody (see fixHome for info).

$Common::global::gConfigRoot = '/cricket-config'; # i.e. $HOME/config

to. . .

# If this variable does not start with /, $HOME will

# be prepended. Special care is taken to set $HOME right,

# even when running as user nobody (see fixHome for info).

$Common::global::gConfigRoot = '/cricket-0.72/cricket-config'; # i.e. $HOME/config

Edit 'mini-graph.cgi': Change:

if (!defined($mtime) || ((time() - $mtime) > $main::gPollingInterval)) {

# this request is actually going to need work... pass it on

exec("$gInstallRoot/grapher.cgi");

} else {

Debug("Cached image exists. Using that.");

sprayGif($imageName);

}

to

if (!defined($mtime) || ((time() - $mtime) > $main::gPollingInterval)) {

# this request is actually going to need work... pass it on

exec("perl $gInstallRoot/grapher.cgi");

} else {

Debug("Cached image exists. Using that.");

sprayGif($imageName);

}

Test your Cricket installation by using your web browser:

http://yourwebsite/grapher.cgi

Cricket working on NT. My thanks to Jeff Allen for Cricket and his 'beginner.txt' that helped shape this document. Thank You to Tobias Oetiker for his RRDTools! Any questions email me (John Zola jzola@penton.com).

 

Questions or comments, email: John Zola <jzola@penton.com>