Auto Deployment
If you need to install the agent onto several servers or run an automated environment, there are a couple of ways you can mass deploy the agent. Using our automated script will help with multiple installs whereas our auto-copy using the same agent key will help with automated deployments.
Auto-copy using the same agent key
If you are using something like Amazon EC2, you specify a standardised machine image which is used as the base for all your virtual machine instances. Instead of having to manually configure the agent for each server, you can use the same config file with the same agent key for every server and Server Density will detect the different machines, automatically copying the settings from the original server to a new one. This includes any configured alerts for that server.
See Cloud Deployment for more details (applicable even if you're not using the so-called cloud).
Using our automated script
We have an automatic deployment script which will automatically install the agent and add the new server into your account. All you need to do is run the script and then launch the agent on each server.
1. Download
The script is bundled with the agent package but is also available as a separate download.
wget http://www.serverdensity.com/downloads/sd-deploy.tar.gz
2. Extract
Once downloaded, you need to extract the agent files. They will be extracted to the current directory:
tar xvfz sd-deploy.tar.gz
3. Execute
The script is written in Python and can be executed using the following command line:
python sd-deploy.py [API URL] [SD URL] [username] [password] [[init]]
Arguments
[API URL]- The URL to the API endpoint. For hosted Server Density users this will behttp://api.serverdensity.com.[SD URL]- The URL to your Server Density account. For hosted Server Density users this will beexample.serverdensity.comwhereexampleis your account subdomain.[username]- The username of a Server Density user with API access (see below).[password]- The password of a Server Density user with API access (see below).[[init]](optional) - If this is specified, the deploy script will also install the init.d startup scripts. The deploy script must be run as root for this option to work.
Example usage
To install without the init.d scripts:
python sd-deploy.py http://api.serverdensity.com example.serverdensity.com ausername apassword
Or to install with the init.d scripts:
python sd-deploy.py http://api.serverdensity.com example.serverdensity.com ausername apassword init
API User
The deploy script uses the Server Density API to add the new server and so you must specify the login details of a user with API access. To enable API access:
- Log into your Server Density account as an admin user.
- Click the Users tab.
- Click Edit next to the user you wish to enable API access for.
- Tick the API enabled? box and click Edit.
- This user now has access to the API using their username and password.
4. Launch
All that is left to do is launch the newly installed agent.
If you did not install the init.d scripts
python /path/to/sd-agent/agent.py start
If you did install the init.d scripts
/etc/init.d/sd-agent start