So we have template hosts with all the template services and configs. We have one such template host for each of several different service classifications. Since these are static templates rather than real hosts, they aren't tied to an actual IP. If they were set active they would all permanently show critical. I'd like to have that template host inactive, but used as a basis for bulk host import/clone. It looks like this isn't possible since the bulk host import/clone wizard uses the nagios database which doesnt contain inactive configs.
Is there a way to completely hide a template host from the web interface if I set the templates as active? More preferably, is there a way to use these inactive templates as sources to clone new machines from?
Cloning from template hosts with services
-
akelsoe.seterus
- Posts: 6
- Joined: Thu Oct 29, 2015 6:18 pm
Re: Cloning from template hosts with services
I don't believe this is possible, however you could probably use the REST API to add hosts, using a template of your choice. For example, you could create a simple bash script like the one below:Is there a way to completely hide a template host from the web interface if I set the templates as active? More preferably, is there a way to use these inactive templates as sources to clone new machines from?
Code: Select all
#!/bin/bash
curl -XPOST "http://x.x.x.x/nagiosxi/api/v1/config/host?apikey=l3i0i3np&pretty=1" -d "host_name=1.1.1.1&address=1.1.1.1&use=mytemplate&force=1"
curl -XPOST "http://x.x.x.x/nagiosxi/api/v1/config/host?apikey=l3i0i3np&pretty=1" -d "host_name=2.2.2.2&address=2.2.2.2&use=mytemplate&force=1"
curl -XPOST "http://x.x.x.x/nagiosxi/api/v1/config/host?apikey=l3i0i3np&pretty=1" -d "host_name=3.3.3.3&address=3.3.3.3&use=mytemplate&force=1&applyconfig=1"You can also go another route, where you can automate host management via custom scripts. Read more about the automated host management in XI here:
https://assets.nagios.com/downloads/nag ... gement.pdf
Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Cloning from template hosts with services
Not sure if it would be visible to the bulk tool, but you might try putting the files in the static dir...
Re: Cloning from template hosts with services
A template, copied to the static won't be visible in the web UI, and won't be in the "Bulk Host Cloning and Import" wizard drop-down menu.Not sure if it would be visible to the bulk tool, but you might try putting the files in the static dir...
If you set it up as a "regular" host, then it will be available in the Bulk Host, and will be visible in the GUI.
Be sure to check out our Knowledgebase for helpful articles and solutions!