Repository navigation
fix(polling): record poller_id in plugin_thold_host_failed - #866
Merged
Merged
Conversation
With remote storage (remote_storage_method = 1), thold_update_host_status() reads and deletes plugin_thold_host_failed rows WHERE poller_id = $config['poller_id']. The rebuild at the end of the run inserted only host_id, so every row took the column default of 1. On any poller other than 1 its own rows were never read back: recovery notices for its devices were lost, and since its pre-rebuild DELETE never matched them either, the rows piled up every cycle. Insert this poller's id with each row. In remote-storage mode the device query is already limited to this poller; in central mode the table is read without a poller filter, so the stored value changes nothing there.
|
somethingwithproof
approved these changes
Nov 6, 2026
somethingwithproof
left a comment
Member
There was a problem hiding this comment.
No blockers found. The full suite passes on Linux/PHP 8.4; PHP 8.2–8.4 CI is green.
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.



Description
With remote storage (
remote_storage_method = 1),thold_update_host_status()reads and deletesplugin_thold_host_failedrowsWHERE poller_id = $config['poller_id']. The rebuild at the end of the run inserted onlyhost_id:So every row took the column default of
1. On any poller other than 1, its own rows were never read back, so recovery notices for its devices were lost. Its pre-rebuildDELETE … WHERE poller_id = ?never matched them either, so the rows piled up every cycle.This PR inserts this poller's id with each row. In remote-storage mode the device query is already limited to this poller. In central mode the table is read without a poller filter, so the stored value changes nothing there.
Related Issue
There's no existing issue; I found this while working on #737. I'm happy to open one if you'd like.
Motivation and Context
On a distributed install with remote storage, devices on remote pollers never get recovery notifications.
How Has This Been Tested?
Unit tests (Pest): a new
HostFailedPollerIdTestcovers a remote poller recording its own id, and the main poller recording 1. Both fail without the change, and the full suite passes with it.Test server: Cacti 1.2.32, PHP 8.4, with this exact commit deployed. The test server has a single poller, so a test device was assigned to
poller_id = 2and marked down.remote_storage_methodwas set to 1 for the few seconds of the test (only thold reads it), then restored.thold_update_host_status()was then run twice as poller 2:poller_id=1poller_id=2poller_id=1,1(piling up)poller_id=2(replaced)This simulates a second poller rather than running a real one.
Types of changes
Checklist: