Skip to content

Postfix#938

Open
Simon0Harms wants to merge 2 commits into
Checkmk:masterfrom
Simon0Harms:postfix
Open

Postfix#938
Simon0Harms wants to merge 2 commits into
Checkmk:masterfrom
Simon0Harms:postfix

Conversation

@Simon0Harms

Copy link
Copy Markdown

General information

Affected plugin: agents/plugins/mk_sap.py (SAP R/3 monitoring via RFC/CCMS).
The plugin emits piggyback blocks keyed by the SAP SID. It already supports a
host_prefix option; this change adds a symmetric host_postfix.

Depends on #937 . That PR fixes the logwatch header to honor
host_prefix; this PR builds on the same two header lines. Please merge the
prefix fix first.

Proposed changes

  • What it does: adds an optional host_postfix config key. If set, it is appended
    to the SID in the piggyback host name (mirroring the existing host_prefix).
    It is applied to both the sap and the logwatch section headers, so both stay
    on the same piggyback host.
  • Motivation: when several systems share a SID (e.g. an ECC and an S/4HANA system
    both called SB1), their piggyback data must be routed to distinct hosts. A
    suffix (SB1_S4H, SB1_ECC) is often preferable to a prefix for grouping and
    sorting by SID. Doing this in the plugin avoids needing a per-source-host
    "Host name translation for piggybacked hosts" rule on the server side, and it
    also works when two systems are monitored from the same agent host (where a
    source-host-based translation rule cannot separate them).
  • Change: the header is written as
    "<<<<%s%s%s>>>>\n" % (cfg_entry.get("host_prefix", ""), host, cfg_entry.get("host_postfix", ""))
    for both sections.
  • Backward compatibility: host_postfix defaults to "" via .get(), so existing
    configurations are unaffected. The new option is documented in the sample config.
  • What made you submit this? Monitoring two SAP systems that share a SID from
    related agent hosts; a suffix-based naming scheme was needed for clean host
    naming.
  • Unit test: a test that sets host_postfix (and optionally host_prefix) and
    asserts both the sap and logwatch headers render as <prefix><SID><postfix>.

The host_prefix config option in mk_sap is currently only applied to the SAP
value section header, but not to the logwatch section header. As a result, the two
sections end up on different piggyback hosts when host_prefix is set.
Where
In check(), the SAP data block writes the header as:
"<<<<%s%s>>>>\n" % (cfg_entry.get("host_prefix", ""), host)
while the logwatch block writes:
"<<<<%s>>>>\n" % host
— dropping the prefix.
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Simon0Harms

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants