mk_sap: apply host_prefix to logwatch piggyback #937
Open
Simon0Harms wants to merge 1 commit into
Open
Conversation
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.
|
All contributors have signed the CLA ✍️ ✅ |
Open
Author
|
I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA. |
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.
General information
Affected plugin:
agents/plugins/mk_sap.py— the SAP R/3 agent plugin thatcollects CCMS data via RFC (pyrfc) and emits it as piggyback blocks keyed by the
SAP System ID (SID). The
host_prefixoption prepends a string to the piggybackhost name.
This is a platform-independent issue (a Python string-formatting inconsistency);
it was observed on SLES 15 SP7 with pyrfc and NW RFC SDK 7.50, but does not depend
on the OS.
Bug report
Operating system: SLES 15 SP7 (issue is OS-independent)
Local setup: two SAP systems sharing the same SID (an ECC and an S/4HANA system).
host_prefixis used to give each source's piggyback data a distinct host name.Steps to reproduce:
host_prefixin/etc/check_mk/sap.cfg, e.g."host_prefix": "S4H_".<<<sap>>>section and a<<<logwatch>>>section (i.e. at least one MTE_MSG_CONTAINER with alerts).Agent output (illustrative, with
host_prefix = "S4H_"):Observed (current behavior):
The SAP section and the logwatch section end up on two different piggyback
hosts (
S4H_SB1vs.SB1).Proposed changes
host_prefixset, both thesapsection and thelogwatchsection are written under the same (prefixed) piggyback host.header omits it. In
check(), the SAP block writes"<<<<%s%s>>>>\n" % (cfg_entry.get("host_prefix", ""), host)while the logwatchblock writes
"<<<<%s>>>>\n" % host, dropping the prefix.host_prefixformatting to the logwatch header so bothsections share one piggyback host.
host_prefixis used, which is the natural way to disambiguate systems thatshare a SID.
host_prefixandasserts that both the
sapand thelogwatchpiggyback headers carry theprefix would have failed before this fix.