Change of hostgroups.cfg without restarting nagios

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
yomiko
Posts: 22
Joined: Mon Aug 21, 2017 6:45 pm

Change of hostgroups.cfg without restarting nagios

Post by yomiko »

If I changed the cfg files in objects/ (e.g. hostgroups.cfg), is there a way to make nagios pick up the
config changes without restarting the nagios service?

The server is running RHEL7.

Using the unit file below.

Code: Select all

[Unit]
Description=Nagios Network Monitoring
After=network.target
Documentation=https://www.nagios.org/documentation/

[Service]
Type=forking
User=nagios
Group= nagios
PIDFile=/app/var/nagios/nagios.pid
#----------------------------------------------------------
# Verify Nagios config before start as upstream suggested
#----------------------------------------------------------
ExecStartPre=/usr/sbin/nagios -v /app/etc/nagios/nagios.cfg
ExecStart=/usr/sbin/nagios -d /app/etc/nagios/nagios.cfg
ExecStopPost=/usr/bin/rm -f /app/var/nagios/rw/nagios.cmd

[Install]
WantedBy=multi-user.target

What should the ExecReload command be like? This doesn't work

ExecReload=/usr/bin/kill -HUP $MAINPID


Thanks!
yomiko
Posts: 22
Joined: Mon Aug 21, 2017 6:45 pm

Re: Change of hostgroups.cfg without restarting nagios

Post by yomiko »

Nevermind. It worked. :)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Change of hostgroups.cfg without restarting nagios

Post by scottwilkerson »

Excellent, glad it is resolved.

Usually you just need to restart nagios after making the change.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked