Page 3 of 3

Re: create service without GUI

Posted: Tue Nov 06, 2018 12:08 pm
by lmiltchev
@hzsoliel, let us know if you have any further questions.

Re: create service without GUI

Posted: Wed Nov 07, 2018 10:10 am
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

Re: create service without GUI

Posted: Wed Nov 07, 2018 10:22 am
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.

Re: create service without GUI

Posted: Wed Nov 07, 2018 10:46 am
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

Re: create service without GUI

Posted: Wed Nov 07, 2018 1:32 pm
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

Re: create service without GUI

Posted: Wed Nov 07, 2018 1:36 pm
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

Re: create service without GUI

Posted: Wed Nov 07, 2018 1:59 pm
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.

Re: create service without GUI

Posted: Wed Nov 07, 2018 2:12 pm
by hzsoliel
Thanks. That's the good information. You may go ahead to close this thread.

Heather