#############################################################################
# Josh Yost, Steve Rader
# written: 08.15.06
# updated: 08.23.06
# v. 1.0.10
#

Tested under Perl v5.8.8, i686-gentoo-linux 2006.0, & Nagios-core 2.x
...........  Perl v5.6.1, Redhat 7.3, Nagios 1

LICENSE:
	Licensed under the GPL w/ absolutely no warranty of any kind. Please
let me know if this is any help to you. =)

BUGS & PATCHES:
	mailto : joshyost@gmail.com

Note: version 1.0.10 currently requires Term::ReadKey.

#############################################################################
THE POINT:
	This program will parse your Nagios log and generate a summary report
of service or host alerts.  It will output lines that are fit to your screen
by default.  You can change the column width and column order in the .cf
file (see below for an example).

By default, it will display the following information:
  - Time host/service went down
  - Time host/service came back up
  - host and/or service name
  - shortened plugin output
  - the duration of the downtime

The default actions of the program are as follows:
  - it will parse the log file found at : /var/nagios/nagios.log
  - it will summarize alerts for the entire log file
  - it will only display hard alerts
  - it will only display critical alerts
  - it will only display service alerts
  - the rows are sorted by 'Date & Time Down'

With the option flags, you can change any or all of this default behavior.
The following options are enabled:

  -c,--conf=str		point the program to an alternate cf file
  -f,--file=str		manually targets a different log file
  -H,--host 		print out the host down alert summary
  -o,--sort=str		sort by any desired column
  -n,--noauto		don't auto-fit the columns to your screen
  -s,--soft		summarize soft and hard alerts
  -S,--state=str	select 'down','critical','warning',or 'both'
  -t,--today		only print a summary of today's alerts
  -v,--verbose		print out a bunch of extra junk
  -V,--version		show version info
  -y,--yesterday	only print a summary of yesterday's alerts
  -                     read input from STDIN (must be last in the option list)

#############################################################################
INSTALLATION:
	This perl script comes w/ a nagiosr.cf configuration file, which it
expects to find at /usr/local/etc/nagiosr.cf; you can use the -c flag to 
change this. It will need read permissions to parse your Nagios log files.

	To be fully effective for your site, you will have to do a little
work to update the *_hook functions in the .cf file.  You'll need to edit and 
add to the regular expressions as you see fit to correctly shorten your 
hostnames, service names, and plugin output.

   #### The variables you'll need to edit (if you care to): ####
  
  - name_hook - this shortens the names of the hosts and services; 
	
  PLEASE NOTE : I am passing the host and service strings separately to the
                name_hook() function, so you could use REs such as 
                's/host1.*/host1/' w/out any ill effects.

  - service_plugin_hook - this shortens the output of the service plugins
  - host_plugin_hook    - this shortens the output of the host plugins

#############################################################################
CONF FILE:
	The configuration file is handled in a <name> = <value> manner. You
can have more than one space around the '=' sign, if you wish.  Blank lines
and lines beginning w/ '#' are ignored.

#############################################################################
FORMATTING:
	Formatting is now handled in the .cf file.  Default column titles are
defined, but you can change any and all column headings if you wish with the
svc_header and host_header directives.
	Column width is defined in the 'format =' line.  This is similar to 
Perl's format function, but it is somewhat condensed.  The correct use is:

format = @<17 @<17 @|45 @>9,$timedown,$timeup,$descr_and_plugout,$duration

	The @ identifies a regular variable, the < or | or > sets the 
text justification, and the number sets the actual width.  So '@<21' is a 
left-justified column that is 22 spaces wide (note that the function adds a space).
	You then set the column order w/ a comma-delimited list of column names.
You may omit columns if you wish, but the column order must (currently) stay
the same as above.











