Writing to nagios.cmd in Distributed Monitoring


I’m attempting to write a curses based interface for day-to-day checkmk usage: https://gitlab.com/larsfp/checkmk-commander

I hoped that I could write all commands (like ACKNOWLEDGE_SVC_PROBLEM) to the master nagios.cmd, but it seems I can not. Is there another way to do it, or do I have to connect to each and every node via ssh to access the nagios sockets?

I would suggest to use the web API for that.

Thanks, but from https://checkmk.com/cms_web_api.html and https://checkmk.com/cms_web_api_references.html it seems to only support WATO stuff, like add and edit hosts. Not ack, downtime, add comment, which are what I’m looking for.

1 Like

Ok, I found some bits around the net about using the URLs seen in the web interface, but with output_format=cvs or json

Like this:

Will experiment and see if I can run my commands like that. I’ll post the results.

do you know this: https://checkmk.com/cms_livestatus_references.html


1 Like

Hi @ways

I opened a topic about it log time ago here:


The Multisite-API is hidden in the legacy documentation: https://checkmk.com/cms_legacy_multisite_automation.html

1 Like

thanks for sharing @r.sander that help me a alot :+1: , is there a way to get a check status via api, e.g if its crit/warn/ok I want use that in Bash/Python…?

Aha. Thanks. That worked. Migrating to only use web api!

1 Like

@ways can you Post the solution here for us :flushed:


Hi. Of course. My solution was to use the web API. The exact implementation can be seen here:

The link should be permanent, but including a copy/paste of it. It’s python code making a web request.

r = requests.get(self.checkmkhost + \
            'check_mk/view.py' + \
            '?_transid=-1&_do_actions=yes&view_name=service&_do_confirm=yes' + \
            '&host=' + host + \
            '&service=' + service + \
            '&_acknowledge=Acknowledge&_ack_sticky=on&_ack_notify=on' + \
            '&_ack_comment=' + comment + \
            '&output_format=json&_username=' + \
            self.checkmkusername + \
            '&_secret=' + \
1 Like

Yes, you just “call” a view via URL with output_format=json appended.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.