Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an instance running on Amazon EC2 that I turned into a webserver.

Now I have been looking at cloudwatch, but I do not know if it is the correct tool for the job. Basically I want to get informed when the server is down, for whatever reason.

Maybe the server got hacked, or the server shut down for whatever reason, I want to get a notification on that.

I have enabled clouwatch, and tried to set up a alert, but I only see things like network in-out or cpu usage, an d metrix. Now I do not know if these will do the trick.

share|improve this question
1  
checkout cloudkick. i know we arent supposed to spread opinion, but cloudkick is my favorite monitoring solution. pingdom is pretty useless as your site can be pingable (apache/nginx) but your proxied too php/java/ruby proccesses may be not functioning. hitting a actual URL with cloudkick every 3 minutes and checking for presence of text you specify, or for 2xx success, is much more useful and ensures the whole stack is working. i have monitors setup for loadaverage, mem usage, agent connection (server offline or connection dropped), http 2xx success on pages, etc. –  iainlbc Dec 16 '11 at 3:05
    
You made a good point here. If only php is down you will still get a 200 response. The link you provided is a good alternative. I will have a look at it when I make my final decision. –  Saif Bechan Dec 16 '11 at 6:22
    
@iainlbc You can set Pingdom to hit an actual URL and check for specific text. –  ceejayoz Nov 20 '12 at 2:00
add comment

3 Answers 3

up vote 7 down vote accepted

One recommendation is to monitor a metric that should always have a numeric value - such as CPU usage, and trigger an alarm when the metric state is 'insufficient data' you can use Amazon's SNS to notify you of this.

Alternatively, you can setup custom metrics which return a binary state for specific services (httpd, mysql, etc) and generate an alert any time any of these reads 0. This approach offers the possibility of much finer detail - combine it with 'insufficient data' to cover all cases.

You may be more successful using something that actually monitors your site (e.g. Pingdom, UptimeRobot, etc).

share|improve this answer
    
I have looked at the services like pingdom, and I will certainly enable them. Further, I was also thinking of looking at the cpu, but I thought what would happen when just the webserver is hacked. Having a test for httpd, mysql etc would certainly help. Can you maybe give me a hint on how to enable this binary state metric. –  Saif Bechan Dec 16 '11 at 2:55
    
Briefly: determine a way to get the status of the service of interest (e.g. ps|grep for the pid/name; check for a port in use, etc) - i.e. a watchdog script. Modify such a script to call the Cloudwatch API (PutMetricData) passing it either a 0 (for down) or a 1 (for up) - it would be best to use one of the SDKs that exist for this purpose (e.g. Ruby, PHP, etc); the command line version mon-put-data is slower. Run it all with cron. –  cyberx86 Dec 16 '11 at 3:23
    
Ok that sounds a little complicated. I think a service like uptimerobot would be a better choice for me personal. Thanks for all the help. –  Saif Bechan Dec 16 '11 at 6:21
add comment

You can use OpsGenie (http://www.opsgenie.com) to send rich alert for CloudWatch. Currenly CloudWatch has a limited set of alerting mechanism including Email and SMS via its SNS mechanism.

You can configure CloudWatch to call OpsGenie web services API, get the right people notified rapidly via push notifications to iPhone/Android apps, SMS, voice calls, etc. according to the preferences of the recipients.

Please take a look at following blog post for detailed information:

http://www.opsgenie.com/blog/2012/09/04/aws-cloudwatch-alarms-on-your-mobile-with-opsgenie.html

share|improve this answer
add comment

You can create an Alarm in Cloudwatch and set the alarm to notify you when it goes into "Insufficient Data" state. Most of the already available metrics are from the VM Host, which doesn't have any real idea about what's happening inside your machine.

At a start, I'd recommend installing the Amazon tools in your instance and set up a script to report something, (Anything: CPU usage, whatever) and alarm if that metric stops sending data (So the metric goes into the Insufficient Data state).

This is only a bare minimum, but should be a good place to start.

See the monitoring scripts section of Cloudwatch developer guide: http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/mon-scripts.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.