Automatic agent installation - GCE

If you wish to monitor your GCE instances you can have the agent installed and the device added to your Server Density account automatically upon instance creation. 

Please note that this does not sync your GCE instances into your Server Density account. We recommend that you also use our Cloud Sync feature to ensure you GCE account is always in sync

This works by providing a startup script when creating your instance. Within this startup script we define a simple bash script that in turn executes our installer script. This allows the agent to be installed on the initial boot of the OS. 

GCE Console

When you create an instance via the GCE Console you have the option to add a statup script in the 'Automation' section of the instance creation wizard. Click 'Management, disk, networking, SSH keys' to reveal the Automation option. Then simply copy in the following replacing the values of $SD_ACCOUNT and $SD_API_TOKEN as required (note that as the -G option is specified the script will automatically attempt to pull your instance ID and provide it to ServerDensity on device creation):

#!/bin/bash
curl http://archive.serverdensity.com/agent-install.sh | \
bash -s -- -a $SD_ACCOUNT -t $SD_API_TOKEN -G

An example screenshot is below:

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Dejan Stojanovic

    This will work fine in case of scaling up, but in case of scaling-down when machine is destroyed by autoscaler I do not think it will be gone from SD.

    Is there a way to remove machine from SD in shutdown-script?
    I believe shutdown should be also handled

Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.