librenms/librenms-agent

mysql script problem with MySQL 5.7.30

e21zuo opened this issue · 4 comments

I try to setup mysql snmp but it have this error.

./mysql

PHP Fatal error: Uncaught TypeError: mysqli_num_rows(): Argument #1 ($result) must be of type mysqli_result, bool given in /etc/snmp/mysql:1322
Stack trace:
#0 /etc/snmp/mysql(1322): mysqli_num_rows()
#1 /etc/snmp/mysql(422): run_query()
#2 /etc/snmp/mysql(141): ss_get_mysql_stats()
#3 {main}
thrown in /etc/snmp/mysql on line 1322

========= MySQL version =======
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11850430
Server version: 5.7.30-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

si458 commented

@e21zuo i had the exact same issue and after chasing it through the code and online docs,

it appears the NONBLOCKING command was removed in mysql5.7+

so when the querys show slave status nonblocking and show slave status nolock are run,
they will always return an error in php

to get around this, i just added $chk_options['slave'] = false; into my mysql.cnf and it ignores checking slave statuses

hrtrd commented

@si458 doesn't work on 10.3.27-MariaDB-0+deb10u1 Debian 10

si458 commented

@si458 doesn't work on 10.3.27-MariaDB-0+deb10u1 Debian 10

not sure how to test this but it works fine here on my instance but im running a diffetent version?
mysql Ver 15.1 Distrib 10.5.10-MariaDB, for debian-linux-gnu (aarch64) using readline 5.2

I have the same issue with MySQL 8.0.29-0ubuntu0.20.04.3
The NONBLOCKING command doesn't rate a mention in the MariaDB documentation either:
https://mariadb.com/kb/en/show-replica-status/

Would there be any objections to removing the show slave status nonblocking and show slave status nolock commands?