perfdata: add --legacy-perfdata flag and fix plugins= count mismatch#55
Open
dmueckli wants to merge 4 commits into
Open
perfdata: add --legacy-perfdata flag and fix plugins= count mismatch#55dmueckli wants to merge 4 commits into
dmueckli wants to merge 4 commits into
Conversation
v1.4.4 changed the perfdata output (added checktime=, the ", of which X matched the regex" text, and inBitps/outBitps per interface) under the label "general linter and style fixes", which broke existing RRD graph definitions that expect the old field layout. This adds an opt-in --legacy-perfdata flag that restores the exact pre-1.4.4 output for users who need to keep existing RRDs working, while leaving the new, richer default format untouched for everyone else. No change to default behavior when the flag is not given.
plugins= in the check_multi header used number_of_matched_interfaces (i.e. how many interfaces matched the regex), but the loop below only prints a check_snmp block for interfaces that are neither ignored nor administratively down. This mismatch (e.g. plugins=44 while only 4 blocks are actually printed, because 40 of the 44 matched interfaces are administratively down) can confuse RRD/check_multi consumers that rely on this count to know how many data sources to expect. plugins= now reflects the actual number of printed blocks, independent of --legacy-perfdata. The ", of which X matched the regex" status text is unaffected, since that's meant to report the raw regex match count regardless of admin-down status.
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.
Summary
Two related fixes around the perfdata/check_multi output:
--legacy-perfdataflag that restores the exact pre-1.4.4performance data format, for users with existing RRD/PNP4Nagios graph
definitions that broke on upgrade.
plugins=count fix, independent of the flag, that corrects amismatch between the advertised and actual number of perfdata blocks.
Background
v1.4.4 changed the perfdata output under the label "general linter and
style fixes":
checktime=<unixtime>to thecheck_multiheaderinBitps=/outBitps=per interfaceThis silently broke existing RRD definitions that parse the perfdata by
fixed field layout, since new fields shifted/extended what downstream
tools expect.
Change 1:
--legacy-perfdataflagRestores the exact pre-1.4.4 output when passed:
checktime=inBitps=/outBitps=fieldsWithout the flag, behavior is unchanged from current
master.Change 2:
plugins=count fixplugins=in thecheck_multiheader usednumber_of_matched_interfaces(how many interfaces matched the regex),but the loop that prints
check_snmpblocks below only emits a blockfor interfaces that are neither ignored nor administratively down.
Example from a real device: 44 interfaces matched the regex, 40 of
them administratively down → only 4
::check_snmp::blocks areactually printed, but the header said
plugins=44. This mismatch canconfuse RRD/
check_multiconsumers that rely on this count to know howmany data sources to expect.
plugins=now reflects the number of blocks actually printed, in boththe default and
--legacy-perfdataoutput. The, of which X matched the regexstatus text is unaffected by this fix, since that's meant toreport the raw regex match count regardless of admin-down status - it's
purely informational (appears before the
|, not parsed by RRD tools).Testing
Verified on a real Ekinops router with 44 regex-matched interfaces (40
administratively down).