Cacti / plugin_syslog

Syslog Plugin for Cacti
GNU General Public License v2.0
21 stars 16 forks source link

When using any other value than localhost in config.php plugin crashes #136

Closed bmfmancini closed 3 years ago

bmfmancini commented 3 years ago

Hey Everyone

I noticed unless its something ive done that if you change the database host from localhost to anything else the plugin crashes

2020-10-08 13:00:28 - ERROR PHP ERROR in Plugin 'syslog': Uncaught ArgumentCountError: Too few arguments to function syslog_db_connect_real(), 10 passed in /var/www/html/cacti/plugins/syslog/syslog_process.php on line 117 and exactly 11
2020-10-08 13:00:28 - ERROR PHP ERROR in Plugin 'syslog': Uncaught ArgumentCountError: Too few arguments to function syslog_db_connect_real(), 10 passed in /var/www/html/cacti/plugins/syslog/syslog_process.php on line 117 and exactly 11 expected in /var/www/html/cacti/plugins/syslog/database.php:38 Stack trace: #0 /var/www/html/cacti/plugins/syslog/syslog_process.php(117): syslog_db_connect_real('maindb', 'username', 'password', 'cactisyslog', 'mysql', 3306, false, '', '', '') #1 {main} thrown in file: /var/www/html/cacti/plugins/syslog/database.php on line: 38

There is a entry in the hosts file for maindb I also tried IP and got the same thing but revert back to localhost and its good

bmfmancini commented 3 years ago

Oh an this is Syslog 2.9

bmfmancini commented 3 years ago

Turns out that retries is not being posted to database.php also I found that retries is hard coded in database.php as well as the mysql port

Submitted pull request https://github.com/Cacti/plugin_syslog/pull/137

cigamit commented 3 years ago

Its not hard coded per say, its a default value. It seems that the call to syslog_db_connect_real isn't passing a retries number like it should.

bmfmancini commented 3 years ago

I found the issue it's on my side as well as the side of the plugin

Issue 1 : my user even though local to the system could not connect to mysql via anything other than localhost due to mysql setup DOH!

Issue2, since there are remote collectors the plugin, replicates over config.php which also tries to connect to a localhost db unless you are going to have a syslog db on each server you would need to point it to the real db

I am going to try to put nosync in the INFO file to prevent the changes of config.php to replicate to the remote pollers which should allow me to have the remote pollers point back to the main pollers Syslog db

This of course is not a problem if the syslog db is on a completely different server than your cacti cluster then all of the servers would point to that server and not have this problem

bmfmancini commented 3 years ago

Going to close this one since the plugin crash is really down to my config issue on the mysql level however I will put issue 2 on the remote poller issue I have open