Resolving IP Address Mismatch Issue in Autoscaling Groups: A Guide for Monitoring Tool Agents Example Appdynamics

Saket Jain
2 min readJan 4, 2023

This blog is applicable for all monitoring tool agents installed on machines, such as AppDynamics, Telegraf, New Relic, etc.

Taking AppDynamics as an example,

In our case, we had previously hardcoded the IP address in the controller-info.xml file. However, when autoscaling starts, a new machine is launched and the old one is terminated, resulting in a different IP address for the new machine. This prevents the new machine’s data from being displayed in AppDynamics. To resolve this issue, follow these steps…

STEP 1

#!/bin/bash
#Create a file
touch /root/appd_nodename.sh

#paste the below content this will update the current Ip of the machine on the provided config file in this example it's controller-info.xml
HOST_IP=$(hostname -I | awk '{print $1}')
sed -i "s/hostname = .*/hostname = \"$HOST_IP\"/" /app/appd/ver22.1.0.33445/conf/controller-info.xml

STEP 2

crontab -e

paste the below content
@reboot /root/appd_nodename.sh

STEP 3

#Validate the cron jobs get created
crontab -l

Now, you can create an Amazon Machine Image (AMI) from the instance, update the launch template, and refresh the autoscaling group. This will ensure that the new instances launched by the autoscaling group will have the correct configuration, including the updated launch template, and the issue related to the IP address mismatch can be resolved.

--

--