Upgrading the agent version cannot be completed by using the update function of your package manager. Instead it requires a few extra steps to ensure that the process completes without issue, which are detailed below.
Manual Upgrade
Stop the v1 Agent
/etc/init.d/sd-agent stop
Backup v1 Config File
cp /etc/sd-agent/config.cfg ~/config.cfg
Uninstall v1 Agent
For CentOS / RHEL
yum remove sd-agent
For Debian / Ubuntu
apt-get remove sd-agent
Replace Old Repositories - CentOS / RHEL
For CentOS / RHEL
cat - > /etc/yum.repos.d/serverdensity.repo << 'EOF' [serverdensity] name=Server Density Repository for Enterprise Linux $releasever - $basearch baseurl=http://archive.serverdensity.com/el/$releasever enabled=1 gpgcheck=0 EOF
For CentOS / RHEL 5, you also need to ensure that the epel repository is installed
yum install epel-release
Replace Old Repositories - Debian / Ubuntu
Debian 7 - Wheezy
echo "deb https://archive.serverdensity.com/debian/ wheezy main" | sudo tee /etc/apt/sources.list.d/sd-agent.list
Debian 8 - Jessie
echo "deb https://archive.serverdensity.com/debian/ jessie main" | sudo tee /etc/apt/sources.list.d/sd-agent.list
Debian 9 - Stretch
echo "deb https://archive.serverdensity.com/debian/ stretch main" | sudo tee /etc/apt/sources.list.d/sd-agent.list
Ubuntu 12.04 - Precise
echo "deb https://archive.serverdensity.com/ubuntu/ all main" | sudo tee /etc/apt/sources.list.d/sd-agent.list
Ubuntu 14.04 - Trusty
echo "deb https://archive.serverdensity.com/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/sd-agent.list
Ubuntu 16.04 - Xenial
echo "deb https://archive.serverdensity.com/ubuntu/ xenial main" | sudo tee /etc/apt/sources.list.d/sd-agent.list
Install v2 Agent
For CentOS / RHEL
yum install sd-agent
For Debian / Ubuntu
apt-get update apt-get install sd-agent
Install Required Official Plugins
If you're monitoring Apache, Nginx, MongoDB, MySQL or RabbitMQ install the relevant package(s) that you require now.
For CentOS / RHEL
yum install sd-agent-apache yum install sd-agent-nginx yum install sd-agent-mongo yum install sd-agent-mysql yum install sd-agent-rabbitmq
For Debian / Ubuntu
apt-get install sd-agent-apache apt-get install sd-agent-nginx apt-get install sd-agent-mongo apt-get install sd-agent-mysql apt-get install sd-agent-rabbitmq
Update v2 Config
Find your agent key from your old config file, or from the device page in your Server Density account.
grep agent_key ~/config.cfg
Edit your v2 agent and add your agent key to the agent_key config variable. Also add your Server Density account name to the sd_account config variable, similar to below.
nano /etc/sd-agent/config.cfg
[Main] sd_account: example agent_key: 1234567890abcdef1234567890abcdef
Your Server Density account is the subdomain you use to login. For example, if you use https://example.serverdensity.io then your Server Density account is example
Update Official Plugin Configs
Edit the official plugin configurations to reflect your requirements. These are located in /etc/sd-agent/conf.d/ and have the default name of service.yaml.example. In order to use these you need to change the file name and ensure all configuration variables in the file is correctly set.
mv /etc/sd-agent/conf.d/apache.yaml.example /etc/sd-agent/conf.d/apache.yaml nano /etc/sd-agent/conf.d/apache.yaml
Thanks for pointing this out Scott, we've updated the article!
Under the 'replace old repositories' section, the first line of that command should be:
cat - > /etc/yum.repos.d/serverdensity.repo << 'EOF'
The quotations around the first EOF are required otherwise the $releasever variables will be interpreted and typically insert blank values, causing yum installs to fail.