Check_mk 1.6 local plugin query

HI Team
i m setting below value with local plugin for some daemon process on 1.06 check_mk.
P myservice3 count1=28;30;40|count2=25;23;27|count3=66;65;70 OK - This is my custom output"

my small question regarding graph which gets display .
i want to display count1 as count , count2 as Percentage (%) and count3 as MB memory on y axis , how i can achieve the same ?

Hi!
Please check out the “metric_info” definitions in ~/lib/python/cmk/gui/plugins/metrics/check_mk.py, e.g.:
metric_info[“mem_used_percent”] = {
“color”: “#80ff40”,
“title”: _(“RAM used %”),
“unit”: “%”,
}

You can make your own definitons and put them into a file “blahblah.py” located in ~/local/share/check_mk/web/plugins/metrics. Make sure to include the imports of the stuff you use in the file’s header, as done in ~/lib/python/cmk/gui/plugins/metrics/check_mk.py.
Into this file, you can also put graph_info definitions, if you want to combine multiple metrics into one graph.

Have fun!
Lars

Hi Lars

Thanks for the reply .
i m using centos7 for running plugin . and i m using a shell script right now for this purpose .
i dont see path ~/lib/python/cmk/gui/plugins/metrics/ on centos7
currently i have written shel script in /usr/lib/check_mk_agent/local/mylocalcheck.sh
where i m simply passing
echo “P $processname count1=28;30;40|count2=21;23;27|count3=66;65;70 OK - This is my custom output”

Hi!

You have to do these changes as CMK site user. That user has its home in
/opt/omd/sites//, so the path I was referring to above, is:
/opt/omd/sites//lib/python/cmk/gui/plugins/metrics/check_mk.py resp. /opt/omd/sites//local/share/check_mk/web/plugins/metrics.
Please only change files below /opt/omd/sites//local, otherwise you might damage your CMK installation.

Regards
Lars

Hi Lars

can you please give me some example , that will help

Hi!

You will find all the examples in ~/lib/python/cmk/gui/plugins/metrics/check_mk.py, e.g. the “license” metrics absolutely fit to your local check, as the contain “%”, “count” and “bytes”:

"title": _("Used licenses"),
"unit": "%",
"color": "16/a",

}

metric_info[“licenses_total”] = {
“title”: _(“Total licenses”),
“unit”: “count”,
“color”: “16/b”,
}

metric_info[“license_size”] = {
“title”: _(“Size of license”),
“unit”: “bytes”,
“color”: “11/a”,
}

Take these lines, replace “license_percentage” with “count2”, and so on. Then, do an “omd restart apache” and check out your new metrics.

Regards
Lars

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.