#!/usr/bin/perl
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 Nagios_Server Auth_Nagios_User Auth_PW>, [q<24x7>])
or die "Can't construct Nagios::Report object." ;
# Only display these fields in this order.
my @these_fields = qw(
HOST_NAME
DOWN
UP
OUTAGE
) ;
$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
undef,
# Munge callback
undef,
# Enumerate outages.
1,
) ;
$x->debug_dump(40, 4) ;