5.3.0 resets nagios file in init.d

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

5.3.0 resets nagios file in init.d

Post 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.
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: 5.3.0 resets nagios file in init.d

Post 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?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: 5.3.0 resets nagios file in init.d

Post 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
Previous Nagios employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: 5.3.0 resets nagios file in init.d

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Re: 5.3.0 resets nagios file in init.d

Post 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.
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: 5.3.0 resets nagios file in init.d

Post by tmcdonald »

Shouldn't be an issue going forward, though I will see about getting the documentation updated.
Former Nagios employee
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Re: 5.3.0 resets nagios file in init.d

Post 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.
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
Locked