How to read updated config file without restart the daemon

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Anil Bhati
Posts: 1
Joined: Wed Apr 08, 2015 2:30 pm

How to read updated config file without restart the daemon

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

This is not currently possible. Configs are only read into nagios at the start (or restart) of the process.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
DanielB
Posts: 77
Joined: Sun Aug 17, 2014 2:17 pm

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

Post 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 <kdebisschop@infoplease.com>
#  - 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
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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.
Locked