Metric conditions evaluation hotfix and check_drivesize tests#428
Metric conditions evaluation hotfix and check_drivesize tests#428inqrphl wants to merge 9 commits into
Conversation
it performed short-circuiting tests over the ConditionList, which leads to maximum of one correct resulting condition. the result thould then be len(corrects) > 0 , not > 1 which is always false
…h is fresher and canonical The metrics condition list may be modified during the check. When using the default check.warnCond and check.critCond , they might be stale.
…sed %" "inodes_free %" literally in thresholds check if these exist, then add metrics accordingly add tests that check for different keyword usage: '[drive] used %' '[drive] used_pct' 'used %' also add test for the specialzation, where having a "drive" keyword containing condition in the threshold, applies a filter for the metrics originating from that entry
…erly before adding to the metric
…ition, check if perfdata is specialized according to the conditions
… and darwin it uses both / and /tmp drives and those are not mounted as drives, or unavailable in those platforms
…data tests it is failing even on linux systems in github ci since /tmp is not a drive there
|
|
||
| // CheckMetrics tries warn/crit/ok conditions against given metrics and sets final state accordingly | ||
| func (cd *CheckData) CheckMetrics(warnCond, critCond, okCond ConditionList) { | ||
| func (cd *CheckData) CheckMetrics(_, _, okCond ConditionList) { |
There was a problem hiding this comment.
this function is only used from one place, if 2 of 3 arguments are not used at all, they should be removed and the description should be adjusted. Otherwise it is misleading.
| minVal := utils.ToPrecision(sensor.Min, 3) | ||
| maxVal := utils.ToPrecision(sensor.High, 3) | ||
| var warning, critical ConditionList | ||
| if sensor.Min != 0 || sensor.Critical != 0 { |
There was a problem hiding this comment.
how is the expansion of temp and temperature related to Min/Critical? I don't understand why this is necessary.
There was a problem hiding this comment.
The expansion has nothing to do with it, I am only adding the modified warning/critical thresholds if sensor.Min != 0 or sensor.Critical != 0
Some sensors report min==0 and then get added, only to fail directly in the check_temperature_test
Of course that problem only started happening after the CheckMetric.CheckForThresholds was fixed in the pr.
… CheckMetrics call metrics save their own warning and critical thresholds inside a ConditionList in the CheckMetric object. while saving these, the thresholds may be modified, including filtering and keyword transformations only the okCondition is supplied directly from the check itself.
|
merged manually |
metric: fix CheckMetric.CheckForThresholds
it performed short-circuiting tests over the ConditionList, which leads to maximum of one correct resulting condition.
the result thould then be len(corrects) > 0 , not > 1 which is always false
checks: CheckData.CheckMetrics uses the metric's condition list, which is fresher and canonical
The metrics condition list may be modified during the check.
When using the default check.warnCond and check.critCond , they might be stale.
check_drivesize: support keywords using "used %" , "free %" "inodes_used %" "inodes_free %" literally in thresholds
check if these exist, then add metrics accordingly
add tests that check for different keyword usage:
'[drive] used %'
'[drive] used_pct'
'used %'
also add test for the specialzation, where having a "drive" keyword containing condition in the threshold, applies a filter for the metrics originating from that entry