CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
How to print out Nagios Service UP Time Percentage from Nagios-Report Perl Module

 



kunus
New User

Jan 17, 2013, 12:35 AM

Post #1 of 2 (3165 views)
How to print out Nagios Service UP Time Percentage from Nagios-Report Perl Module Can't Post

Hello,

According to this module:
http://search.cpan.org/~hopcrofts/Nagios-Report-0.003/

This will produce Service UP Time Report, but How can I only retrieve UP Time percentage value instead of full report?

Thanks.

Code
#!/usr/bin/perl 
use strict ;

use Nagios::Report ;

my $x = Nagios::Report->new(
# Data source
q<local_cgi localhost nagiosadmin>,
# Report period
[ qw(24x7) ],
# Time period
'last7days',
# Service report
1,
# Pre-filter
sub { my %F = @_; my $u = $F{PERCENT_TOTAL_TIME_OK}; $u =~ s/%//; $u < 100 }
)
or die "Can't construct Nagios::Report object." ;

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

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

undef,

undef,

1,

) ;

$x->debug_dump() ;



wickedxter
User

Jan 25, 2013, 2:13 PM

Post #2 of 2 (2965 views)
Re: [kunus] How to print out Nagios Service UP Time Percentage from Nagios-Report Perl Module [In reply to] Can't Post

change your array of headers to only UP ... the module says it will return only the headers you supply in the array..

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives