Linux Training

Linux training for private, public & voluntary sector.

0793 572 8612

City LinUX sample scripts - chkup

NAME

chkup - checks that host is up and specified ports are available.

SYNOPSIS

chkup [ -c <config_file> ] [ -d ] [ -l ] [ -r <rcpt_email_addr> ] [ -v ] < clientid >

AVAILABILITY

chkup is a Bourne shell script which should work equally well on all versions of UNIX, Linux and Mac OS X.

DESCRIPTION

chkup uses nmap to check that specified ports are open on a remote host. This functionality duplicates a small part of that in chkfw but I find is useful for those clients that have sites to which I have no access but which nevertheless need monitoring.

NB . A short client id is normally given in preference to a host name on the command line. This is used to identify the configuration stanza in the configuration file which will have the required hostname or IP address. If no configuration file is found or if the client id is not found in the configuration file chkup will assume that clientid=hostname .

OPTIONS

-c    Use the specified configuration file in preference to the default "/usr/local/etc/chkup.cf" . If no configuration file is found the script will attempt to soldier on with the information it has from the command line.

-l    Use the local syslog facility to record the results of the check.

-r <email_address> Send alerts to the specified user address. This will be used in preference to the recipient specified in the configuration file and is useful when testing the script. If no recipient is specified either on the command line nor in the configuration file chkup will send alerts to the invoking user's local mailbox.

-d    Start in debug mode. The -x    option is set within the shell.

-v    Set verbose mode. Ordinarily chkup operates silently unless show stopping problems are detected. In verbose mode chkup reports on each significant action.

EXAMPLES

chkup -l -v merlin

Check that ports specified in the default configuration file, "/usr/local/chkup.cf" , are available on the host merlin and log the the results using the syslog facility.

Verbose mode will be used causing chkup to report significant actions to standard out or standard error.

chkup www.fulford.net

The script will check the configuration file for the client id "www.fulford.net". If no entry is found, as seems likely, "www.fulford.net" will be assumed to be a hostname and nmap will be run with the " -Pn " option. No ports will be specified.

BUGS

The script is quite crude having very little error checking. The consequences of unexpected input are untested. Where multiple ports are checked if any are open this is reported as success. This needs dealing with urgently.

SEE ALSO

chkdf, chkftpd, chkfw, clean, secscan.

AUTHOR

Clifford W Fulford, City Linux. Contact fulford@fulford.net or +44 (0)709 229 5385.


The layout and associated style sheets for this page are taken from the World Wide Web Consortium and used here under the W3C software licence.