How to create Host automatically


we have several Windows virtual machines, where Check_MK-agent is automatically installed when deploying the machine.

Is it possible to automatically create the corresponding host in Check_MK just because of the agent communication? Or is there any other interface to create hosts automatically with?

Best regards,

You can use Bulk Discovery:

As the agent communication is pull initiated from the monitoring server there is no agent communication before the host is configured in CheckMK.

You can use the WATO API to automate the configuration steps:

Bulk Discovery only works after the host has been configured in CheckMK.
You can use “Bulk Import” via CSV, but this cannot be easily automated.

1 Like

new informations for me thank you @r.sander :slight_smile:

OK, thanks for the information. I hoped that the agent would somehow already communicate with CheckMK even if no host is configured.

I will have to try the WATO API then to create the host(s).

Call curl with the IP of the host like:

root@linux# curl “http://myserver/mysite/check_mk/” -d ‘request={“hostname”:“myserver123”,“folder”:“munich/network”,“attributes”:{“ipaddress”:“”,“site”:“prod”,“tag_agent”:“cmk-agent”},“create_folders”:“0”}’

As @neeloj said, you can use this for example with your IPAM solution or just do a dns query for all systems and add all missing hostnames with the api :slight_smile:

You can also do it with a network scan (regular). This is an option of a folder. You can decide what is happening to new hosts if they are found.
Hosts -> Folder properties -> Network Scan.


Thanks for all the answers.

I used the add_host-action in combination with Invoke-WebRequest (powershell) and included this in the software, which installs the machines that I want to integrate. It works just as required, thanks!

1 Like

Hello UT2019,

it would be nice if there are some ansible modules for those kind of jobs.

for example:

name: create host myserver123
    cmk_server: "{{ cmkserver }}"
    cmk_user: "{{ cmkadm }}"
    cmk_password: "{{ cmkpw }}"
    name: myserver123
    state: present
    folder: munich/network
      site: prod
      tag_agent: cmk-agent
    create_folders: 0

i found a webapi wrapper This might help to create ansible modules. I like to contribute this. What about you?

kind regards



I do not know Ansible yet and did not use it either. I integrated the creation of the CheckMK-host into our software deployment system (Matrix42 Empirum).

Best regards,