Repository navigation
fix(daemon): load lib/time.php in the worker for <GRAPH> alerts - #894
Merged
bmfmancini merged 1 commit intoDec 2, 2026
Merged
Conversation
thold_mail() calls get_timespan() when the alert text has a <GRAPH> tag. The daemon worker never loaded lib/time.php, so the first such alert was a fatal error and Cacti disabled the plugin. Add a CI check that runs the real worker against a breaching threshold with a <GRAPH> alert and confirms the plugin stays enabled and the alert is queued. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
bmfmancini
approved these changes
Dec 2, 2026
TheWitness
added a commit
to somethingwithproof/plugin_thold
that referenced
this pull request
Dec 3, 2026
Resolve the CI workflow conflict by keeping both daemon database checks: the queue/worker check from this branch runs first, followed by the graph-alert worker check added on develop (Cacti#894). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #893.
thold_mail()callsget_timespan()for the<GRAPH>tag, which is in the default alert text. The daemon worker,thold_process.php, never includedlib/time.php, so the first such alert was a fatal error and core's shutdown handler disabled the plugin.Change
thold_process.php:require_oncecorelib/time.php, next to the existinglib/rrd.phpinclude.tests/bin/daemon-graph-alert-check.phpand a CI step: run the real worker against one breaching threshold with<GRAPH>alert text and the notification queue on (no mail is sent). The check passes only if the worker is still running, the plugin is still enabled, the threshold is in alert, and an alert is in the notification queue. It refuses to run unlessTHOLD_DAEMON_DB_CHECK=1is set and the thold tables are empty, and it cleans up after itself.The include is in the entry point rather than in
thold_mail()because the unit bootstrap stubsget_timespan(), and including the real file there redeclares it.Testing
Local, MariaDB 11.8, PHP 8.4, Cacti 1.2.x:
developcacti.logshows the same fatal as the reportcacti.logNo CHANGELOG entry yet: #892 also edits the CHANGELOG, so I will add the #893 line once that merges, to avoid a conflict.