Repository navigation
feature: Add Arista, Dell, Fortinet, HPE, Huawei, MikroTik, Nokia, NVIDIA and Palo Alto Networks recommendation catalogues with vendor-scoped matching - #477
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 |
There was a problem hiding this comment.
No blockers found.
Copilot's two open comments on syslog_recommendation_host_vendors() (the case-sensitive lookup and the first match winning) are valid and worth fixing. Two things beyond those:
Suggestion: once hpe.json.gz is imported, hosts that are not Cacti devices match numeric identifiers such as 4701 against any number in a message. Consider skipping purely numeric identifiers unless the vendor is known.
Question: the catalogues condense vendor text, and the Arista source is an archived copy of a guide that is now behind a login. Are we comfortable redistributing these under the plugin's licence?
…ndation catalogues Add docs/nokia.json.gz (SR OS Log Events Guide 25.10), docs/fortinet.json.gz (FortiOS 7.6.8 Log Message Reference), docs/paloalto.json.gz (PAN-OS System log event IDs) and docs/mikrotik.json.gz (the few RouterOS messages with a distinctive token), and recognise these vendors from the device sysDescr. Fix the HPE Comware 5 catalogue, whose split "Explanation" and "Recommended action" PDF labels left 5 records empty and appended the action to the explanation in 28 others. The remaining 694 omitted AOS-CX and ArubaOS-Switch events have no description in HPE's guides. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…talogues' into feature/vendor-recommendation-catalogues
346509d
|
somethingwithproof
left a comment
There was a problem hiding this comment.
No blockers found.
The three open Copilot comments on syslog_recommendation_host_vendors() still apply on 346509d. Each reproduces:
- Suggestion:
includes/recommendations.php:597compares the stored device spelling with the sender's. Device hostnameSW01.Example.comand sendersw01.example.comleaves the vendor unknown, so scoping never engages. Key$foundby lowercased name and add a mixed-case test; the current stub echoes the requested spelling and cannot catch it. - Suggestion:
:591-599, two devices with the same description (Cisco id 1, HPE id 2) resolve to Cisco and the HPE sender's records are hidden. Scope only when all matching devices agree. - Suggestion:
:603,array_merge()renumbers numeric host names. A device described123loses its vendor, and a later host0picks it up. Use$found + $cache.
Beyond those:
- Suggestion:
:635-642and:693scope to the detected vendor even when that vendor has no rows. With only the seeded Cisco catalogue, an Arista device stops showing%LINEPROTO-5-UPDOWN, which it shows on develop, untilarista.json.gzis imported. The same happens to user records whose vendor is spelled differently (Aruba vs HPE). Scope only when the table has rows for that vendor, or say in the README that recognised devices lose other vendors' matches. - Suggestion:
:537-549, a Net-SNMP sysDescr contains the hostname, soLinux cisco-syslog01 ...is Cisco andLinux hp-dl380-01 ...is HPE.Alcatel-Lucent Enterprise OS6860Ebecomes Nokia. Since scoping only removes matches, I would drop barehpandalcatel-lucentand ignore the hostname in Linux descriptions. The GPU Xid records also come from Linux servers that will never detect as NVIDIA. - Suggestion:
hpe.json.gzhas 3,626 all-digit identifiers; the 2,000 without a leading zero cover about 3% of 1..65535 (1024 and 4701 included). On any host without a recognised vendor a port or PID in the message lights the bulb. Palo Alto addslink-down,auth-failandadmin-down. Match all-digit identifiers only when the vendor is known. - Suggestion: there is no generator or source manifest for the nine
docs/*.json.gzfiles, so the cleanup described in the PR (694 HPE events dropped, the Comware parsing fix) cannot be reproduced or reviewed. Please add the scripts or a per-file source list with document version and retrieval date. - Suggestion: add tests for the host resolution cases above and for the alert-tab host path in
syslog.php. - Nit: README says the template name is used when sysDescr is empty; the code also uses it when sysDescr is set but unrecognised.
Question, still open from before: the Arista, Dell, HPE, Huawei and Nokia records carry full vendor sentences, and all 1,047 Arista references point at archive.org copies of a guide now behind a login. Are we comfortable shipping these under GPLv2?
Record counts match the table, every identifier is matchable, there are no duplicates, and catalogue text is only ever inserted as text.




Summary
Adds manually importable recommendation catalogues for nine 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]codesnokia.json.gzSYSTEM-WARNING-tmnxStateChange-2009(default severity)fortinet.json.gzlogidsuch as0100032001paloalto.json.gztunnel-status-downmikrotik.json.gzhw-limit,hashtypeEvery file was checked with
syslog_recommendations_parse(). Every record imports, every identifier passessyslog_recommendation_matchable(), and there are no case-insensitive duplicates. I removed 694 HPE AOS-CX/ArubaOS-Switch events that have neither an explanation nor an action, because the importer would reject them. HPE's guides give no description for them. I also removed one HPE duplicate that differed only in case. A Comware 5 PDF parsing issue, where labels were split mid-word, was fixed; it had left 5 records empty and merged the action into the explanation in 28 others. I dropped seven generic MikroTik words (ph1,phase1,fcs,CME,CONNTRACK,cmd-failed,NO-PROPOSAL-CHOSEN) because they would match other vendors' messages. 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, Fortinet, HPE, Huawei, Juniper, MikroTik, Nokia, NVIDIA and Palo Alto Networks.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. Nokia identifiers embed the default severity, so events re-severitised on the router won't match. Fortinet full log IDs are derived from the documented type, subtype and message ID, and Fortinet documents no actions. Palo Alto has only 12 records with actions.Testing
pestfull suite: 881 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;logid="0100032001"matches0100032001).