Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 17th, 2013, 02:41 AM
kunus kunus is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 kunus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 43 sec
Reputation Power: 0
How to print out Nagios Service UP Time Percentage from Nagios-Report Perl Module

Hello,

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

Following code 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() ;

Reply With Quote
  #2  
Old January 17th, 2013, 06:15 AM
Laurent_R Laurent_R is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2012
Posts: 507 Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Days 19 h 10 m 16 sec
Reputation Power: 385
I don't know this module, but you might just filter out what you don't need in the report.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > How to print out Nagios Service UP Time Percentage from Nagios-Report Perl Module

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap