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


1.3
date	2005.12.18.05.53.18;	author sh1517;	state Exp;
branches;
next	1.2;

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

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


desc
@@


1.3
log
@1 Add auth parms to the web_page data source tag (formerly hardcoded in class).
@
text
@#!/usr/bin/perl

# $Id: ex5e,v 1.2 2005-11-24 17:45:09+11 sh1517 Exp sh1517 $

# $Log: ex5e,v $
# Revision 1.2  2005-11-24 17:45:09+11  sh1517
# 1 Reduce number of fields displayed (making the report far more usable).
#
# Revision 1.1  2005-11-22 16:05:45+11  sh1517
# Initial revision
#

use strict ;

use Nagios::Report ;
use Getopt::Std ;

use vars qw($opt_t) ;

getopt 't' ;

my $usage = <<USAGE ;

$0 -t <timeperiod>

Displays those hosts with less than 100% total time up during the timeperiod.

timeperiod ::= today | yesterday | thisweek | lastweek | thismonth | lastmonth | thisyear | lastyear
               last12hours | last24hours | last7days | last31days

USAGE

die $usage
  unless $opt_t ;

die $usage
  unless $opt_t =~ /^(?:today|yesterday|this(?:week|month|year)|last(?:week|month|year|24hours|12hours|7days|31days))/ ;

my $x = Nagios::Report->new(q<web_page nms sh1517 Fgsltwhg>, [ qw(24x7) ], $opt_t)
  or die "Can't construct Nagios::Report object." ;

$x->mkreport(
		[ qw(
			HOST_NAME
			PERCENT_TOTAL_TIME_UP
			DOWN
			UP
			OUTAGE
		   )
	       ],

		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)]),

		undef,

		1,
) ;



$x->debug_dump(20) ;
@


1.2
log
@1 Reduce number of fields displayed (making the report far more usable).
@
text
@d3 1
a3 1
# $Id: ex5e,v 1.1 2005-11-22 16:05:45+11 sh1517 Exp sh1517 $
d6 3
a39 1
# my $x = Nagios::Report->new(q<local_cgi>, [ qw(24x7) ], $opt_t)
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
# $Id$
d5 4
a8 1
# $Log$
a43 2
			TOTAL_TIME_DOWN_HMS
			TOTAL_TIME_UNREACHABLE_HMS
d54 1
a54 8
		sub {	$_ = shift @@_; my %F = @@_;
			my $d = $F{TOTAL_TIME_DOWN} ;
			my $u = $F{TOTAL_TIME_UNREACHABLE} ;
			push @@$_, 
				&t2hms($d),
				&t2hms($u) ;
			qw(TOTAL_TIME_DOWN_HMS TOTAL_TIME_UNREACHABLE_HMS)
		},
@
