Cacti / plugin_thold

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

Add missing includes to thold_functions.php. Seems to be needed under php 8.1.24 #651

Closed eriksejr closed 5 months ago

eriksejr commented 6 months ago

Addresses #649

TheWitness commented 6 months ago

Though this is potentially harmless I think it's the wrong approach. Do you know which file it was that was being called from the stack Trace just update the continent please thank you

eriksejr commented 6 months ago

@TheWitness Sorry I am not sure I follow. I'm fine with there being another way to solve this as I am far from PHP expert so I won't say I know the best resolution - this has worked for me. All of the info I have in the log is in #649. Best I can tell it appears that thold_check_threshold() in thold_functions.php calls thold_mail() in thold_process.php should a threshold be breached and a mail needs to be sent. thold_mail() calls get_timespan() on line 6252 which is defined in lib/time.php.

Please let me know if there is a better way to ensure that thold_mail() knows where to find get_timespan() and I will modify the PR accordingly.

eriksejr commented 6 months ago

Actually, it's not working. While there is no error in the logs, threshold breaches appear to not be generating any notifications. The breaches are logged, but no emails are sent and I am unsure if the scripts are being run. I am still investigating, though I am not sure it's related to this issue - might be a separate one.

TheWitness commented 5 months ago

From where are you calling that is causing the issue? What file?

eriksejr commented 5 months ago

@TheWitness the file in question is (on my system) /usr/local/share/cacti/plugins/thold/thold_functions.php. The cacti root is /usr/local/share/cacti. Not sure if that's what you are asking?

After a lot of issues getting thold to send mail I did quite a bit if debugging with PHPMailer and tracked this problem down to a failure when TLS is used. After disabling TLS things went better, so we looked into why and found a problem with a CA cert on our mail server which we fixed. I've reverted this change and will let it run until a few thresholds trigger to see if this was perhaps a side-effect of the mail issue.

If the error re-appears in the log I'll add it in again.

TheWitness commented 5 months ago

Can you upload that file to the ticket?

eriksejr commented 5 months ago

Here's my copy of thold_functions.php (renamed with a text extension for the benefit of github) with the include I added commented out at the top. I think it's only a few commits back from the one in master. thold_functions.txt

TheWitness commented 5 months ago

Going to close this for now. Keep us posted. The develop branch is still technically beta.

TheWitness commented 5 months ago

Yes, upload thold_plugins.php. Not familiar with that file.