I’m trying to create a graph that also displays the warning & critical levels (like in cpu_load for example). Should be simple, but somehow it does not want to work.
I have hardcoded the levels_lower here, to a value that should trigger a warning. The red line is the linter complaining the line is too long, no real problem:
I started without the graphing/ config, only with the check_levels() in the agent based check. It drew me a graph with the name “rtf_capacity_free_cpu_millis”, but only 1 line, not the warning and critical levels. I then tried to find out why that lines are missing, looked at the code of cpu_load and saw the metrics.WarningOf() funktion beeing used there, so I tried adding that. Also did not help.
I have now run “cmk -R” and also deleted my development Docker container to start with a completely fresh Checkmk installation, but still it only draws one line and no limits. I have hardcoded the levels_lower=(‘fixed’, (20000, 500)) in the check_levels() to rule out the option that the levels from the rulespec don’t make it there. The 500 line should be in the visible area of the graph.
I have re-created my development environment, fresh Checkmk. I configured the plugin again, discovered the service, activated it and now it still looks like this:
Problem is easy → lower levels are only used for calculation but not forwarded to the graphing data and also not existing inside the RRD.
This is one of the biggest flaws in the actual state of the graphing system.
No lower levels and no lower:upper levels. Only upper levels are existing in the graphing framework.
And in the check_levels method it’s hardcoded to only give the upper levels to the created metric:
I wonder why that is. What might be so hard about drawing the lines for a lower limit instead of an upper? Might be some limitation by the used rrd implementation.
No rrd can handle upper and lower levels.
This is very long existing “missing feature” inside CMK graphing system.
With the older versions you can tricked the system by providing strings like “5:15” inside the perfdata output to save also the lower levels to the rrd file.
But now this is not possible anymore as the levels need to be a number.
What happens when I give lower limits to the Metric levels parameter? I guess it might complain that warning cannot be higher than critical? It would not want to draw the warning line above the critical line?
I yield a metric with name vsan_health_total
I’m not using yield from check_levels:
Tell the graphing system how to draw that metric named vsan_health_total (title, unit, color) and define a name for the line (again vsan_health_total)
and build the combined graph with the lines defined in graphing/metrics.py using vsan_health_used, vsan_health_total, WarningOf(vsan_health_total) and CriticalOf(vsan_health_total)
If you don’t use the default direction, you have to define the graphs by yourself and add the WarningOf and CriticalOf as additional lines:
I think defining the check_parameters in rulesets\check_parameters.py did the trick:
When I remove the rulesets/check_parameters.py and define the levels manually the graph loses the WARN, CRIT information. But I don’t see the “link” between them.
I’m not totally happy with the names of my objects, because it would make things easier to understand if definition (including levels), values, lines and graphs would have distinct names.
I have no idea why the names must all be the same to make this work. I tried to name the “lines” (Graph) different and to figure out what WarningOf() actually really wants as parameter. And I don’t understand how the check_parameters ruleset information is accessed in the metric definition.