The ramdisk code in the new init script does not have all of the directories created that you have defined. I would still add that code back into your script.
I have found nothing in any document that describes this secret incantation, and hopefully in the next release of Nagios there will be updated documentation as well as streamlining the ramdisk/ tmpfs process. You still need to have the nagios.cfg file to match the ramdisk directories in order to utilize the ramdisk.
I would recommend to anyone who has modified the nagios init script /etc/init.d/nagios, to make a backup copy of the script before proceeding:
Code: Select all
cp /etc/init.d/nagios /etc/nagios.init.origCode: Select all
cp -r /tmp/nagiosxi/subcomponents/nagioscore/mods/nagios.init /etc/init.d/nagiosCode: Select all
vi /etc/init.d/nagiosCode: Select all
change the following:
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
Code: Select all
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 775 /var/nagiosramdisk
mkdir -p -m 775 ${RAMDISK_DIR}/tmp
mkdir -p -m 775 ${RAMDISK_DIR}/spool
mkdir -p -m 775 ${RAMDISK_DIR}/spool/checkresults
chown -R $NagiosUser:$NagiosGroup ${RAMDISK_DIR}
fi
fiCode: Select all
vi /etc/sysconfig/nagiosCode: Select all
export USE_RAMDISK=1
export RAMDISK_DIR=/var/nagiosramdisk
export RAMDISK_SIZE=50Code: Select all
service nagios restart