Agent installation
The agent is designed to be as simple as possible to install so if you come across any problems, we want to know.
Instructions
Agent instructions link
When you add a new server, the instructions for installing the agent will be displayed. You can access this page again by clicking the Agent link in the options on the server list table from the Servers tab in the Server Density interface. This is important because it shows the configuration details for that specific server.
1. Download
The agent must be installed onto the server you wish to monitor, but it can be installed as any regular user - it does not need root privileges. As such, you need to log into your server via SSH as the user you wish to install/run the agent under.
Once logged in, you need to download the agent package using a command such as wget:
wget http://www.serverdensity.com/downloads/sd-agent.tar.gz
2. Extract
Once downloaded, you need to extract the agent files. They will be extracted to the current directory and create an sd-agent directory:
tar xvfz sd-agent.tar.gz
3. Configure
Agent configuration table
Within the sd-agent directory that has been created, you need to edit the config.cfg file. This is where you need the configuration details as displayed on the agent installation instructions for your server inside Server Density (Agent link from the list table on the Servers tab).
An editor such as nano will suffice for this:
nano -w sd-agent/config.cfg
Options
sd_url- Your Server Density URL e.g. example.serverdensity.com. You can usehttporhttps(SSL encrypted).agent_key- A key to uniquely identify this server generated by the system.apache_status_url(optional) - See the Apache status documentation for details. If you do not wish to monitor Apache then leave this as its default value.mysql_server:(optional) - See the MySQL status documentation for details. If you do not wish to monitor MySQL then leave this as its default value.mysql_user:(optional) - as abovemysql_pass:(optional) - as abovenginx_status_url(optional) - See the Nginx status documentation for details. If you do not wish to monitor Nginx then leave this as its default value.
Having entered the basic details from the config table, you will have a config.cfg file that looks like this:
[Main] sd_url: https://example.serverdensity.com agent_key: fd103d1018c3e7c26b52aab1f44d704c apache_status_url: http://www.example.com/server-status/?auto mysql_server: mysql_user: mysql_pass: nginx_status_url: http://www.example.com/nginx_status report_anon_stats: yes
report_anon_stats
We will soon start collecting anonymised statistics about your server to use for development and reporting purposes. This includes the Python version, OS type and version and the agent version. Set this to no if you do not wish us to collect this data.
4. Start
Change the current directory to the sd-agent directory and then issue the start command. The agent runs as a daemon so you can then close the SSH session and the agent will continue to run.
cd sd-agent/ python agent.py start
Data will start to show up in the interface within 60 seconds.
Daemon control
The agent daemon works like any other *nix daemon in that it will accept the commands start, stop and restart. Just remember you need to execute it using Python from within the directory the files are in. You can confirm it is running by the existence of the PID file at /tmp/sd-agent.pid.
python agent.py start|stop|restart|status|update
Linux startup
By default the monitoring agent will not start on boot. We provide a Linux startup script that can be quickly installed to allow the agent to be automatically started on boot. Follow the instructions here to install this script.
Note The usual PID file location /tmp/sd-agent.pid changes when using the init.d script to /var/run/sd-agent.pid.
Ports and firewalls
The agent will need to be able to communicate with our servers. Data is only sent one way - from your server to our servers - over standard HTTP port 80.
For added security, you can set the agent to use SSL by entering https as part of the sd_url in the agent config.cfg file. If you do this, port 443 must be open on your firewall.