Exercise: installing NOCOL

Building

Nocol is provided as a 'port' and not as a binary 'package'. The building of the port automatically fetches the source code - but to save everyone in the class fetching it separately, we can collect the source tarball from a local FTP server first.

# cd /usr/ports/distfiles
# ftp 137.158.216.129
cd pub/distfiles
get nocol-4.3.tar.gz
quit

Now build as per a normal FreeBSD package

# cd /usr/ports/net/nocol
# make
Give suitable answers to questions, or accept the defaults
# make install

Create a symlink so that users can just type 'nocol':

# ln -s /usr/local/nocol/bin/netconsole /usr/local/bin/nocol

Finally, create a user called 'nocol' which will create the database files, and change the ownership of the directories where nocol needs write access.

# pw useradd nocol -d /usr/local/nocol
# chown -R nocol /usr/local/nocol/run
# chown -R nocol /usr/local/nocol/data

Documentation

There are man pages, but you have to give the correct path to find them. Add the following line to the end of /etc/manpath.config

OPTIONAL_MANPATH      /usr/local/nocol/man

Also check the files contained within the package:

# pkg_info -aI
# pkg_info nocol-4.3
# pkg_info -L nocol-4.3 | less

Basic configuration

# cd /usr/local/nocol/etc
# cp samples/ippingmon-confg .
# vi ippingmon-confg
List machine name on left and IP address on right

Now start the ipping monitor:
# su nocol
$ /usr/local/nocol/bin/ippingmon &
$ exit

(Make sure you always start and stop monitor programs as user 'nocol' otherwise files become owned by root)

Viewing the status

Login as any user (non-root) and type 'nocol'. Use L to switch the display level (1-4, Critical to Info)

Setting up web viewer

Edit /usr/local/nocol/bin/genweb.pl and follow the instructions. In particular, change these two lines:

...
$baseurl =  "http://t2-noc.t2.ws.afnog.org/nocol" ;
...
$webdir  = "/usr/local/www/data/nocol";
...

Then make the required directories, and try running genweb.pl as nocol

# mkdir -p /usr/local/www/data/nocol
# chown nocol /usr/local/www/data/nocol
# cd /usr/local/www/data/nocol
# ln -s Critical.html index.html
# cp -pr /usr/ports/net/nocol/work/nocol-4.3/webnocol/gifs .
(you can also copy warning.wav, error.wav and critical.wav into here)

# su nocol
$ /usr/local/nocol/bin/genweb.pl
$ exit

(P.S. the 'gifs' directory will have been deleted if you did a 'make clean' after installing the package; the packager forgot to include it in the package itself)

Set up the cron job

This automatically updates the web page every minute, and also does some nocol housekeeping (checking that the daemons are running etc)

# crontab -u nocol /usr/local/nocol/bin/crontab.nocol

Then sort out the remaining permission problems (check the mails sent to /var/mail/nocol !)

webnocol.cgi

# cp /usr/local/nocol/bin/webnocol.cgi /usr/local/www/cgi-bin/
# cd /usr/local/nocol/etc
# touch updates
# touch webcookies
# chown nobody updates webcookies
# vi webusers

##   username : encrypted-password : user-level
#
test:OdN5GSkKWJH9o:0

Define userlevel from 0 - 4 (0 is hi privelege like 'root').

Use /usr/local/nocol/bin/docrypt.pl to generated the encrypted passwords.


Last updated 2001-05-11