head	1.2;
access;
symbols;
locks
	sh1517:1.2; strict;
comment	@# @;


1.2
date	2005.12.18.05.46.30;	author sh1517;	state Exp;
branches;
next	1.1;

1.1
date	2005.10.30.21.37.58;	author sh1517;	state Exp;
branches;
next	;


desc
@@


1.2
log
@1 Add auth parms to local_cgi data source tag.
@
text
@#!/usr/bin/perl

# $Id: ex4b_e,v 1.1 2005-10-31 08:37:58+11 sh1517 Exp sh1517 $

# $Log: ex4b_e,v $
# Revision 1.1  2005-10-31 08:37:58+11  sh1517
# Initial revision
#

use strict ;

use Nagios::Report ;

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

sub by_down_time { 
  my %f = @@_ ;
  my $d = $f{TOTAL_TIME_DOWN} ;
  my $u = $f{TOTAL_TIME_UNREACHABLE} ;
							# $a, $b are package globals (in same package as sort call)
							# ==> if the callback refers to $a and $b in the default
							# package (main::), they will have null values in the
							# package where the sort takes place.
  package Nagios::Report ;
  my $x = $a->[$d] >= $a->[$u] ? $a->[$d] : $a->[$u] ;
  my $y = $b->[$d] >= $b->[$u] ? $b->[$d] : $b->[$u] ;
  $y <=> $x ;
}

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

		sub {
			my %F = @@_;
			my $u = $F{PERCENT_TOTAL_TIME_UP}; $u =~ s/%//;
			$u < 98 && $F{HOST_NAME} !~ /^Bend/
		    },

		\&by_down_time,

		sub {	$_ = shift @@_; my %F = @@_;
			my $d = $F{TOTAL_TIME_DOWN} ;
			my $u = $F{TOTAL_TIME_UNREACHABLE} ;
			push @@$_, 
				&Nagios::Report::time2ddhhmmss($d),
				&Nagios::Report::time2ddhhmmss($u) ;
			qw(TIME_DOWN_HHMMSS TIME_UNREACH_HHMMSS)
		}
) ;



$x->excel_dump ;
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
# $Id$
d5 4
a8 1
# $Log$
d14 1
a14 1
my $x = Nagios::Report->new(q<local_cgi>)
@
