Page 1 of 3
create service without GUI
Posted: Wed Oct 31, 2018 3:04 pm
by hzsoliel
We usually create services through GUI. This is the multiple step task. Of course, we have had the plugin as a shell script. First, we import the plugin and then create the command for the plugin. After that we create the service using the command. This is all done through GUI. It is preferred to accomplish this using the ansible on our project. We can't use GUI in this case. Can you show me how to configure a service without using GUI? I would like to see how you do it by SSH to the Nagios server. I'm able to translate your manual steps into ansible.
Thanks,
Heather
Re: create service without GUI
Posted: Wed Oct 31, 2018 3:37 pm
by lmiltchev
You can download the plugin to the plugins directory (/usr/local/nagios/libexec) using curl or wget. Then, you could add the command and the service via the REST API. See the Config Reference section of the REST API Docs under the Help menu in Nagios XI.
Re: create service without GUI
Posted: Thu Nov 01, 2018 1:47 pm
by hzsoliel
Is it possible that I develop a configuration file and put it into the /usr/local/nagios/etc/import folder and then run /usr/local/nagiosxi/scripts/reconfigure_nagios.sh ? I did see this practice on some project but not sure if this is the right approach? Will this approach append the new configuration to the existing commands/services or will it wipe the existing commands/services out?
Thanks,
Heather
Re: create service without GUI
Posted: Thu Nov 01, 2018 3:08 pm
by lmiltchev
Yes, placing your configs in the /usr/local/nagios/etc/import folder and then running /usr/local/nagiosxi/scripts/reconfigure_nagios.sh will work too. This approach will either add or update a command or a service. It will not wipe out the existing commands/services.
Re: create service without GUI
Posted: Thu Nov 01, 2018 3:16 pm
by hzsoliel
I tested this approach and it worked. Now, I will like to know if I want to gather all my current configuration, is it sufficient that I go through my nagios.cnf file? Will I miss anything? Our Nagios server was configured using GUI over the time and we don't have the records that what have been configured. I'm working on gather all the configuration file and set up a new Nagios with all the current configuration. Thanks,
Heather
Re: create service without GUI
Posted: Thu Nov 01, 2018 3:52 pm
by lmiltchev
I'm working on gather all the configuration file and set up a new Nagios with all the current configuration.
You can backup your "old" Nagios XI server, move your backup to the "new" server, then restore.
Note: To avoid any issues, make sure to use the same operating system/architecture and same Nagios XI version on both, the old and the new server.
To learn how to backup & restore Nagios XI, read the document below:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Re: create service without GUI
Posted: Fri Nov 02, 2018 9:26 am
by hzsoliel
we have to change the host IPs and names because we are moving from staging to the development. The backup and restore is our current practice but it is not good. We have to change the IPs and host names through GUI every time we do a restore. We are eliminating all the manual steps and replacing with the ansible playbook. What do you recommend?
Re: create service without GUI
Posted: Fri Nov 02, 2018 11:22 am
by lmiltchev
Providing help with ansible playbooks and basic administrative tasks, e.g. changing IPs and host names is out of scope of Nagios support. We wouldn't be able to recommend an ansible playbook (or commands to run) anyway, as we are not familiar with your specific environment and your requirements.
Re: create service without GUI
Posted: Fri Nov 02, 2018 1:14 pm
by hzsoliel
I'm not asking you to provide the help on how to do the ansible or how to update the IP and host name. What I'm asking is:
How do you do a bunch of configurations without GUI if we don't want to use REST API? Restore and backup doesn't work because we don't have one to export from.
Re: create service without GUI
Posted: Fri Nov 02, 2018 1:20 pm
by hzsoliel
By the way, I saw some project use a makefile to do the install, which is really very nice. In this makefile, they copy different types of files to different folders like below and then copy the command, service files into /usr/local/nagios/etc/import folder. At last, /usr/local/nagios/libexecs/reconfigure.sh runs. Everything looks good. Is this the right approach to do it?
prefix = /usr/local
root_nagios = $(prefix)/nagios
root_nagiosxi = $(prefix)/nagiosxi
dir_snmp_mibs = /usr/share/snmp/mibs
dir_naglibexec = $(root_nagios)/libexec
dir_nagimport = $(root_nagios)/etc/import
dir_rrd_graph = $(root_nagios)/share/pnp/templates
dir_rra_config = $(root_nagios)/etc/pnp
dir_rrd_checks = $(root_nagios)/etc/pnp/check_commands
dir_conf_dashlet = $(root_nagiosxi)/html/includes/dashlets/dcs_conf_stats
dir_chat_dashlet = $(root_nagiosxi)/html/includes/dashlets/dcs_chat_stats