cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Machine Agent not working after Server reboot

Sachin.Patil
Creator

Hello Team,

 

After the server reboots the machine agent is not working. It's not collecting metrics. The app agent is collecting data. We are using linux system.

 

Also let me know below points.

  1. How we can check the status of an machine agent?
  2. How we can start and stop the machine agent?

 

Regards,

Sachin Patil. 

2 REPLIES 2

Ken.Inman
Builder

You need to create a startup script.  If you're using SysV, you'd just need to create a script in /etc/init.d, and then create a link to that in /etc/rc3.d, starting with a capital 'S', and following with a number, following the standard (the 'S' scrips are executed in order, starting with the lower numbers first).  Here's the startup script we use.  I believe we got this from AppDynamics directly, but it's been a long while, so it's possible we created it and I just forgot. :-) . Sorry for the formatting.. Couldn't get cut and paste to work well. 

 

#!/bin/bash
# chkconfig: - 85 15
# description: Start and stop AppD Machine Agent
# Source function library.
. /etc/rc.d/init.d/functions

APP_DYN_DIR=/opt/appdynamics
APP_DYN_PID=`ps -ef | grep machineagent.jar | grep -v grep | awk ' { print $2 } '`
start () {

/opt/appdynamics/machineagent/bin/machine-agent -d -p /var/run/agent.pid -j        /opt/appdynamics/machineagent/jre

}

 

stop () {
if [ $APP_DYN_PID ]; then
kill -9 $APP_DYN_PID
fi
}

status () {
if [ ! -d $APP_DYN_DIR ]; then
echo Appdynamics is not installed
exit 0
fi
if [ $APP_DYN_PID ]; then
echo Appdynamics pid $APP_DYN_PID is running
else
echo Appdynamics is not running
fi
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL


 

Put that script in /etc/init.d, make sure it's executable by the root user like so:

-rwxr-xr-x. 1 root root 1521 Jun 3 2019 /etc/init.d/appdynamics

 

Then, create a sym link to that file in /etc/rc3.d:

 /etc/rc3.d/S85appdynamics -> ../init.d/appdynamics

 

If you run chkconfig commands ( chkconfig --add appdynamics, chkconfig --on appdynamics, etc) as well, but I prefer to create the links manually so I can control the startup level.  Make sure it starts up after your network services so DNS is up and running before the machine agent attempts to connect to the controller, unless you have a hosts entry for that. 

 

You can validate that it's working by running the standard service commands as well:

sudo service appdynamics status 

 

This will also work with SystemD, though I don't have a sample script as we don't use SystemD on our Linux servers here. 

 

Try that, and let me know if you have any other questions on this,

~Ken

Hello Ken,

 

Thanks for your responce,We will try your scripts in test env later but for now we try the below command and its working fine as expected.

 

Go to Path cd /opt/SP/data/appdynamics/machine-agent      and

run the command -->     nohup ./jre/bin/java –jar machineagent.jar &

 

We will try your method in test env and let you know the result later.

 

Regards,

Sachin P