You are right, pnp-templates are not what you are looking for. The magic term is graph_info
.
This is an example taken from ~/share/doc/check_mk/treasures/memcached/web/plugins/metrics/memcached.py
:
...
metric_info["cas_hits"] = {"title": _("CAS hits"), "unit": "", "color": "32/a"}
metric_info["cas_misses"] = {"title": _("CAS misses"), "unit": "", "color": "22/a"}
metric_info["cas_badval"] = {"title": _("CAS bad identifier"), "unit": "", "color": "12/a"}
graph_info.append({
"title" : _("CAS"),
"metrics" : [
( "cas_hits", "area" ),
( "cas_misses", "stack" ),
( "cas_badval", "line" ),
],
})
...
It defines three metrics and a graph that includes them.
More samples can be found in ~/lib/python/cmk/gui/plugins/metrics/check_mk.py
, e.g.
graph_info["replicas"] = {
"title": _("Replicas"),
"metrics": [
("ready_replicas", "area"),
("total_replicas", "line"),
],
"scalars": ["ready_replicas:crit",]
}
That’s a graph with two metrics but it also shows the CRIT level as a red line (given the CRIT level comes with the performance data).
If you are confused about graph_info.append({…})
vs. graph_info['some_id'] = {…}
then don’t be. graph_info
is actually an OrderedDict
with a special append()
method: if you don’t supply a key, then some unique key (like ID_nnnnn) is generated for you, so either way is OK.