Imported on Apr 8, 2009
I was reading a 37signals case study about one of their products and the company they mentioned was Server Density. I have been looking for a way to monitor my server resources and be notified when something has gone wrong or is about to go wrong.
This is what Server Density is trying to accomplish. They want you to be notified before something goes wrong, not after. So I wanted to show you how quick and easy it was to setup my server with Server Density. I’m going to skip their signup process since it’s extremely easy and you are guided on what to do.
First thing you need to do is SSH into your server and execute the following lines separately:
wget http://www.serverdensity.com/downloads/sd-agent.tar.gz
tar xvfz sd-agent.tar.gz
nano -w sd-agent/config.cfg
If you don’t have nano on your machine you can use VIM which is just “vi” instead of “nano”. Or you can quickly install it with the following command:
yum install nano
So now which ever editor you have chosen, you should see something like this:
[Main]
sd_url: http://example.serverdensity.com
agent_key:
apache_status_url: http://example.com/server-status/?auto
Edit the info that is presented to you when add a new server with Server Density if you’re using vi, press “i” first to insert text and replace what’s necessary. If you using nano, just type away and replace what’s necessary. You should edit up with something like this:
[Main]
sd_url: http://example.serverdensity.com
agent_key: 5555555cc5c555c5c5ccccc5555555c5
apache_status_url: http://127.0.0.1/server-status/?auto
The “apache_status_url: should be your servers public IP address. After you’re done editing, in nano just press control x and press “y” and enter to save. In vi press “:” and type “wq” enter and that will save your file.
At this point, you are setup for the basics of Server Density, but if you want to get reports from apache on server requests, and workers, etc. You need to setup server status in your apache conf file. So let’s go ahead and open our httpd.conf file (you may need to be sudo/root - It will open without sudo, but you won’t be able to save.):
nano /etc/httpd/conf/httpd.conf
So now we have to look for this line
#ExtendedStatus On
By default this is turned off or in this case commented out. Now we have to add a few lines:
ExtendedStatus On
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 70.70.80.80
So what this is doing is setting up our server-status to be viewable by Server Density. The first IP address is our localhost and the second one is our servers public IP address. Now if you want to see this info for yourself, you’ll have to add your external IP address to the list. You can obtain your external IP address by going to IP Monkey. Just copy the IP and added it to the list, just put a space between the IP addresses.
Now restart apache:
/etc/init.d/httpd restart
So now we can test and make sure server-status is working by going to http://70.70.80.80/server-status Just make sure you use what we setup in the config file.
We’re almost done, all we have to do is go to our sd-agent directory in our user folder (which we should still be there) So just go into that directory:
cd ~/sd-agent/
Now we just have to make sure we are running, so now execute:
python agent.py start
You should see the agent start. Now we’re all done! Go back to your Server Density site, login and check it out. You should see updates about every 60 seconds.
originally posted on Stephen Korecky
Loading comments...