Graph with warning and critial level lines

Hi,

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:


It draws the graph, and the service is in warning state, but it does not draw the lines for warning and critical levels:

What am I missing?

Regards,
Sven

I guess you raised the first value from something around 700 to 20000 and the 500 is desired crit value. Right?

I’m using yield Metric(), added levels = (80, 90), did cmk -R and after a recheck of the service the lines at 80 and 90 were added:

yield from check_levels should work in the same way without additional setup in “pluginname/graphing”.

Perhaps your instance is just missing a cmk -R?

Hi,

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.

Sven

I have removed all the graphing/ rules referencing this metric, and now this is the only thing left:

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:

Service is going to warning as expected, as the warning limit is hit. So the values and levels are working:

Did I import the correct check_levels() function? Is there any other?

{8066441F-FAD4-4710-9177-B521E2568A28}

Regards,
Sven

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. :frowning:

1 Like

Ok, thanks. At least I can stop trying to get the lines to show up now. :wink:

What is the downside of yield Metric()? Only one direction and no upper/lower differentiation? Or the manual sync of the warn/crit values?

1 Like

The docstring for Metric() says the levels parameter is for “upper levels”:

And in the check_levels method it’s hardcoded to only give the upper levels to the created metric:

{5666541C-5E2D-406B-B282-73FF1B47A8D9}

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?

Inside the Metric class i see no check if the first value is lower than the second one.
But i think the graphing system will then ignore such values.

It is possible to get this working (LevelDirection.LOWER where WARN>CRIT):

  1. I yield a metric with name vsan_health_total
    I’m not using yield from check_levels:
    grafik

  2. 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:

  3. I think defining the check_parameters in rulesets\check_parameters.py did the trick:
    grafik

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.

1 Like