Linux Training

Linux training for private, public & voluntary sector.

0800 024 8425

City LinUX sample scripts - report

NAME

report grabs monitoring activity information from the log files and generates a pdf report suitable for mailing to a client.

SYNOPSIS

report [ -c ] [ -d ] [ -e <e-mail_rcpts> ] [ -o <output_dir> ] [ -s ] [ -v ] [ -V ] <hostid>

AVAILABILITY

report is a Bourne shell script which should work equally well on all versions of UNIX and Linux.

DESCRIPTION

The script is currently hardwired to find explicit strings known to be used in logging activity by other City\ Linux scripts (e.g. chkfw, chkdf etc). A configurable template for the report is combined with the extracted log file data using GNU's gawk to generate a groff document with ms macros. A postscript file is generated from which a pdf file is created using ps2pdf.

The hostid must be given on the command line. The hostid may be the hostname of the subject of the report but I frequently find that in these times when canonical hostnames are so often complex names automatically generated by internet service providers and with no reverse lookup, it is more efficient to use a local id for the clients box which can be resolved through local lookup tables or inserted into the local domains name space.

Templates are kept in the directory " /usr/local/etc/reports.d " with the file name hostid .

OPTIONS

-c    Generate a report for the current month.

-d    Set debug mode on.

-e <e-mail_rcpts>
The completed report is emailed to the addresses given with the -e    option. The .IR e-mail recipients may be a comma separated list of email addresses .

-o    <output_directory>
Both postscript and portable document format (.pdf) copies of the report are generated. The reports are output to directory set with the -o    option or "$HOME./clients/$hostid/reports" by default. If the directory does not exist it is created.

-s    Display (show) the report on screen.

-v   
Set the operation mode of the script to verbose. In verbose mode The script will echo progress messages and alerts to standard out .

-V    Print the version number to screen and exit.

EXAMPLES

report -m Nov fcl 

Create a report for the host id " fcl " using log records generated in November.

FILES

/var/log/messages, /var/log/reports/<hostid>.<month>.db, /usr/local/etc/reports.d/<hostid>.

BUGS

The script has very little input error checking.

SEE ALSO

chkdf, chkftpd, chkfw, chkmail, ftchbkup, rclean, rmq, plbkup, 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.