Repository navigation
feature: Add Arista, Dell, HPE, Huawei and NVIDIA recommendation catalogues with vendor-scoped matching - #477
TheWitness wants to merge 2 commits into
Conversation
…logues with vendor-scoped matching Add manually importable docs/<vendor>.json.gz catalogues built from each vendor's public message references, in the same syslog-recommendations format as docs/juniper.json.gz. Recommendations are now matched only against the sending device's vendor (and vendor-neutral records) when the syslog host is a Cacti device whose vendor is recognised from its snmp_sysDescr or device template, so short numeric codes from one vendor do not match another vendor's messages. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Vendor lookup still mishandles mixed-case hostnames, conflicting device matches, and numeric host keys, potentially showing another vendor’s recommendations or reintroducing code collisions.
3 open issues
What changed in this PR
Extends Cacti Syslog recommendations with five optional vendor catalogues and vendor-aware matching, building on the compressed catalogue format introduced in #469.
Changes:
- Adds manually importable catalogues for Arista, Dell, HPE, Huawei and NVIDIA.
- Uses cached Cacti device lookups to scope list indicators and flyout recommendations to the detected vendor, while preserving vendor-neutral matches.
- Expands regression tests and updates matching guidance, catalogue documentation and translation text.
| File | Description |
|---|---|
tests/Unit/RecommendationsTest.php |
Adds catalogue validation, vendor detection and scoped lookup tests. |
syslog.php |
Passes sender names into batch and message-only lookups. |
syslog_recommendations.php |
Updates on-page matching guidance. |
README.md |
Documents vendor scoping, catalogue coverage and limitations. |
locales/po/cacti.pot |
Updates the translatable matching guidance. |
js/functions.js |
Includes the sender in fallback recommendation requests. |
includes/recommendations.php |
Implements vendor detection, cached host resolution and scoped matching. |
includes/functions.php |
Supplies the sender to message-details recommendation lookup. |
CHANGELOG.md |
Records the new catalogues and vendor-aware behavior. |
Review effort: Balanced
| $marks = implode(',', array_fill(0, count($batch), '?')); | ||
|
|
||
| foreach (['description', 'hostname'] as $column) { | ||
| $rows = db_fetch_assoc_prepared("SELECT h.$column AS name, h.snmp_sysDescr, ht.name AS template | ||
| FROM host AS h | ||
| LEFT JOIN host_template AS ht ON ht.id = h.host_template_id | ||
| WHERE h.$column IN ($marks) | ||
| ORDER BY h.id", | ||
| $batch, false); |
| if (isset($found[$name]) && $found[$name] === '') { | ||
| $found[$name] = syslog_recommendation_vendor_from_device((string) ($row['snmp_sysDescr'] ?? ''), (string) ($row['template'] ?? '')); | ||
| } |
| } | ||
| } | ||
|
|
||
| $cache = array_merge($cache, $found); |
|
@copilot please fix the merge conflicts in this pull request. |
…ommendation-catalogues # Conflicts: # CHANGELOG.md Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Merged |
|




Summary
Adds manually importable recommendation catalogues for five more vendors, in the same
syslog-recommendationsJSON format asdocs/juniper.json.gz(follow-up to #469). Also makes the recommendation lookup vendor-aware, so one vendor's short or numeric codes don't match another vendor's messages.New catalogues (
docs/<vendor>.json.gz, not auto-installed)arista.json.gz%LINEPROTO-5-UPDOWNdell.json.gzPSU0003,%IFM_ASTATE_UP,%CHMGR-2-MAJOR_TEMPhpe.json.gz%10IFNET/3/PHY_UPDOWN,4701,00076huawei.json.gz%01IFNET/4/IF_STATE(the token read from%%01IFNET/4/IF_STATE(l))nvidia.json.gz[EC nnnnnnnn]codesEvery file was checked with
syslog_recommendations_parse(). Every record imports, every identifier passessyslog_recommendation_matchable(), and there are no case-insensitive duplicates. I removed 699 HPE records that had neither an explanation nor an action, because the importer would reject them, plus one HPE duplicate that differed only in case. Each record'sreferencelinks to its source. Explanations and actions are condensed from the vendor text. Where the vendor gives no action, the field is left empty rather than invented.Vendor-scoped matching
The unique key is already
(vendor, identifier), so the same code can exist once per vendor. Until now, though, the lookup ignored the vendor. Now:host.snmp_sysDescr, falling back to the device template name. It maps to the catalogue names Arista, Cisco, Dell, HPE, Huawei, Juniper and NVIDIA.README, CHANGELOG, the on-page matching rules and
cacti.potare updated.Caveats
%%01won't match. NVIDIA publishes few message IDs that appear in syslog. Dell's OS9 coverage is thin.Testing
pestfull suite: 868 passed (run withmemory_limit=-1, as on CI; unchangeddevelopalso hits the default 128M limit in the Cisco catalogue test).tests/bin/check-i18n-pot.phppasses.%%01IFNET/4/IF_STATE(l)matches%01IFNET/4/IF_STATE, andMessageID: PSU0003matchesPSU0003).