Persisting data with custom plugin

Is it possible to persist data with a custom plugin in Checkmk?
My use case: Currently I am monitoring the cpu usage of individual Windows services with a local check. That works fine but I only want the service to enter CRIT state when the cpu usage exceeds the given limit over a given period of time. For that every time the local check registers a high cpu usage I´m incrementing a counter in a database. At the same time I´m reading the “high cpu count” out of the database and if it exceeds the given limit I´ll let the service go into CRIT.
Now because of upcoming changes to our infrastructure this will not be so easily possible any more. So it would be great if I could access a datastructure (maybe sqlite or a simple file) inside Checkmk while evaluating the service with a custom plugin.
Would that be possible?

Hi,
you can keep it simple by using the Process Monitoring of processes that starts by the windows service.
Ther is all you need. If you have only the local check, you can only use counts. If you want to use your own solution, you need to write a check plugin and use the function “get_rate” in it.
I hope it helps!
Best regards,
Christian

@ChristianM Thank you for the insight. I will check out the get_rate function as well as the value store. I could use them for other use cases as well. I finally found the API documentation :slight_smile:
Where can I find the counts in the Process Monitoring? Are these accessible with Powershell?

Hi,
the Process monitoring do it for you when you use the process discovery or enforced services.
Best regards,
Christian