Skip Menu |

This queue is for tickets about the jmx4perl CPAN distribution.

Report information
The Basics
Id: 78399
Status: resolved
Priority: 0/
Queue: jmx4perl

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

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



Patch to avoid perfdatas like those : metric=,,!true metric=1000,1:,2: Maybe bad code, I'm not a Perl-developer. --- /usr/local/share/perl/5.10.1/JMX/Jmx4Perl/Nagios/SingleCheck.pm.old 2012-07-13 17:13:56.000000000 +0200 +++ /usr/local/share/perl/5.10.1/JMX/Jmx4Perl/Nagios/SingleCheck.pm 2012-07-13 17:26:45.000000000 +0200 @@ -158,10 +158,14 @@ # Performance data. Convert to absolute values before my ($critical,$warning) = $self->_convert_relative_to_absolute($base_value,$self->critical,$self->warning); - $np->add_perfdata(label => $label,value => $value, - critical => $critical,warning => $warning, + { + no warnings 'numeric'; + no warnings 'uninitialized'; + $np->add_perfdata(label => $label,value => $value, + critical => $critical + 0,warning => $warning + 0, min => 0,max => $base_value, $self->unit ? (uom => $self->unit) : ()); + } # Do the real check. my ($code,$mode) = $self->_check_threshhold($rel_value); # For Multichecks, we remember the label of a currently failed check @@ -172,9 +176,13 @@ base_unit => $base_unit, prefix => $opts->{prefix})); } else { # Performance data - $np->add_perfdata(label => $label, - critical => $self->critical, warning => $self->warning, + { + no warnings 'numeric'; + no warnings 'uninitialized'; + $np->add_perfdata(label => $label, + critical => $self->critical + 0, warning => $self->warning + 0, value => $value,$self->unit ? (uom => $self->unit) : ()); + } # Do the real check. my ($code,$mode) = $self->_check_threshhold($value); Thanks !
With the newest Version 1.07 string checks won't add any performance data anymore by default.
Also, you can omitt performance data by using '--perfdata off' (config: PerfData off) also for numeric
checks.

Thanks for pointing this out and sorry for the long delay ...

On Mon Jul 16 09:09:27 2012, pch wrote:
Show quoted text
> Patch to avoid perfdatas like those :
>
> metric=,,!true
> metric=1000,1:,2:
>
> Maybe bad code, I'm not a Perl-developer.
>
> ---
> /usr/local/share/perl/5.10.1/JMX/Jmx4Perl/Nagios/SingleCheck.pm.old
> 2012-07-13 17:13:56.000000000 +0200
> +++ /usr/local/share/perl/5.10.1/JMX/Jmx4Perl/Nagios/SingleCheck.pm
> 2012-07-13 17:26:45.000000000 +0200
> @@ -158,10 +158,14 @@
>
> # Performance data. Convert to absolute values before
>
> my ($critical,$warning) =
> $self->_convert_relative_to_absolute($base_value,$self-
> >critical,$self->warning);
> - $np->add_perfdata(label => $label,value => $value,
> - critical => $critical,warning => $warning,
> + {
> + no warnings 'numeric';
> + no warnings 'uninitialized';
> + $np->add_perfdata(label => $label,value => $value,
> + critical => $critical + 0,warning => $warning + 0,
>
> min => 0,max => $base_value,
>
> $self->unit ? (uom => $self->unit) : ());
> + }
>
> # Do the real check.
>
> my ($code,$mode) = $self->_check_threshhold($rel_value);
>
> # For Multichecks, we remember the label of a currently failed check
> @@ -172,9 +176,13 @@
>
> base_unit => $base_unit, prefix => $opts->{prefix}));
>
> } else {
>
> # Performance data
> - $np->add_perfdata(label => $label,
> - critical => $self->critical, warning => $self->warning,
> + {
> + no warnings 'numeric';
> + no warnings 'uninitialized';
> + $np->add_perfdata(label => $label,
> + critical => $self->critical + 0, warning => $self->warning + 0,
>
> value => $value,$self->unit ? (uom => $self->unit) : ());
> + }
>
> # Do the real check.
>
> my ($code,$mode) = $self->_check_threshhold($value);
>
> Thanks !