Page 1 of 1

How to read updated config file without restart the daemon

Posted: Wed Apr 08, 2015 2:43 pm
by Anil Bhati
Hi team, I just want to use the Nagios for monitoring the routers/switch for my company. but found one challenge in nagios as whenever i am adding new device(s) in the tool for start monitoring this devices I would need to restart the Nagios everytime.

I just need to know is there any other way to read the updated config without restart the nagios daemon. Any other parser/supplier who can provide the updated configuration to the nagios daemon without restarting.

Please revert to me if we overcome this limiations.


Thanks in Advance.

Re: How to read updated config file without restart the daem

Posted: Wed Apr 08, 2015 2:49 pm
by abrist
This is not currently possible. Configs are only read into nagios at the start (or restart) of the process.

Re: How to read updated config file without restart the daem

Posted: Sun May 10, 2015 7:09 am
by DanielB
Hi, abrist.
abrist wrote:This is not currently possible. Configs are only read into nagios at the start (or restart) of the process.
What about the "reload" option?

Code: Select all

# /etc/init.d/nagios 
Usage: nagios {start|stop|restart|reload|force-reload|status|check}

Code: Select all

# 1999-07-09 Karl DeBisschop <[email protected]>
#  - setup for autoconf
#  - add reload function

(...)

        reload|force-reload)
                printf "Running configuration check..."
                $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
                if [ $? -eq 0 ]; then
                        echo "done."
                        if test ! -f $NagiosRunFile; then
                                $0 start
                        else
                                pid_nagios
                                if status_nagios > /dev/null; then
                                        printf "Reloading nagios configuration..."
                                        killproc_nagios nagios -HUP
                                        echo "done"
                                else
                                        $0 stop
                                        $0 start
                                fi
                        fi
                else
                        echo " CONFIG ERROR!  Reload aborted.  Check your Nagios configuration."
                        exit 1
                fi
                ;;
Best regards,
Daniel

Re: How to read updated config file without restart the daem

Posted: Mon May 11, 2015 9:16 am
by jdalrymple
DanielB wrote:

Code: Select all

                        if test ! -f $NagiosRunFile; then
                                $0 start
                        else
                                pid_nagios
                                if status_nagios > /dev/null; then
                                        printf "Reloading nagios configuration..."
                                        killproc_nagios nagios -HUP
                                        echo "done"
                                else
                                        $0 stop
                                        $0 start
                                fi
HUP is the same as a restart to the Nagios Daemon. There is an aesthetic difference in that you maintain the same PID, but the man behind the curtain is doing the same thing.