This is the README file for the program netserver-portcheck 1.0.0 I threw it together pretty quick, so if you feel I'm missing anything or see a discrepency (spelling?) email me. This program is used to check modem status on 3com Total Control-style chassises w/netserver cards. If the modem status is anything other than "A R P" it will mail/page the trouble-ports to the addresses defined in the program. Files in this package: netserver-portcheck.c - The main port checking program. Compile on Linux, SunOS, and Solaris machines with: gcc -o netserver-portcheck netserver-portcheck.c For other systems, see source code comments. usrchk.cfg - Default config file that the program reads to get its options and dialup server info. Program reads it from /etc/usrchk.cfg by default. INSTALLATION ------------ 1. Copy usrchk.cfg to /etc or wherever you want it installed. Preferably OUTSIDE a web-accessible directory. If you already run my usrchk program, you should already have one of these and don't need another. 2. Copy netserver-portcheck.c to wherever you want it installed. If you installed usrchk.cfg into somewhere other than /etc, edit the CONF #define in netserver-portcheck.c to specify where. 3. Edit the user-definable variables in netserver-portcheck.c 4. Compile netserver-portcheck.c. Usually "gcc -o netserver-portcheck netserver-portcheck.c" 5. Configure usrchk.cfg for your hosts as per instructions below. 6. See usage instructions below SETTING UP THE CONFIG FILE -------------------------- The config file (defined by #define CONF in netserver-portcheck.c) is used so the program doesn't have to be recompiled when a change to frequently changed dialup server info is made. By default it looks for it in /etc/usrchk.cfg. Since this file contains your dialup server passwords, make sure it's only readable by the netserver-portcheck program, if you have other users on the server you're running this off. Variable settings in this file are preceeded with a "VARIABLE_NAME: " reference. NOTE no spaces before the : and a space after the colon and before the value. Comments in the file explains what each variable does. The last set of variables if the chassis information. The syntax of each line is as follows: BOX: the syntax above may wrap in your editor, please be aware that all variables go on a SINGLE LINE. FOR THIS NETSERVER-PORT CHECK PROGRAM THE FOLLOWING VARIABLES ARE *NOT* USED, BUT KEPT FOR FORMATTING REASONS IF YOU RUN MY USRCHK PROGRAM: Hostname is the ip and location designation letter. If 1 chassis is used for serveral cities, the letter breaks the city into a seperate table and makes the identifier unique. This is like the opposite of the group concept (usrchk program). See sample config file for examples. MUST be set to 0 for netserver-portcheck program usage, this defines netserver type chassis (1 is hyperarc) USAGE ----- You can run the program 2 ways. 1) From the command line From the command line you can use the program to check and report. Just type the program name. 2) From crontab to do timed checking (preferred) * Set up a crontab entry for the netserver-portcheck program. I run mine every 5 minutes like this: */5 * * * * /path/to/netserver-portcheck * Be sure to restart the cron daemon the structure variables are defined as follows (IN NO PARTICULAR ORDER): char groupname[32]; /* location group this chassis is in */ char hostname[32]; /* ip and location designation letter, if */ /* 1 chassis is used for several cities */ /* the letter breaks the city into a seperate */ /* table and makes the identifier unique */ char username[32]; /* username to log in to the chassis */ char password[32]; /* password for said username */ char name[32]; /* Table header if output is in HTML */ int linestotal; /* how many total available lines on this box */ int beforekill; /* how many lines should be active before we start killing users past KILL_TOTAL */ char startport[15]; /* for hiperarc, the slot we're in to search */ char lastport[15]; /* up to what port/slot do we want to check? */ /* for hiperarc this is the slot immediately */ /* after the last slot we want to check i.e. */ /* to check up to including slot 15, set the */ /* lastport at slot:16 */ int sortTime; /* 0 - sort by port, ascending */ /* 1 - sort by session time, ascending */ int type; /* 0 - netserver 1 - hiperarc */ Please fire off some email to me if you find this program useful. Anthony J. Biacco thelittleprince@asteroid-b612.org