29 Jul 2021 08:35 PM - last edited on 03 Aug 2021 08:57 AM by MaciejNeumann
We have a situation where there are 2 new linux servers added to a server farm. We would like to install One Agent on the new hosts and skip the installation on the hosts where Dynatrace exists already.
Looking for the best solution for installation of One Agent on the new hosts and skip the existing linux hosts where the One Agent already exists.
29 Jul 2021 09:15 PM
It sounds like you are referring to an automated method of install - what is your usual method of installing the OneAgent? My initial thought is to write a check to see if OneAgent service is already running on a host, and if not then install. Or, have a list of all Linux hosts that have OneAgent installed, and if host is not in that list then install OneAgent. I am just spitballing here though, interested to hear more about your current instrumentation method.
29 Jul 2021 10:22 PM
Yes, we are using Octopus to perform automated deployments of One Agent to the environments. We currently use this script which performs an uninstall on hosts where One Agent exists. We believe a better method would be to skip hosts where the agent is installed and install on the hosts which were added for additional capacity.
uninstall=$(get_octopusvariable "Uninstall")
If [ $Uninstall -eq "1" ]
then
if [ -f "/opt/dynatrace/oneagent/agent/uninstall.sh" ]
then
cd "/opt/dynatrace/oneagent/agent"
echo "Removing Dynatrace agent"
sudo chmod 777 uninstall.sh
sudo ./uninstall.sh
else
echo "Dynatrace agent uninstallation not found"
fi
else
echo "Set Uninstall to False"
fi
29 Jul 2021 10:54 PM
Okay, I would think that there may be a way to script out the options I have listed above then. If this is a script that would be run on every server, then I would edit the script to have it check to see if Dynatrace OneAgent files exist, and if they do not, then install the OneAgent. I am not as familiar with Octopus scripting, but it may logically be something like this:
if [ -f "/opt/dynatrace/oneagent/agent/uninstall.sh" ]
then
echo "Dynatrace OneAgent already installed."
else
echo "Dynatrace agent uninstallation not found"
{Insert Linux OneAgent install script}
fi
29 Jul 2021 11:04 PM
Logically it would be similar to what you mentioned.
1. Check if One Agent present.
2. If present (skip host)
3. else Perform One Agent install.
4. Exit script
Do you know the best method to skip the install if agent prresent and install if agent does not exist?
30 Jul 2021 01:41 PM
The method of checking for the uninstall.sh script would still work, as if that script isn't there you may want to reinstall anyways. 🙂 Otherwise, there is an 'installer.version' file that you could check is present within dynatrace/oneagent/agent directory.