Skip Menu |

This queue is for tickets about the Nagios-Report CPAN distribution.

Report information
The Basics
Id: 18189
Status: resolved
Priority: 0/
Queue: Nagios-Report

People
Owner: Nobody in particular
Requestors: hopcrofts [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.001
Fixed in: (no value)



Subject: Alter call back does NOT work as advertised (does not change record field values).
The mkreport() method allows the user to supply a callback (referred to as an alter callback) that claims to let the caller change the values of fields in the availability record by setting the value of the %F hash corresponding to the key with the field names that is to be changed. eg $F{TOTAL_TIME_DOWN} = 0 ; Unofortunately, and pretty obviously, since the %F hash is loaded with copies of the field values, the changes are not applied to the field values in the record (and thence the report). In other words, mkreport() does not at present allow any changes to the fields in the reports other than appending new field values to the record. This creates a problem for those wishing to graph the data (by calling excel_dump() to produce a workbook) with Excel. The Excel graph wizard does not understand numbers with % suffices and so a graph of the Nagios PERECENT fields (eg PERCENT_TOTAL_TIME_UP) requires the % chars be removed by some other means (manually).
This misfeature is fixed with a change in API and docco in versions > 1. eg with Nagios::Report 0.003 [sh1517@acisf011 junk]$ perl -MNagios::Report -e '$x=Nagios::Report- Show quoted text
>new( q<local_cgi nms foo>); $x->mkreport([qw(HOST_NAME
PERCENT_TOTAL_TIME_UP)], sub { %F=@_; ($u=$F{PERCENT_TOTAL_TIME_UP}) =~ s/%//; $u > 99.9 && $u < 100; } , undef , sub { my $F = shift @_; $F->{PERCENT_TOTAL_TIME_UP} =~ s/%$//; (); } ); $x->debug_dump' 24x7 HOST_NAME %_TOTAL_TIME_UP Armidale_ 99.918 Armidale_provider_router 99.930 .... Mind you, you do have to follow the examples or stare at the docco a long time to get the hang of this.