Page 1 of 1
5.3.0 resets nagios file in init.d
Posted: Tue Oct 18, 2016 4:38 am
by rajasegar
Please take note that 5.3.0 resets the nagios file in /etc/init.d/nagios and also the npcd file also.
So all the changes made for the ram disk optimisation was gone.
Excerpt from Nagios Utilising_A_RAM_Disk_In_NagiosXI.pdf
Code: Select all
Update the Nagios init script so that the required directories exist.
Add the following lines to the top of /etc/init.d/nagios just under the comments:
mkdir -p -m 775 /var/nagiosramdisk
mkdir -p -m 775 /var/nagiosramdisk/tmp
mkdir -p -m 775 /var/nagiosramdisk/spool
mkdir -p -m 775 /var/nagiosramdisk/spool/checkresults
chown -R nagios.nagios /var/nagiosramdisk
Update the NPCD init script to ensure the required directories exist.
Add the following lines to the top of /etc/init.d/npcd just under the comments:
mkdir -p -m 775 /var/nagiosramdisk
mkdir -p -m 775 /var/nagiosramdisk/spool
mkdir -p -m 775 /var/nagiosramdisk/spool/xidpe
mkdir -p -m 775 /var/nagiosramdisk/spool/perfdata
chown -R nagios.nagios /var/nagiosramdisk
When the server was rebooted all graphs failed.
Please ensure things like this don't happen again. We were following your official document.
Re: 5.3.0 resets nagios file in init.d
Posted: Tue Oct 18, 2016 8:26 am
by BanditBBS
I see this in my nagios file:
Code: Select all
# Automate addition of RAMDISK based on environment variables
USE_RAMDISK=${USE_RAMDISK:-0}
if test "$USE_RAMDISK" -ne 0 && test "$RAMDISK_SIZE"X != "X"; then
ramdisk=`mount |grep "${RAMDISK_DIR} type tmpfs"`
if [ "$ramdisk"X == "X" ]; then
mkdir -p -m 0755 ${RAMDISK_DIR}
mount -t tmpfs -o size=${RAMDISK_SIZE}m tmpfs ${RAMDISK_DIR}
mkdir -p -m 0755 ${RAMDISK_DIR}/checkresults
chown -R $NagiosUser:$NagiosGroup ${RAMDISK_DIR}
fi
fi
So in addition to rajasegar's comments, what settings is it reading and how large does it know to create the ram disk?
Re: 5.3.0 resets nagios file in init.d
Posted: Tue Oct 18, 2016 9:56 am
by avandemore
@rajasegar Task id 9816 has been created for this issue. You may inquire on the forums or email support in the future about its status.
@BanditBBS Those variables are read from the files referenced in the document referenced earlier:
Utilizing a RAM Disk in Nagios XI
Re: 5.3.0 resets nagios file in init.d
Posted: Tue Oct 18, 2016 10:39 am
by lmiltchev
@rajasegar
Just to clarify - the ramdisk document you referenced no longer exists. The
new document doesn't have these instructions - see the "Manual RAM Disk Installation" section.
The nagios init script gets overwritten on upgrades if Nagios Core version is upgraded, therefore we changed the way nagios ramdisk is installed. We no longer modify the fstab entires, or add "mkdir xxx" lines to the "/etc/init.d/nagios" file. Instead, we have the following code:
Code: Select all
# Load any extra environment variables for Nagios and its plugins.
if test -f /etc/sysconfig/nagios; then
. /etc/sysconfig/nagios
fi
in the nagios init file, and the following code (as an example)
Code: Select all
USE_RAMDISK=1
RAMDISK_DIR=/var/nagiosramdisk
RAMDISK_SIZE=100
if [ "`mount |grep "${RAMDISK_DIR} type tmpfs"`"X == "X" ]; then
mount -t tmpfs -o size=${RAMDISK_SIZE}m tmpfs ${RAMDISK_DIR}
fi
mkdir -p -m 775 ${RAMDISK_DIR} ${RAMDISK_DIR}/tmp ${RAMDISK_DIR}/spool
${RAMDISK_DIR}/spool/checkresults ${RAMDISK_DIR}/spool/xidpe ${RAMDISK_DIR}/spool/perfdata
chown -R nagios:nagios ${RAMDISK_DIR}
in the "/etc/sysconfig/nagios".
You will need to modify your old ramdisk install to follow the "new way" of doing it. This way, you are not going to have any more ramdisk issues on future upgrades.
Re: 5.3.0 resets nagios file in init.d
Posted: Tue Oct 18, 2016 6:32 pm
by rajasegar
lmiltchev wrote:@rajasegar
Just to clarify - the ramdisk document you referenced no longer exists. The
new document doesn't have these instructions - see the "Manual RAM Disk Installation" section.
The nagios init script gets overwritten on upgrades if Nagios Core version is upgraded, therefore we changed the way nagios ramdisk is installed. We no longer modify the fstab entires, or add "mkdir xxx" lines to the "/etc/init.d/nagios" file. Instead, we have the following code:
Code: Select all
# Load any extra environment variables for Nagios and its plugins.
if test -f /etc/sysconfig/nagios; then
. /etc/sysconfig/nagios
fi
in the nagios init file, and the following code (as an example)
Code: Select all
USE_RAMDISK=1
RAMDISK_DIR=/var/nagiosramdisk
RAMDISK_SIZE=100
if [ "`mount |grep "${RAMDISK_DIR} type tmpfs"`"X == "X" ]; then
mount -t tmpfs -o size=${RAMDISK_SIZE}m tmpfs ${RAMDISK_DIR}
fi
mkdir -p -m 775 ${RAMDISK_DIR} ${RAMDISK_DIR}/tmp ${RAMDISK_DIR}/spool
${RAMDISK_DIR}/spool/checkresults ${RAMDISK_DIR}/spool/xidpe ${RAMDISK_DIR}/spool/perfdata
chown -R nagios:nagios ${RAMDISK_DIR}
in the "/etc/sysconfig/nagios".
You will need to modify your old ramdisk install to follow the "new way" of doing it. This way, you are not going to have any more ramdisk issues on future upgrades.
The point is we were not notified. We cannot be checking every single file to see if Nagios made any changes to it.
I already added the create directories in /etc/sysconfig/nagios yesterday.
I think as a good practice creation of mount points should be centralised in fstab and not individually in init files.
Re: 5.3.0 resets nagios file in init.d
Posted: Wed Oct 19, 2016 1:19 pm
by tmcdonald
Shouldn't be an issue going forward, though I will see about getting the documentation updated.
Re: 5.3.0 resets nagios file in init.d
Posted: Wed Oct 19, 2016 6:21 pm
by rajasegar
tmcdonald wrote:Shouldn't be an issue going forward, though I will see about getting the documentation updated.
Ok. Please close this thread.