Install Hostmonitor RMA on Ubuntu 12.04

Remote Monitoring Agent for Linux, FreeBSD, and other UNIX-like platforms.
Post Reply
qwerty
Posts: 15
Joined: Thu Sep 12, 2013 5:48 am

Install Hostmonitor RMA on Ubuntu 12.04

Post by qwerty »

Get RMA files

Code: Select all

#
mkdir -p /usr/local/src/rma
cd /usr/local/src/rma
#
wget http://www.hostmonitor.biz/download/rma/rma129_lin_x64.tgz
#
tar -xzf rma129_lin_x64.tgz
#
Copy RMA files to appropriate location

Code: Select all

#
mkdir /usr/local/etc/rma
mkdir /usr/local/etc/rma/docs
#
#
cp rma /usr/bin
#
cp rma.ini /usr/local/etc/rma
#
cp cpu.sh /usr/local/etc/rma
cp proccnt.sh /usr/local/etc/rma
cp proclist.sh /usr/local/etc/rma
#
cp INSTALL /usr/local/etc/rma/docs
cp LICENSE /usr/local/etc/rma/docs
cp README /usr/local/etc/rma/docs
#
Edit Agent ini file

Code: Select all

sudo vi /usr/local/etc/rma/rma.ini

Code: Select all

RmaPath = /usr/bin/rma
Password=*******
CPUUsageScript=/usr/local/etc/rma/cpu.sh
ProcCntScript=/usr/local/etc/rma/proccnt.sh
ProcListScript=/usr/local/etc/rma/proclist.sh
Create startup script

Code: Select all

sudo touch /etc/init.d/rma
Edit startup script

Code: Select all

sudo vi /etc/init.d/rma

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides:          Host Monitor RMA
# Required-Start:    $local_fs $syslog
# Required-Stop:     $local_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Host Monitor RMA
### END INIT INFO

# Author: ***** <*****@****.***>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESCRIPTION="Host Monitor RMA"
NAME=rma
RMA_INI_FILE=/usr/local/etc/rma/rma.ini
DAEMON=/usr/bin/$NAME
DAEMON_ARGS="-d $RMA_INI_FILE"
PIDFILE=$PIDNAME.pid
PIDSPATH=/var/run
PIDFILE=$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

RUNAS=root                              #user to run as

SCRIPT_OK=0                             #ala error codes
SCRIPT_ERROR=1                          #ala error codes
TRUE=1                                  #boolean
FALSE=0                                 #boolean

#------------------------------------------------------------------------------
#                               Simple Tests
#------------------------------------------------------------------------------

# Test if rma is a file and executable
[ -x "$DAEMON" ] || exit 0
# Include rma defaults if available
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

. /lib/init/vars.sh

. /lib/lsb/init-functions

#------------------------------------------------------------------------------
#                               Functions
#------------------------------------------------------------------------------

setFilePerms(){

        if [ -f $PIDSPATH/$PIDFILE ]; then
                chmod 400 $PIDSPATH/$PIDFILE
        fi
}

isRunning() {
        if [ $1 ]; then
                pidof_daemon $1
                PID=$?

                if [ $PID -gt 0 ]; then
                        return 1
                else
                        return 0
                fi
        else
                pidof_daemon
                PID=$?

                if [ $PID -gt 0 ]; then
                        return 1
                else
                        return 0
                fi
        fi
}

wait_for_pid () {
        try=0

        while test $try -lt 35 ; do

                case "$1" in
                        'created')
                        if [ -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;

                        'removed')
                        if [ ! -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;
                esac

                echo -n .
                try=`expr $try + 1`
                sleep 1
        done
}

status(){
        isRunning
        isAlive=$?

        if [ "${isAlive}" -eq $TRUE ]; then
                echo "$DESCRIPTION found running with processes:  `pidof $NAME`"
        else
                echo "$DESCRIPTION is NOT running."
        fi
}

removePIDFile(){
        if [ $1 ]; then
                if [ -f $1 ]; then
                        rm -f $1
                fi
        else
                #Do default removal
                if [ -f $PIDSPATH/$PIDFILE ]; then
                        rm -f $PIDSPATH/$PIDFILE
                fi
        fi
}


start() {
        log_daemon_msg "Starting $DESCRIPTION"

        isRunning
        isAlive=$?

        if [ "${isAlive}" -eq $TRUE ]; then
                log_end_msg $SCRIPT_ERROR
        else
                start-stop-daemon --start --verbose --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON -- $DAEMON_ARGS
                                pidof $NAME >$PIDSPATH/$PIDFILE
                                setFilePerms
                log_end_msg $SCRIPT_OK
        fi
}

stop() {
        log_daemon_msg "Stopping $DESCRIPTION"

        isRunning
        isAlive=$?
        if [ "${isAlive}" -eq $TRUE ]; then
                start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE

#               wait_for_pid 'removed' $PIDSPATH/$PIDFILE

#                if [ -n "$try" ] ; then
#                        log_end_msg $SCRIPT_ERROR
#                else
                        removePIDFile
                        log_end_msg $SCRIPT_OK
#                fi

        else
                log_end_msg $SCRIPT_ERROR
        fi
}

reload() {

        log_daemon_msg "Reloading (via HUP) $DESCRIPTION"

        isRunning
        if [ $? -eq $TRUE ]; then
                kill -HUP `cat $PIDSPATH/$PIDFILE`
                log_end_msg $SCRIPT_OK
        else
                log_end_msg $SCRIPT_ERROR
        fi
}

destroy() {
        log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION"
        killall $NAME -q >> /dev/null 2>&1
        log_end_msg $SCRIPT_OK
}

pidof_daemon() {
    PIDS=`pidof $NAME`

    [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE`

    for i in $PIDS; do
        if [ "$i" = "$PIDS2" ]; then
            return 1
        fi
    done
    return 0
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 1
        start
        ;;
  reload)
        $1
        ;;
  status)
        status
        ;;
  destroy)
        $1
        ;;
  *)
        echo "Usage: service $NAME {start|stop|restart|reload|destroy}"
        echo "       The 'destroy' command should only be used as a last resort."
        exit 1
        ;;
esac

exit 0
Make the script executable

Code: Select all

sudo chmod +x /etc/init.d/rma
Add the script to the boot sequence

Code: Select all

sudo update-rc.d rma defaults
Start installed agent

Code: Select all

sudo service rma start
gulbahar
Posts: 2
Joined: Thu Apr 24, 2014 6:51 am

Exec error

Post by gulbahar »

Hi.

I said the same applies but I am getting error.

Error :

*Starting Host Monitor RMA
Starting /usr/bin/rma...
Start-stop-deamon: unable to start /usr/bin/rma (exec format error)


Please help me
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Have you tried to start RMA agent manually?
Coud you try to download and extract RMA files manually.

Please check for details at:
http://www.ks-soft.net/hostmon.eng/rma- ... .htm#start
gulbahar
Posts: 2
Joined: Thu Apr 24, 2014 6:51 am

RMA start error

Post by gulbahar »

Hi,

I already use manually but agent give me same error.
I already insttall and extract RMA files manually.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

What command line have you used to start RMA?
What exactly error message have you got?
If you are using 32-bit OS, could you try 32-bit RMA:
http://www.hostmonitor.biz/download/rma ... in_x86.tgz
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

This error can be caused by incompatible CPU architecture.
What CPU is installed on your system?
eddymicro
Posts: 95
Joined: Wed Nov 13, 2002 6:00 pm

Password Error

Post by eddymicro »

Alex

I have been trying to install the agent, I followed these directions and I get a password error, I did create a new password and put it in the rma.ini file

-------------------------------------------------------------
Application: RMA (Remote Monitoring Agent for HostMonitor)
Version: 1.29 for Linux (Red Hat, Mandrake, SuSE)
Copyright: 2004 - 2010 Alexander Kozlov
web: http://www.ks-soft.net
e-mail: support@ks-soft.net
-------------------------------------------------------------
Command line checking .. Ok
Settings checking .. Error
Password is not specified!
Full path to the agent is not specified!

Please check '/usr/local/etc/rma/rma.ini' file

kiosk@nuc-01-0001 ~ $
eddymicro
Posts: 95
Joined: Wed Nov 13, 2002 6:00 pm

Password Error is fixed

Post by eddymicro »

Alex,

I figured it out and the agent is running. But I cannot get most of the tests to work. I get an error on the CPU test: Error 301 cannot get script results.
eddymicro
Posts: 95
Joined: Wed Nov 13, 2002 6:00 pm

Errors for Process Test

Post by eddymicro »

Alex,

Both errors are probably related. On the process test I get this error:RMA 301 ProcCnt script doesn't exist
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

rma folder should contain the following .sh files:
proccnt.sh
proclist.sh
cpu.sh
All these files should have executive permission.
eddymicro
Posts: 95
Joined: Wed Nov 13, 2002 6:00 pm

Execute Permissions

Post by eddymicro »

Alex,

I added execute and restarted the RMA.Now I get the follwwing error: RMA 301: Cannot get script results
eddymicro
Posts: 95
Joined: Wed Nov 13, 2002 6:00 pm

Now Working

Post by eddymicro »

Alex,

When I started the RMA as a service, It works.
We could really use more features for Linux !
Are you considering adding more tests to the Linux RMA?

We use Ubuntu and Mint (this version appears to work on both Mint and Ubuntu) :) :)
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

What exactly fuatures do you need?

Regards
Alex
Post Reply