Repository navigation
fix: legacy hostField and collector status query failures (#451, #452, #453) - #455
Merged
Merged
Conversation
…eate memo The memo added in #454 returned early for any previously successful db_update_table() call, so an owner column narrowed after the first check was never widened in the same process and the database regression test failed on every PHP version. Remember creations only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A regression test is needed to verify that repeated updates to an existing table both reach db_update_table() and that a failure on the second call is propagated.
1 open issue
What changed in this PR
This PR fixes incoming-host mapping and collector status failures in the Cacti Syslog plugin, addressing #451–#453. It also adjusts schema caching so repeated updates can repair existing tables.
Changes:
- Maps legacy
hostField = 'host_id'tohostacross incoming rule queries and corrects the configuration template. - Separates Syslog collector reads from Cacti hostname lookups, handles failed queries, and adds regression coverage.
- Limits schema-operation caching to successful table creation.
| File | Description |
|---|---|
tests/Unit/ReplicationDeliveryTest.php |
Tests separate hostname lookups and query-failure handling. |
tests/Unit/DeviceRulePolicyTest.php |
Tests legacy host mapping and custom-field preservation. |
includes/schema.php |
Keeps existing-table updates out of the replay cache. |
includes/functions.php |
Normalizes incoming host fields and separates collector queries by database. |
config_local.php.dist |
Changes the default incoming host field to host. |
CHANGELOG.md |
Documents the host mapping, collector status, and schema-cache fixes. |
Review effort: Balanced
…_table() Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
xmacan
approved these changes
Nov 16, 2026
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
syslog_incoming_host_field()maps the stalehostField = 'host_id'setting to the realsyslog_incoming.hostcolumn. It is used by the device-rule mute/maintenance filter, host alerts, and the alert/removal query builders.config_local.php.distnow shipshost.syslog_replication_collector_status()no longer joinspolleron the Syslog connection. It reads the collector summary from the Syslog DB, then resolves hostnames from the Cactipollertable over the Cacti connection. A failed query now returns[](or a null hostname) instead of tripping thearrayreturn type.Related Issue
Fixes #451
Fixes #452
Fixes #453
Motivation and Context
config_local.php.disthas shippedhostField = 'host_id'since 2022. The 4.11 device-rule SQL honourshostField, so alert processing failed withUnknown column 'syslog_incoming.host_id'on installs that copied that file.syslog_incomingonly has ahostcolumn.pollerjoin fails,syslog_db_fetch_assoc()returnsfalse, and the: arrayreturn type throws aTypeErrorthat makes Cacti disable the plugin when the Status/Dashboard tab is opened.How Has This Been Tested?
Run in WSL (PHP 8.3) against Cacti's Pest tree:
pest tests/Unit/DeviceRulePolicyTest.php tests/Unit/ReplicationDeliveryTest.php tests/Unit/ReplicationCoverageRegressionTest.php- passed (32 tests)pest tests/Unit tests/Security- 662 passed, 1 failed. The failure,ItemShareVisibilityTest("The granted id resolves"), also fails on unmodifiedorigin/developwhen the whole suite runs. It passes when run alone, so it is an order-dependent failure unrelated to this change.php -l includes/functions.php- passedTypes of changes
Checklist: