Nagios CLI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
oz123
Posts: 42
Joined: Thu Jun 09, 2011 10:21 am

Nagios CLI

Post by oz123 »

Hi,

Is there a way to "Apply Configuration" from command ?
I'm using Linux.
I can verify but how do i Apply ?

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Thanks
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Nagios CLI

Post by mguthrie »

The /usr/local/nagiosxi/scripts/reconfigure_nagios.sh is the actual script that gets run under the hood when you Apply Configuration. : )
oz123
Posts: 42
Joined: Thu Jun 09, 2011 10:21 am

Re: Nagios CLI

Post by oz123 »

Great !! Thanks
Another question, before the "Apply Configuration" I'm using the "Import Config Files" to import all services under /etc/services.
Can i do it from CLI also ?

Thanks
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Nagios CLI

Post by mguthrie »

If you're importing configs, I would strongly recommend reading the below docs and using the procedure outlined in them. There is a config prep process that should be run before importing.

http://assets.nagios.com/downloads/nagi ... ngfromcore
oz123
Posts: 42
Joined: Thu Jun 09, 2011 10:21 am

Re: Nagios CLI

Post by oz123 »

Hi,

I'm familiar with the import steps.
I need it in CLI as I need Nagios to be able to to change between two states automatically using a script.
I have 2 folders containing a defferent services.cfg files which I made in advance and i need to be able to control which is active, means 1 of the 2 folders content should be copied into /usr/local/nagios/etc/services

Steps in script:
1) deleting all current /usr/local/nagios/etc/services content
2) copy the desired content from 1 of the 2 folders I made in advance into /usr/local/nagios/etc/services
3) truncating from nagiosql database the tbl_service table.

then I need to do 2 more steps in that script:
4) import all /etc/services content to database - I don't know how it can be done from CLI so I'm doing it meanwhile from GUI
5) Apply configuration (which I know now how to do it as you helped me) -
/usr/local/nagiosxi/scripts/reconfigure_nagios.sh

so I need your help only with section number 4

Hope this is clear

Thanks
oz123
Posts: 42
Joined: Thu Jun 09, 2011 10:21 am

Re: Nagios CLI

Post by oz123 »

Found it,

I just copied the new folder content to "/usr/local/nagios/etc/import" and ran the "/usr/local/nagiosxi/scripts/reconfigure_nagios.sh"

Thanks anyway
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Nagios CLI

Post by mguthrie »

Yeah, that was going to be my suggestion. Just a note though, the import directory is meant for *new* configs, I wouldn't recommend it for regular configuration changes.
Locked