Page 1 of 1

RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 8:52 am
by paul.jobb
Hi;

I ran the following: http://assets.nagios.com/downloads/nagi ... ramdisk.sh , on a brand new XI vm image however the nagios and npcd services don't want to auto start on a reboot. I was hoping you might have a suggestion as to how to correct that.

Thanks,

Paul

Re: RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 9:04 am
by lmiltchev
Did you use the VMware VM or the vSphere OVF template? 32- or 64-bit? Can you post the "/etc/sysconfig/nagios" and the "/etc/init.d/nagios" files for a review?

Re: RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 9:51 am
by paul.jobb
it was the ovf template 64 bit: nagiosxi-2014r2.7-64.ova
etc.zip

Re: RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 11:54 am
by lmiltchev
I was able to recreate the issue. It is a bug. :(

I will be working on modifying the script. For the time being, here's a solution. Add the following line to the "/etc/sysconfig/nagios" file right below the "RAMDISK_SIZE=xxx" line. See an example below:
USE_RAMDISK=1
RAMDISK_DIR=/var/nagiosramdisk
RAMDISK_SIZE=500
mount -t tmpfs -o size=${RAMDISK_SIZE}m tmpfs ${RAMDISK_DIR}
...
Reboot your system and see if nagios and npcd will start OK. Let me know if this fixed your issue. Thanks!

Re: RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 12:30 pm
by paul.jobb
yes they auto started, does show up as being mounted twice though i'm not sure if that matters
Capture.JPG

Re: RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 1:29 pm
by lmiltchev
I am sorry, one more change was needed. We need to mount the ramdisk only if it is not mounted already. As is, it will add a new mountpoint on each reboot. :(

Replace the mount line:

Code: Select all

mount -t tmpfs -o size=${RAMDISK_SIZE}m tmpfs ${RAMDISK_DIR}
in the /etc/sysconfig/nagios with this:

Code: Select all

if [ "`mount |grep "${RAMDISK_DIR} type tmpfs"`"X == "X" ]; then
        mount -t tmpfs -o size=${RAMDISK_SIZE}m tmpfs ${RAMDISK_DIR}
fi
Reboot again, wait for a several seconds, then check:

Code: Select all

service nagios status
service npcd status
df -h

Re: RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 2:36 pm
by paul.jobb
looks good now, both services are running and only one ramdisk, thank you for your help I appreciate it.
Capture.JPG

Re: RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 2:53 pm
by hsmith
paul.jobb wrote:looks good now, both services are running and only one ramdisk, thank you for your help I appreciate it.
Capture.JPG
Do you want us to close this topic, or do you want to leave it open for just a little longer in case this comes back?

Re: RAM disk and processes not auto starting after reboot

Posted: Thu Sep 10, 2015 3:36 pm
by paul.jobb
I think its fine to close