Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed omission of warn, grit, min or max from graphs if set to 0 #1831

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dolfs
Copy link

@dolfs dolfs commented Mar 27, 2016

String version of Metric does not include min or max values, even if they were present in the string passed to the constructor.

String version of Metric does not include values for warn, crit, min, or max if they were specified with value 0. This happens because their inclusion in the string representation of Metric was conditional on their boolean-ish value (which is false for 0). Changed to check for None instead.

String version of Metric did not collapse None values into empty semi-colon delimited sections, causing input of ;;1 to result in ;1 on conversion to string. Combined with above to remove collapsed None values from the end as well.

Dolf Starreveld and others added 4 commits March 26, 2016 18:57
String version of Metric does not include min or max values, even
if they were present in the string passed to the constructor.

String version of Metric does not include values for warn, crit,
min, max if they were specified as 0. This happens because their
inclusion in the string representation of Metric was conditional
on their boolean value (which is false for 0). Changed to check
for None instead.

String version of Metric did not collapse None values into empty
semi-colon delimited sections, causing input of ;;1 to result
in ;1 on conversion to string.
When to uom is % min and max were always forced to 0. This causes graphs to always have 0 and 100 for min and max, even if other values were supplied.
This is changed to only force the default values if no other values had been set.

In addition, when converting a Metric to a string, those same min and max values were always included. If they are actually 0 and 100 that is not necessary, and they are now left out, but only if not explicitly specified on input.

These changes allow control over the appearance of min and max lines in graphs, regardless of their desired values. If the value is specified, even when equal to a default, they will be output and thus graphed. If defaults were generated, they will not be graphed.

This leaves the semantics of the perfdata unchanged.
Fix handling of min and max values for percentages
@dolfs
Copy link
Author

dolfs commented Mar 29, 2016

Travis CI build failed due to unavailability of a/the test port. This seems a problem in the build system that I cannot correct as part of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant