Skip to content

The status of the "Query Rate" service return a critical state and with the message "(return code of 25 is out of bounds)" at each check #4

@iceripper

Description

@iceripper

Problem:
If one falls in the case of nominal (OK), the method "mode_lastrun_varcomp" returns an uninitialized value of the variable "$ comp_res_code".
The variable "$ comp_res_code" is used in line 99:
if ($comp_res_code == WARNING) { …}
in the bloc of code:
case /varcomp/ {…}

Since its value is zero, we will systematically have the following error:
Use of uninitialized value $comp_res_code in numeric eq (==) at ./mysql_health_check.pl line 99.
Use of uninitialized value $comp_res_code in numeric eq (==) at ./mysql_health_check.pl line 102.
Use of uninitialized value $code in hash element at /usr/share/perl5/vendor_perl/Nagios/Plugin.pm line 177.
Use of uninitialized value $code in concatenation (.) or string at /usr/share/perl5/vendor_perl/Nagios/Plugin.pm line 177.
Invalid error code '' at ./mysql_health_check.pl line 110

Solution:

Initialize the return variable "$ comp_res_code" in the case of "OK", in the last block of else of the method "mode_lastrun_varcomp":
sub mode_lastrun_varcomp
{
......
} else {
pdebug("Parsed ($parsed_expr) = ($expr_res) | (".$expr_res . $np->opts->comparison_critical.") == (".$expr_res . $np->opts->comparison_warning.") == FALSE\n");
$comp_res_code = OK;
}
return $comp_res_code, $expr_res;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions