Add hosts/services to host/service groups via Check_MK HTTP API

You can find all possible commands inside
https://checkmk.com/cms_web_api_references.html

and also inside the code in the file

 ~/lib/python/cmk/gui/plugins/webapi/webapi.py

The assignment of hosts to host groups is a normal ruleset.

First define a ruleset manually inside WATO, then use the function “get_rulesets_info” to retrieve all available rulesets and then use the “get_ruleset” for your ruleset you want to modify.

I would try to use a python binding like https://github.com/brennerm/check-mk-web-api/tree/master/check_mk_web_api for such doing. It is easier then the very big curl commands.

3 Likes