How to add a host using a shell script

Ask the experts, I want to use the script to add monitoring hosts in batches, too slow through the directory


I would use the Director and his REST-API for that:

Or the Director Import/sync function to auto import Hosts from Database/CMDB/vmware/etc.

1 Like

thank you, i don’t seem to understand.

Hello, I’m trying to use a script instead of here.
Add a client
Is there any good way?

sudo icinga2 node wizard

Welcome to the Icinga 2 Setup Wizard!

We will guide you through all required configuration details.

Please specify if this is an agent/satellite setup (‘n’ installs a master setup) [Y/n]: y

Starting the Agent/Satellite setup routine…

Please specify the common name (CN) [1604-210]:

Please specify the parent endpoint(s) (master or satellite) where this node should connect to:
Master/Satellite Common Name (CN from your master/satellite node):

Do you want to establish a connection to the parent node from this node? [Y/n]: y
Please specify the master/satellite connection information:
Master/Satellite endpoint host (IP address or FQDN):
Master/Satellite endpoint port [5665]:

Add more master/satellite endpoints? [y/N]: n
Parent certificate information:

Subject: CN =
Issuer: CN = Icinga CA
Valid From: Oct 25 17:10:04 2019 GMT
Valid Until: Oct 21 17:10:04 2034 GMT
Fingerprint: BA 0A F9 A0 75 14 2D AF EF AF 33 3A AE BE 9A C4 39 9D 8D 42

Is this information correct? [y/N]: y

Please specify the request ticket generated on your Icinga 2 master (optional).
(Hint: # icinga2 pki ticket --cn ‘’): 005ec4e46d0bd8e8973f053c3a42102702fea4e3
Please specify the API bind host/port (optional):
Bind Host []:
Bind Port []:

Accept config from parent node? [y/N]: y
Accept commands from parent node? [y/N]: y

Reconfiguring Icinga…
Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.

Local zone name []:
Parent zone name [master]:

Default global zones: global-templates director-global
Do you want to specify additional global zones? [y/N]: n

Do you want to disable the inclusion of the conf.d directory [Y/n]: n


Now restart your Icinga 2 daemon to finish the installation!

okay, you are talking about the agent configuration not a standard host. In this case there are still a agent deployment script which is delivered with the director, to get an idea how to do this with a script.

I’am not using the agent on linux a lot, as we use check by ssh. So i have no good solution for you.

1 Like