librenms/librenms-agent

[solved] mysql script failing on Debian10 with 10.5.10-MariaDB

nodenineinc opened this issue · 2 comments

I have this routine running fine on other nodes of various distros, but my attempt to get this talking to some new debian10 systems running mariadb results in the following nondescript error:

'MySQL connection failed: No such file or directory'

I have lightly parsed the code and see no direct reference to this error message in the php, so have no idea what it is looking for that is missing. I followed the directions https://docs.librenms.org/Extensions/Applications/#mysql exactly, so the cache dir exists and is the proper permissions, and php, php-cli, & php-mysql are all installed.

I enabled the $debug & $debug_log flags in the routine, but they offer no additional clues either as to what the routine is looking for but not finding. Perhaps the error could actually indicate WHAT is missing instead of just saying "something isn't there". :)

After circling back and reading through the code further, I came to realize this is just a repackaged Percona ss_get_mysql_stats.php routine. Doing some digging around for that led me to discover that the php mysqli_connect() code has issue sometimes determining what "localhost" means.
https://www.dpscomputing.com/blog/2021/02/11/warning-mysqli_connect-hy000-2002-no-such-file-or-directory/

Setting the config file for this to read:
$mysql_host = '127.0.0.1';
instead of
$mysql_host = 'localhost';

This routine can now successfully connect and return datapoint values.

Howdy!

Fixed in #402 .