Serveral metrics in one graph (Question)

Hi guys,

currently Im writing a plugin where I use the ‘metric()’ method. Now I have the issue if I use serveral ‘metric()’ methods it shows me 4 single graphs, each with 4 values. My goal is one graph with 4 values.


yield Metric("value1", var1)
yield Metric("value2", var2)
yield Metric("value3", var3)
yield Metric("value4", var4)

Well I think it has to do with 4x yield, but I dont know how to put all 4 values in one ‘metric()’ method. The API shows only metric for one value every time. I dont know but check_levels also see not right to me. So how can I fix this?


The checks always output single metrics. It is the graph system that then combines multiple metrics into one graph. You need to write a metric definition and a graph definition for this to work.

I do not know if there is any documentation about doing this available.

Have a look at check_mk_extensions/ at cmk2.0 · HeinleinSupport/check_mk_extensions · GitHub as an example.

1 Like

Hi r.sander,
I did write a metric definition in /web/plugins/metrics/, but did I have to include it into the code in the “register.check_plugin” section? My metric definition looks similar to your example, so I think its correct.

The problem is it is not really documented in the official API and on the website how to do it. Is there a event listener for the yield or where is the graph composed? I didnt understand what exactly where it goes wrong and what to do.

Ok, I did 2 days nothing and now it works.
I guess it was a bug?! Well it works with r.sanders inital solution.

Ok, I now know where the bug is.
If you go to "/local/share/check_mk/web/plugins/metrics/{your script} and open it serveral times. Check_MK generates for each time you open it a graph. If you restart the apache he only shows one or you wait until a garbage collector collects some internal swap files.

Hope I helped you all, that had the same issue.