create service without GUI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: create service without GUI

Post by lmiltchev »

@hzsoliel, let us know if you have any further questions.
Be sure to check out our Knowledgebase for helpful articles and solutions!
hzsoliel
Posts: 34
Joined: Fri Sep 28, 2018 1:34 pm

Re: create service without GUI

Post by hzsoliel »

Thanks, Bomahony and lmiltchev. The request came from our clients. We used to give them the GUI solutions to guide them how to set up the monitored hosts, hostgroups, plugins, commands, services, dashlets, dashboards etc and they get tired of it when they set up a new environment. They want to have an ansible solution. Our team are good at ansible but need to know a quick and easy way to do all these without GUI. I check the REST API and it looks like complicated. Currently we are configuring hosts, hostgroups, commands and services by copying the cfg files or ansible templates to /usr/local/nagios/etc/import and then run reconfigure_xi.sh. I need help to do the dashlets and dashboard. Does copying the all related files including .css, .png, .js, .xml, .php to /usr/local/nagiosxi/html/includes/dashlets suffient? or I have to do something else? Thanks,

Heather
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: create service without GUI

Post by lmiltchev »

I need help to do the dashlets and dashboard. Does copying the all related files including .css, .png, .js, .xml, .php to /usr/local/nagiosxi/html/includes/dashlets suffient? or I have to do something else? Thanks,
As I mentioned before, not all of the settings are in config files. The xi users, dashlets, and dashboards are in the nagiosxi database in mysql. You are NOT going to find them in flat files. That's why the best way to migrate all of these objects is via our backup/restore procedure.
Be sure to check out our Knowledgebase for helpful articles and solutions!
hzsoliel
Posts: 34
Joined: Fri Sep 28, 2018 1:34 pm

Re: create service without GUI

Post by hzsoliel »

lmiltchev,

Per your advice, it looks like that Rest API is the only approach to configure the dashlets and dashboards without GUI approach. Can you kindly give me an example on how to use API to do it?

Thanks,

Heather
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: create service without GUI

Post by lmiltchev »

Per your advice, it looks like that Rest API is the only approach to configure the dashlets and dashboards without GUI approach.
I never said that... I said that xi users, dashlets, and dashboards are not in the flat files, but in the nagiosxi database in mysql, therefore the best way to migrate them would be to use our backup/restore procedure. This is our recommended approach (which can be done from the CLI; it doesn't have to be performed in the GUI):

https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
hzsoliel
Posts: 34
Joined: Fri Sep 28, 2018 1:34 pm

Re: create service without GUI

Post by hzsoliel »

Thanks, lmiltchev.
If there is no source to backup, i.e. if this is the intial configuration, do I leave one option to go without GUI, that is REST API? Thanks.

Heather
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: create service without GUI

Post by lmiltchev »

You can use the REST API or you can create configs manually (or via a script), place them in the /usr/local/nagios/etc/import directory, and run the /usr/local/nagiosxi/scripts/reconfigure_nagios.sh script. The problem is that some of the objects cannot be imported this way, as they don't exist in Nagios Core. Some of them exist only in Nagios XI. For example, you can create a config called contacts.cfg, place it in the import directory and run reconfigure. This way you will import all of the contacts, defined in this file. However, there is no config for the "xi users"... So, you can't really use this approach. You could use the REST API to add a xi user, but you cannot use REST API to add dashlets or dashboards. So, this will work only "partially".

So, ultimately you could use REST API or scripting, add these commands in an ansible playbook, etc., but you wouldn't be able to create ALL of the objects/settings this way. I hope this makes sense.
Be sure to check out our Knowledgebase for helpful articles and solutions!
hzsoliel
Posts: 34
Joined: Fri Sep 28, 2018 1:34 pm

Re: create service without GUI

Post by hzsoliel »

Thanks. That's the good information. You may go ahead to close this thread.

Heather
Locked