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


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

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

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


desc
@@


1.3
log
@1 After changes to report to supply CGI auth data as white space sep
  values following the local_cgi data source tag.
@
text
@#!/usr/bin/perl

# $Id: ex1e,v 1.2 2005-11-17 19:21:15+11 sh1517 Exp sh1517 $

# $Log: ex1e,v $
# Revision 1.2  2005-11-17 19:21:15+11  sh1517
# 1 Only report on hostnames matching the regex argument.
#
# Revision 1.1  2005-10-31 20:18:35+11  sh1517
# Initial revision
#

use strict ;

use Nagios::Report ;

my $hostname_re = shift @@ARGV ;
$hostname_re
  or die <<USAGE;
$0 <hostname | hostname_pattern>

Extracts Nagios Availability report data for host(s) matching the regex argument.
eg $0 ^Alb
USAGE

my $host_re = qr/$hostname_re/ 
  or die "Can't compile hostname regex '$hostname_re'." ;

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


							# Only display these fields in this order.
my @@these_fields = qw(
  HOST_NAME
  TOTAL_TIME_DOWN
  PERCENT_TOTAL_TIME_DOWN
  PERCENT_TOTAL_TIME_UP
  AVAIL_URL
) ;

$x->mkreport(
							# Display these fields only (in the order of the list)


		\@@these_fields,
							# Record selector


		sub { my %F = @@_; my $h = $F{HOST_NAME}; $h =~ /$host_re/ },

							# Sort order

		# sub { my %f = @@_; package Nagios::Report; $a->[$f{HOST_NAME}] cmp $b->[$f{HOST_NAME}] }
) ;

$x->debug_dump(290, 4) ;
@


1.2
log
@1 Only report on hostnames matching the regex argument.
@
text
@d3 1
a3 1
# $Id: ex1d,v 1.1 2005-10-31 20:18:35+11 sh1517 Exp sh1517 $
d5 4
a8 1
# $Log: ex1d,v $
d29 1
a29 1
my $x = Nagios::Report->new(q<local_cgi>, [q<24x7>])
a31 1
							# my $x = Nagios::Report->new(q<dev_debug>, q<test>)
d39 1
d57 1
a57 1
$x->debug_dump(35, 4) ;
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
# $Id$
d5 4
a8 1
# $Log$
d14 13
a26 1
my $x = Nagios::Report->new(q<dev_debug>, q<Test>)
d29 10
d40 10
a49 5
							# Display all fields
		[],
							# Record selector - take them all
		sub { 1 },
							# Sort order - by HOST_NAME
d51 1
a51 1
		sub { my %f = @@_; package Nagios::Report; $a->[$f{HOST_NAME}] cmp $b->[$f{HOST_NAME}] }
d54 1
a54 1
$x->debug_dump(17, 9) ;
@
