v1 to v2 agent upgrade

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. We've provided a script to automate this process, ensuring a smooth transition. Alternatively you can use the manual upgrade steps below.

Scripted Upgrade

Use of the upgrade script requires that the sd-agent be installed in /etc/sd-agent/ by your systems package manager. 

How to Use

Download our upgrade script, make it executable and execute the script. 

curl -LOk https://archive.serverdensity.com/agent-upgrade.sh
chmod +x agent-upgrade.sh
./agent-upgrade.sh

Check the version reported in the UI to ensure that the upgrade was successful.

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 

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
failovermethod=priority
enabled=1
gpgcheck=0
EOF

For CentOS / RHEL 5, you also need to ensure that the epel repository is installed

yum install epel-release

For Debian / Ubuntu

echo deb http://archive.serverdensity.com/ubuntu/ all main > /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
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Scott Nicol

    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.

  • Avatar
    Steve Hurley

    Thanks for pointing this out Scott, we've updated the article!

Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.