Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2018-01-18 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (208 votes). Check out past polls.

    Notices?