Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

How to print out Nagios Service UP Time Percentage from Nagios-Report Perl Module

by kunus (Initiate)
on Jan 17, 2013 at 08:48 UTC ( #1013730=perlquestion: print w/ replies, xml ) Need Help??
kunus has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

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

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

Thanks.

#!/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() ;

Comment on How to print out Nagios Service UP Time Percentage from Nagios-Report Perl Module
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1013730]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2015-07-06 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (80 votes), past polls