Cloning from template hosts with services

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
akelsoe.seterus
Posts: 6
Joined: Thu Oct 29, 2015 6:18 pm

Cloning from template hosts with services

Post by akelsoe.seterus »

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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Cloning from template hosts with services

Post by lmiltchev »

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?
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:

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"
To learn more about the REST API, from the Nagios XI web inteface click on the "Help" menu.

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!
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Cloning from template hosts with services

Post by gormank »

Not sure if it would be visible to the bulk tool, but you might try putting the files in the static dir...
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Cloning from template hosts with services

Post by lmiltchev »

Not sure if it would be visible to the bulk tool, but you might try putting the files in the static dir...
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.
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!
Locked