Bring data to check MK using the REST API

We are using the Check MK enterprise version within our organization.

I am scrolling trough the REST API documentation, but I can’t find my answer. Also Google is not really helping me.

We are making a custom application (in Python). This application has different workers, which run their own task. We want to include these workers in our Check MK instance, to monitor their statuses.

The workers are running on machines, on which we can not install an Check MK agent. So I was thinking that we can maybe use the REST API to post a status update of the workers.
But in the whole documentation of the API I can not find anything that would achieve this goal.

Can anyone point me in the right direction?
Thanks.

You can use the Multisite API to submit service check results for passive checks.

Here two examples how:

                url = f"{app.config['CMK_URL']}check_mk/view.py?_fake_0=OK&_do_actions=yes"\
                       "&_fake_output=API+RESET"\
                       "&_do_confirm=yes&_transid=-1&{payload_str}"
                requests.get(url, verify=app.config['SSL_VERIFY'], timeout=20)

And for Hosts:

                url = f"{app.config['CMK_URL']}check_mk/view.py?_fake_0=UP&_do_actions=yes"\
                       "&_fake_output=API+RESET"\
                       "&_do_confirm=yes&_transid=-1&{payload_str}"

The Payload is built here:

 if job == "host":
        payload['view_name'] = 'hoststatus'
    elif job == "service":
        payload['service'] = svc
        payload['view_name'] = 'service_snow'
        #service down
    else:
        raise ValueError("invalid id")

    payload['site'] = site
    payload['host'] = host

    return "&".join([x+"="+urllib.parse.quote(y) for x, y in payload.items()])

I use that in this Script:

2 Likes