Rule for automatic discovery of labels

Hi all, now I got it to work. Some hints for those who want to do it too:

  • You don’t need to use POST at all; all parameters to the ajax_service_discovery.py call can be urlencoded GET arguments.
  • For the web request to work at all, the three parameters _transid (with value ‘-1’), _username and _secret have to be present.
  • The call has to contain folder_path (empty, or whatever path) and host_name (obviously) arguments.
  • Finally an arg request has to be present, with the JSON-encoded variables action (update_host_labels) and five flags: ignore_errors, show_checkboxes, show_parameters, show_discovered_labels, show_plugin_names (all set to “true”).
  • Afterwards, you have to do the ‘apply changes’ action, just as you would do in the web frontend, do it according to https://checkmk.com/cms_web_api_references.html.

Regards,
sultansofswing.

2 Likes