I can print out Host UP Time percentage from Nagios-Report Perl Module with following code:
#!/usr/bin/perl
use strict ;
use Nagios::Report ;
my $x = Nagios::Report->new(q<local_cgi localhost nagiosadmin>)
or die "Can't construct Nagios::Report object." ;
$x->mkreport(
[ qw(HOST_NAME PERCENT_TOTAL_TIME_UP) ],
sub {
my %F = @_; my $u = $F{PERCENT_TOTAL_TIME_UP}; $u =~ s/%//;
},
0,
sub {
my $F = shift @_ ;
}
) ;
$x->debug_dump ;
But How can I only print out Service UP Time Percentage? I mean only output the percentage value.
I tried many options but couldn't get it right.
service
. For example, the following text hints at the usage:HOST_OR_SERVICE is an optional scalar specifying the service report instead of the host report. If not set, the host report is produced.
– Dockery