You are here

Litle Bug in check_mysql_performance (Opsview Enterprise 4.4.0)

3 posts / 0 new
Last post
cxouser
cxouser's picture
Litle Bug in check_mysql_performance (Opsview Enterprise 4.4.0)

I found a litle Bug in the check_mysql_performance

the check fails then current time an last time is the same eq 0

Error

Illegal division by zero at /usr/local/nagios/libexec/check_mysql_performance2 line 726.

 

i add this on line 724

####

        if ( $time eq "0" ){
                $time = "1";
        }

######

 

Orginal File

##########################################

sub rate {
    my ( $self, $method, @params_to_method ) = @_;

    my $delta = $self->$method(@params_to_method);
    my $time  = $self->{'current'}->{'ts'} - $self->{'last'}->{'ts'};

    my $rates = {};
    foreach my $item ( keys %$delta ) {
        $rates->{$item} = $delta->{$item} / $time;
    }

    return $rates;
}

##########################################

Cange to

##########################################

sub rate {
    my ( $self, $method, @params_to_method ) = @_;

    my $delta = $self->$method(@params_to_method);
    my $time  = $self->{'current'}->{'ts'} - $self->{'last'}->{'ts'};

        if ( $time eq "0" ){
                $time = "1";
        }

    my $rates = {};
    foreach my $item ( keys %$delta ) {
        $rates->{$item} = $delta->{$item} / $time;
    }

    return $rates;
}
##########################################

 

csterley
csterley's picture
Re: Litle Bug in check_mysql_performance (Opsview Enterprise ...

Is this fix/change going to be incorporated into future releases?

smarsh
smarsh's picture
Re: Litle Bug in check_mysql_performance (Opsview Enterprise ...

Hello,

Could one of you raise this with via the official support channel as a bug? I would stress again that this is a community resource so there are no guarantees that anything posted in here will be seen by the dev team.

Best regards

Sam