Agent Installation from Source

For customers who are not running Red Hat or Ubuntu-based Linux distributions, we offer a source install option. There are two options available, a scripted install and a manual install. An update script is also available for users to update their source installs easily.

You must ensure that bash, curl, and python 2.7 are available on the system for scripted installs. Python 2.7 is required for all source installs. 

Sysstat should also be installed if possible as this will allow the agent to gather extra metrics.

Scripted Installation

Create an API token

  1. Log in to your Server Density account.
  2. Click your name in the top left, then click Preferences.
  3. Go to the Security tab then in the bottom right, enter a name for the API application you're building so you can easily recognise it in the future e.g. "".
  4. Press Enter and your API token will be shown as a 32 character ID.

Execute the script

Download the installer script and then execute with your account name, the API token you created above and, optionally, a group name to create the device in: 

curl | sudo bash -s -- -a ACCOUNT -t API_TOKEN

If you have already created the device in Server Density, you can pass the agent key without the API token:

curl | sudo bash -s -- -a ACCOUNT -k AGENT_KEY

Executing the script will start the installation and you will not be prompted further. The agent will be installed to $HOME/.sd-agent of the user executing the script which will be root as the script requires sudo, however, this location can be changed by setting the required location with the -l option, like in the following example which will install the agent at /etc/sd-agent: 

curl | sudo bash -s -- -a ACCOUNT -k AGENT_KEY -l /etc/sd-agent

Optional arguments can be passed to group the device, assign a tag, or create a device with the relevant provider information for cloud provider sync.

 -g: Group to add the new device into.
 -T: Tag this device - multiple tags not supported.
 -p: Hosting provider (e.g. amazon)
 -i: Provider ID (requires provider). Cloud device ID (instance ID for EC2 devices)
 -A: Automatically get the Amazon Web Services instance ID and provider
 -G: Automatically get the Google Cloud instance ID and provider 
-l: Set the install location

Manual Installation

Check for the latest release and define release version 

Navigate to the sd-agent Github repo to find out the latest release (eg: 2.2.0). Then update the line below to reflect the latest release number. 

export AGENT_VER="2.2.X"

Navigate to the sd-agent-core-plugins Github repo to find out the latest release (eg: 2.2.0). Then update the line below to reflect the latest release number. 

export PLUGIN_VER="2.2.X"

Define a location for the agent and logs

export SD_HOME="$HOME/.sd-agent"
sudo mkdir $SD_HOME
sudo mkdir /var/log/sd-agent

Download and install the agent virtual environment

sudo curl -k -L -o $SD_HOME/
sudo python $SD_HOME/ --no-pip --no-setuptools $SD_HOME/venv
sudo rm -f "$SD_HOME/" sudo rm -f "$SD_HOME/virtualenv.pyc"

Activate the virtual environment

source "$SD_HOME/venv/bin/activate"

Set virtual environment commands

export VENV_PYTHON_CMD="$SD_HOME/venv/bin/python"
export VENV_PIP_CMD="$SD_HOME/venv/bin/pip"

Install ez_setup in the virtual environment

sudo curl -k -L -o $SD_HOME/ 
sudo $VENV_PYTHON_CMD $SD_HOME/ --version="20.9.0"
sudo rm -f "$SD_HOME/"
sudo rm -f "$SD_HOME/ez_setup.pyc"

Install pip in the virtual environment

sudo curl -k -L -o $SD_HOME/
sudo $VENV_PIP_CMD install "pip==8.1.1"
sudo rm -f "$SD_HOME/"
sudo rm -f "$SD_HOME/get-pip.pyc"

Install virtual environment requirements

sudo curl -k -L -o $SD_HOME/requirements.txt
sudo $VENV_PIP_CMD install -r "$SD_HOME/requirements.txt"
sudo rm -f "$SD_HOME/requirements.txt"

Download agent

sudo mkdir -p $SD_HOME/agent
sudo curl -k -L -o $SD_HOME/agent.tar.gz$AGENT_VER
sudo tar -xz -C $SD_HOME/agent --strip-components 1 -f $SD_HOME/agent.tar.gz
sudo rm -rf $SD_HOME/agent.tar.gz

Install optional requirements

sudo $VENV_PIP_CMD install -r $SD_HOME/agent/requirements-opt.txt

Configure the agent

sudo mv $SD_HOME/agent/config.cfg.example $SD_HOME/agent/config.cfg
sudo nano $SD_HOME/agent/config.cfg 

With your favourite text editor add your account name and agent_key to sd_account and agent_key respectively.

Copy init scripts

sudo mkdir -p "$SD_HOME/bin"
sudo cp "$SD_HOME/agent/packaging/source/agent" "$SD_HOME/bin/agent"
sudo chmod +x "$SD_HOME/bin/agent"

Setup supervisord

sudo $VENV_PIP_CMD install "supervisor==3.1.3"
sudo curl -k -L -o $SD_HOME/agent/supervisor.conf
sudo mkdir -p $SD_HOME/run

Plugin Installation

Download & install plugins

sudo curl -k -L -o "$SD_HOME/plugins.tar.gz" "$PLUGIN_VER"
sudo mkdir -p "$SD_HOME/agent/checks.d/"
sudo mkdir -p "$SD_HOME/plugins"
tar -xz -C "$SD_HOME"/plugins --strip-components 1 -f "$SD_HOME"/plugins.tar.gz
for d in `ls $SD_HOME/plugins/*/`; do
    sudo cp $d "$SD_HOME/agent/checks.d/$"

for d in `ls $SD_HOME/plugins/*/conf.yaml.example`; do
    sudo cp $d "$SD_HOME/agent/conf.d/$name.yaml.example"

for d in `ls $SD_HOME/plugins/*/conf.yaml.default`; do
    sudo cp $d "$SD_HOME/agent/conf.d/$name.yaml.default"

Install plugin requirements

for d in `ls $SD_HOME/plugins/*/requirements.txt`; do
    $VENV_PIP_CMD install -r "$d"

Delete old archive and folder

rm -f "$SD_HOME"/plugins.tar.gz
rm -rf "$SD_HOME"/plugins 

In order to use a plugin you simply need to configure it per its relevant document.

Daemonize the agent

If you want the agent to run in the background you need to daemonize the agent.


For Linux distributions using init.d, follow these instructions.


For FreeBSD systems using rc.d, follow these instructions.

Update Script

You can use our update script to update your source install:

curl | sudo bash -s -- -l /agent/install/location 

The -l option is not required. If it is not given the script will use the default location of $HOME/.sd-agent

Test the agent

supervisord -c $SD_HOME/agent/supervisor.conf

Check your metrics

Login to your account and check your new device is receiving metrics.

Start the agent

bin/agent start
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.