
kunus
New User
Jan 17, 2013, 12:35 AM
Post #1 of 2
(6469 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.
#!/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() ;
|