keeping RMA running

Remote Monitoring Agent for Linux, FreeBSD, and other UNIX-like platforms.
Post Reply
voor
Posts: 6
Joined: Fri Apr 27, 2007 5:06 pm

keeping RMA running

Post by voor »

I would like to make sure that RMA is always running on my servers and restart it if it died or has been killed for some reason. For other programs that generate a <program>.pid file like syslogd, I can do this in crontab by reading the PID from the file and then checking the process table. Is there any option to make RMA save its PID to a file in a similar manner?
KS-Soft
Posts: 12825
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Probably we can implement such option in next version

Regards
Alex
voor
Posts: 6
Joined: Fri Apr 27, 2007 5:06 pm

Post by voor »

That would be great, looking forward to it! :D
KS-Soft
Posts: 12825
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Done. RMA 1.25 available for download at http://www.ks-soft.net/hostmon.eng/downpage.htm#unix

Regards
Alex
voor
Posts: 6
Joined: Fri Apr 27, 2007 5:06 pm

Post by voor »

Works perfectly, thanks!
voor
Posts: 6
Joined: Fri Apr 27, 2007 5:06 pm

Post by voor »

If anyone is interested, this 'rmachk' Bourne shell script is what I use to check whether RMA is running. If it's not running, then the script will start it and redirect the startup output to /dev/null. Much of the code was shamelessly borrowed from psybncchk. ;) The RMA client must be version 1.25 or higher and the PidFile line in rma.ini must be uncommented.

Code: Select all

#!/bin/sh

# assume the 'rma' executable is at /rma/rma and the PID file is at /var/run/rma.pid

RMAPATH=/rma
RMAPIDPATH=/var/run

# if 'kill -CHLD' is not recognized by the OS (like Solaris), try 'kill -CLD' instead

if test -r $RMAPIDPATH/rma.pid; then
    RMAPID=`cat $RMAPIDPATH/rma.pid`
    if `kill -CHLD $RMAPID >/dev/null 2>&1`
    then
        exit 0
    fi
fi
cd $RMAPATH
./rma rma.ini > /dev/null 2>&1
And this crontab entry tells cron to run rmachk every minute:

Code: Select all

* * * * * /rma/rmachk > /dev/null 2>&1
KS-Soft
Posts: 12825
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Thank you for contribution :)

Regards
Alex
Post Reply