Portmon 2.0, by Nik Reiman, <nik@aboleo.net>

Introduction:
Portmon is a program to monitor a number of remote hosts based on port
numbers.  This is very useful when you want to keep track of several
daemons of different (or the same) host, to see if they go down.  I
originally created this program to monitor the status of a lab of Sun
machines at my work, checking periodically to see if ssh was unavailable at
any time (in which case, I'd be in trouble ;).  This is also a good
indicator that the machine itself may have crashed.

Usage:
To run portmon, simply call it from the command line as a regular user
(root access is *not* necessary...this is a design feature) and force it
into the background with the '&' character or the -d switch.  For more
information on running portmon, see the man portmon(1).
Portmon requires that you set up a file of hosts and the port numbers you
wish to monitor.  The format of the file is very simple; one host per line,
and some whitespace separating the hostname and the port number (in that
order).  For instance, the hosts file may look like:

ftp.foo.com 21
mail.foo.com 25

...and so forth.  Portmon will by default look for the file ./hosts, or you
can specify it on the command line with the -c option.  Comments are any
line with a '#' character in the front.
Upon being unable to contact a given host, portmon will by default send an
email to root@localhost.  To change this, you'll need to edit the action.c
file, which isn't that difficult.  Just go through the comments, and you'll
be fine. =)  Additionally, the -e switch can be used to specify another
program to run.
Portmon will sleep for one hour between trying to contact the hosts in its
list.  This can be altered with the -n switch.

Contact:
Please send all bugfixes, patches, or flames to nik@aboleo.net.
