Combine values from a dynamic list

Hello!

I want to write a plugin with metrics & I want to show the metrics on a single graph.

This is how my metric code looks right now :

metric_info[“perc_comp_avg”] = {
“title”: _(“Average”),
“unit”: “%”,
“color”: “#000000”,
}

for idx, name in enumerate(names):
metric_info[‘perc_comp_%s’ % name] = {
‘title’: _(’%s’) % name,
‘unit’: ‘%’,
‘color’: indexed_color(idx, names)
}

graph_info[“compliance_percent”] = {
‘title’: (‘Compliance’),
‘metrics’: [('perc_comp
%s’ % num, ‘line’) for num in names] + [(‘perc_comp_avg’, ‘line’)],
‘optional_metrics’: [‘perc_comp_%s’ % num for num in names],
}

I want to call apon my variable “names” which is a list of strings that is yielded in checkresult

How can i make this work?

I am new to checkmk and writing plugins but if anyone has questions, ideas or useful information thanks in advance :slight_smile: !

I do not think that this is (currently) possible. I have the same issue with my Ceph extension.

and

have to be kept in sync manually.

@r.sander

so if you are going to combine values on a single graph their names have to be predetermined in the metrics. their names can’t be dynamic?

I would answer yes to that question, as far as I know.