Automatic agent installation - Digital Ocean

If you wish to monitor your Digital Ocean droplets you can have the agent installed and the device added to your Server Density account automatically upon droplet creation. 

This works by adding 'user_data' to your droplet creation request. Within this user_data we define a cloud-config that takes advantage of the 'runcmd' variable to allow us to run a command on the initial boot of the OS. There's two methods to complete this, both require your Server Density account name and a Server Density API token: 

Digital Ocean API

If you have a Digital Ocean API key you can use this to create droplets from the command line with a simple curl request.

Simply issue the following request, replacing the values of $SD_ACCOUNT, $SD_API_TOKEN and $DO_API_KEY as required:

curl -X POST "" \
    "name": "test", 
    "private_networking": false,
    "region": "nyc3",
    "size": "512mb",
    "image": "ubuntu-14-04-x64",
      - curl | bash -s -- -a $SD_ACCOUNT -t $SD_API_KEY
}' \
    -H "Authorization: Bearer $DO_API_KEY" \
    -H "Content-Type: application/json" 

Remember that you should also change the other values to get the droplet configuration you require.

Digital Ocean User Interface

When you create Droplet via the User Interface you have the option to 'Select additional options' one of which is user data. Click the check box to enable the option and present a text area. Simply copy in the following, replacing the values of $SD_ACCOUNT and $SD_API_TOKEN as required:

  - curl | bash -s -- -a $SD_ACCOUNT -t $SD_API_KEY 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.