Local storage for own check

Hello,

I need to store locally on checkmk server some data by my check plugin
I try to monitor some hardware built with module boards, so I need to store quantity and types of used boards to detect if there is any change, and to have possibility to accept changes. I need behavior like log analyze plugin - it store logged events and they can be accepted by pressing “Acknowledge problems” button.

How can I do this?

Hi Tomasz,

I assume you are looking for something like the Logwatch Plugin?

If not, then you probably mean the logs found in Out-Of-Band Management Boards like the HP iLO IML. CheckMK can monitor this and the service will switch back to “OK” upon acknowledging these logs inside the webinterface.

I’m not sure though, I still can’t make any sense of

I need to store quantity and types of used boards

Anyways,
happy monitoring!

Not exactly.

I got monitoring data by SNMP, board list are included, and it work fine. All I need is to store board list and configuration locally on checkmk server. I can use file = open (“/tmp/my_file_name”, “w”), and file.write "(“my data here”) in my check agent, but it is dirty hack. I suppose that there is some nice and legal way to this.
And still don’t know how to add any kind of “acknowledge” button. I try to analyze logwatch.py to find how to do it, with no results. I do not use python, only for checkmk so maybe it is the reason.

If you need to store any kind of data between checks to compare them, use the value store. See the API reference in your site at:

http://myhost/mysite/check_mk/plugin-api/cmk.agent_based/v1.html#cmk.base.plugins.agent_based.agent_based_api.v1.get_value_store

1 Like

Thx.

I looks like solution, but… I still ave problems.
I tested this function this way:

get_value_store ()["test"] = "OK"
print (get_value_store()["test"])

and get “OK” string.
But where i add following fragment in check function

counter = 0
    for line in section[0]:
        conf_line = [counter, line[0]]
        tmp_name = str (counter)
        changed = 0
        try:
            stored_line = get_value_store[tmp_name]
        except:
            changed = 1
            get_value_store ()[tmp_name] = conf_line
        counter = counter + 1

variable changed has always value 1. It looks like my data are not stored at first call of check function

All is OK. I’m blind as a bat. Addidng ‘()’ to stored_line = get_value_store [tmp_name] make it working :slight_smile:

1 Like