Alarm

The alarm program (pinger.c) and associated demo files are freely available. If you make any significant improvements please send me a copy.

Configuration

Edit pinger.c and correctly change the following definitions:

If you use NIS (Yellow Pages) and want it to read the host map:

#define DONIS
If you want it to read a file do not define DONIS and define HOSTFILE:

#define HOSTFILE "/etc/hosts" 
Define MAILRECEIVERS to send mail to all who are to be notified:

#define MAILRECEIVERS "harry,warren"
The code is currently set up to handle two modems. If you would like to add more find the line /********add more modems here**************/ and repeat the code above it for the extra modems. Define the modem lines by defining MODEM# for each modem and NUM_MODEMS for the number you have:

#define MODEM1 "/dev/cua1"
#define MODEM2 "/dev/cua0"
#define NUM_MODEMS 2
Set the default phone number for your calls:

char default_number[]="9,9971234";
Change routers[] to reflect your subnet (The NULL entries are required):

struct hosts_list routers[]={
    {"128.95.174.100","000","174","100",default_number,0,0},
    {"128.95.175.100","000","175","100",default_number,0,0},
    {NULL,NULL,NULL,NULL,NULL,0,0}
};

INPUT File

The program expects the input file (or yp hosts file) to be in the following format:

address	name1 name2 name3... #number# RM-111
where the number of names is undetermined and #number# is the number to dial if a page is made. If this is not there the default_number will be used. This default number can be changed with the -n switch. e.g.

128.95.175.9    damp.atmos.washington.edu damp RM-620
128.95.21.103   orac.biostat.washington.edu #9,999-9999# RM-160

Behavior

The software will test test each machine in the list. At the end of the list it will retry the ones that failed. If they are back it will log the information but not page you. For each machine that is still gone, you will receive a page that looks like:

aaa-bbb--ccc
where aaa is the subnet bbb is the machine and ccc is the room. You will also receive one mail message per pass if machines go down or come back.

Prior to each pass the software checks the routers. If a router dies you will be paged for the router and not all the machines on the net. (if you have all your machines on one subnet you do not want to have any routers. You should just have struct hosts_list routers[]={{NULL,NULL,NULL,NULL,NULL,0,0}};) When the router comes back the software will pick up the machines on that net again.