Nagios check_mysql_health has been failing with plugin error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
mkumarv
Posts: 11
Joined: Tue Mar 11, 2025 2:15 am

Nagios check_mysql_health has been failing with plugin error

Post by mkumarv »

We have migrated our machines from centos to linux 8 version. And after this the Nagios has been upgrade to 4.4.14 version. In which it keeps reporting about the check_mysql_health plugin error.

(No output on stdout) stderr: my variable self masks earlier declaration in same scope at /usr/lib64/nagios/plugins/check_mysql_health line 1064.

Even I am not able to check the plugin version

[root@nagios-data plugins]# ./check_mysql_health -V
"my" variable $self masks earlier declaration in same scope at ./check_mysql_health line 1064.
"my" variable $message masks earlier declaration in same scope at ./check_mysql_health line 1065.
"my" variable $self masks earlier declaration in same scope at ./check_mysql_health line 1070.
"my" variable $message masks earlier declaration in same scope at ./check_mysql_health line 1071.
syntax error at ./check_mysql_health line 1050, near "$llevel qw(CRITICAL WARNING UNKNOWN OK)"
Global symbol "$llevel" requires explicit package name (did you forget to declare "my $llevel"?) at ./check_mysql_health line 1051.
Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at ./check_mysql_health line 1052.
Global symbol "$llevel" requires explicit package name (did you forget to declare "my $llevel"?) at ./check_mysql_health line 1052.
Can't redeclare "my" in "my" at ./check_mysql_health line 1059, near "my"
syntax error at ./check_mysql_health line 1061, near "}"
Can't redeclare "my" in "my" at ./check_mysql_health line 1065, near "my"
syntax error at ./check_mysql_health line 1067, near "}"
Can't redeclare "my" in "my" at ./check_mysql_health line 1071, near "my"
syntax error at ./check_mysql_health line 1073, near "}"
./check_mysql_health has too many errors.
kg2857
Posts: 491
Joined: Wed Apr 12, 2023 5:48 pm

Re: Nagios check_mysql_health has been failing with plugin error

Post by kg2857 »

You may need to reinstall the script using that docs include with its tar file.
mkumarv
Posts: 11
Joined: Tue Mar 11, 2025 2:15 am

Re: Nagios check_mysql_health has been failing with plugin error

Post by mkumarv »

Can you share the step for that or any reference document
mkumarv
Posts: 11
Joined: Tue Mar 11, 2025 2:15 am

Re: Nagios check_mysql_health has been failing with plugin error

Post by mkumarv »

I saw that earlier but in my existing one I have only two file under plugin check_mysql_health and check_mysql_health.pl

In the latest repo I could see it is a directory. Do i need to replace that directory for check_mysql_health ?
mkumarv
Posts: 11
Joined: Tue Mar 11, 2025 2:15 am

Re: Nagios check_mysql_health has been failing with plugin error

Post by mkumarv »

Hi @kg2857,
Can you respond on this
mkumarv
Posts: 11
Joined: Tue Mar 11, 2025 2:15 am

Re: Nagios check_mysql_health has been failing with plugin error

Post by mkumarv »

kg2857 wrote: Tue May 20, 2025 12:22 am Follow the links.
https://exchange.nagios.org/directory/m ... th/details
I saw that earlier but in my existing one I have only two file under plugin check_mysql_health and check_mysql_health.pl

In the latest repo I could see it is a directory. Do i need to replace that directory for check_mysql_health ?
kg2857
Posts: 491
Joined: Wed Apr 12, 2023 5:48 pm

Re: Nagios check_mysql_health has been failing with plugin error

Post by kg2857 »

Don't extract the tar file in the plugins dir.
mkumarv
Posts: 11
Joined: Tue Mar 11, 2025 2:15 am

Re: Nagios check_mysql_health has been failing with plugin error

Post by mkumarv »

kg2857 wrote: Tue May 20, 2025 7:42 pm Don't extract the tar file in the plugins dir.
Can you share more specific step for this. Which location we have to tar the file ? Or in plugin directory place the directory ?
mkumarv
Posts: 11
Joined: Tue Mar 11, 2025 2:15 am

Re: Nagios check_mysql_health has been failing with plugin error

Post by mkumarv »

What are the perl packages required for this

[root@nagios-data plugins]# perl -cw ./check_mysql_health
Can't locate Time/HiRes.pm in @INC (you may need to install the Time::HiRes module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ./check_mysql_health line 803.
BEGIN failed--compilation aborted at ./check_mysql_health line 803.
[root@nagios-data plugins]#

If I update this version perl-Time-HiRes-1.9764-459.module+el8.10.0+90267+7012ad3b then seeing the error message shared in the post
Post Reply