#!/usr/bin/perl

# $Id: ex4b,v 1.3 2005-12-18 16:45:23+11 sh1517 Exp sh1517 $

# $Log: ex4b,v $
# Revision 1.3  2005-12-18 16:45:23+11  sh1517
# 1 Add auth parms to local_cgi data source tag (in constructor).
#
# Revision 1.2  2005-11-08 12:09:22+11  sh1517
# 1 Replace sort subroutine by use of comp().
#
# Revision 1.1  2005-10-31 08:37:54+11  sh1517
# Initial revision
#

use strict ;

use Nagios::Report ;

my $x = Nagios::Report->new(q<local_cgi NagServer AuthUser>)
  or die "Can't construct Nagios::Report object." ;

$x->mkreport(
		[ qw(HOST_NAME PERCENT_TOTAL_TIME_UP TOTAL_TIME_DOWN TIME_DOWN_HMS TOTAL_TIME_UNREACHABLE TIME_UNREACH_HMS) ],

		sub {
			my %F = @_; my $u = $F{PERCENT_TOTAL_TIME_UP}; $u =~ s/%//; $u < 100
		    },

		&comp( alpha => 0, ascend => 0, fields => [qw(TOTAL_TIME_DOWN TOTAL_TIME_UNREACHABLE)] ),

		sub {	$_ = shift @_; my %F = @_;
			my $d = $F{TOTAL_TIME_DOWN} ;
			my $u = $F{TOTAL_TIME_UNREACHABLE} ;
			push @$_, 
				&t2hms($d),
				&t2hms($u) ;
			qw(TIME_DOWN_HMS TIME_UNREACH_HMS)
		}
) ;



$x->debug_dump ;
