Cacti / plugin_thold

Thold Plugin for Cacti
GNU General Public License v2.0
68 stars 63 forks source link

thold_daemon latest commit db error #711

Open morganfw opened 1 day ago

morganfw commented 1 day ago

Describe the bug In the latest thold plugin commit after enabling the thold_daemon.service on the latest Cacti 1.2.x commit, the following error is raised:

2024-11-06 10:51:20 - CMDPHP SQL Backtrace: (/plugins/thold/thold_daemon.php[187]:db_check_reconnect(), /lib/database.php[288]:db_fetch_cell(), /lib/database.php[637]:db_fetch_cell_prepared(), /lib/database.php[659]:db_execute_prepared())
--
2024-11-06 10:51:20 - CMDPHP ERROR: A DB Cell Failed!, Error: MySQL server has gone away
2024-11-06 10:51:20 - CMDPHP SQL Backtrace: (/plugins/thold/thold_daemon.php[174]:thold_prime_distribution(), /plugins/thold/thold_daemon.php[401]:db_fetch_cell(), /lib/database.php[637]:db_fetch_cell_prepared(), /lib/database.php[659]:db_execute_prepared())
2024-11-06 10:51:20 - CMDPHP ERROR: A DB Cell Failed!, Error: MySQL server has gone away
2024-11-06 10:51:20 - CMDPHP SQL Backtrace: (/plugins/thold/thold_daemon.php[174]:thold_prime_distribution(), /plugins/thold/thold_daemon.php[395]:db_fetch_cell(), /lib/database.php[637]:db_fetch_cell_prepared(), /lib/database.php[659]:db_execute_prepared())
2024-11-06 10:51:20 - CMDPHP ERROR: A DB Cell Failed!, Error: MySQL server has gone away
2024-11-06 10:51:20 - CMDPHP SQL Backtrace: (/plugins/thold/thold_daemon.php[172]:thold_truncate_daemon_data(), /plugins/thold/thold_daemon.php[257]:db_execute(), /lib/database.php[420]:db_execute_prepared())
2024-11-06 10:51:20 - CMDPHP ERROR: A DB Exec Failed!, Error: MySQL server has gone away

and we need to revert to previous method by disabling thold_daemon.service issuing:

systemctl stop thold_daemon
systemctl disable thold_daemon

As we remember, the thold_daemon was working in thold v1.7.0 or before 1.8 version.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Plugin (please complete the following information):

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

TheWitness commented 1 day ago

What commit?

morganfw commented 1 day ago

What commit?

Sorry, I meant the latest git pulls

TheWitness commented 23 hours ago

From where? Which repo? What was the last commit?

TheWitness commented 23 hours ago

Is it happening any more? You backed off right?

morganfw commented 22 hours ago

From where? Which repo? What was the last commit? Is it happening any more? You backed off right?

Previously we used the thold v1.7 plugin for quite some time on Cacti v1.2.x and the thold_daemon.service was up and running without any issues. A few weeks ago we decided to update the thold plugin to version 1.8.x, as soon as we updated the thold_daemon stopped working, returning the errors above. So the solution was to stop using thold_daemon with the commands above and go back to the default thold.

TheWitness commented 22 hours ago

I think that there is a thold 1.8.2 that needs to be released. Asking @xmacan or @bmfmancini if they have any clues. I'm pretty much locked into 1.3 right now. Only fixing some compatibility issues with 1.3 at the moment.

TheWitness commented 22 hours ago

It may have been that you simple needed to restart the daemon. The error is more like you were running out of connections to your database, or that the database was restarted, on finally, sometimes an insert will exceed the max_allowed_packet_size which should be around several megabytes in today's Cacti recommendations.

image

TheWitness commented 22 hours ago

We would need to get some details from the database, assuming it has not been restarted since then:

SHOW GLOBAL VARIABLES;
SHOW GLOBAL STATUS;
morganfw commented 20 hours ago

It may have been that you simple needed to restart the daemon. The error is more like you were running out of connections to your database, or that the database was restarted, on finally, sometimes an insert will exceed the max_allowed_packet_size which should be around several megabytes in today's Cacti recommendations.

image

The DB was not recently restarted, last restart was 2 weeks ago:

root@cacti:~# systemctl status mariadb.service 
● mariadb.service - MariaDB 10.6.18 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2024-10-24 07:11:43 CEST; 2 weeks 0 days ago

image

We would need to get some details from the database, assuming it has not been restarted since then:

SHOW GLOBAL VARIABLES;
SHOW GLOBAL STATUS;

SQL Queries attached below

Cacti_MariaDB_SHOW_GLOBAL_STATUS.txt Cacti_MariaDB_SHOW_GLOBAL_VARIABLES.txt