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.

Any tip about software to monitor if a web server is up and running on linux ? It should be able to run with not knowing anything more than the URL. And it must have functionality to send an email alert when the site goes down. Should not be hard to write a script for this myself but seems pointless if there is already something nice out there.

Note that I am going to monitor internal servers, so this need to be a tool that runs on my machine on the same network, not external web based services.

And note that small and simple solutions are preferred.

Update: I eventually created a small python script that I am currently using for this, it can be found here.

share|improve this question
    
possible duplicate of what are the various ways to monitor servers remotely. –  Warner Aug 31 '10 at 14:19
    
See also: serverfault.com/questions/44/… -- This topic has been covered extensively on a high level. –  Warner Aug 31 '10 at 14:20

6 Answers 6

up vote 8 down vote accepted

You can use wget in a script like this

wget --timeout=3 --tries=1 --spider --no-check-certificate http://serverfault.com

if [ $? -ne 0 ];then
  echo "Site Down" | mail -s "Site Down" admin@yourdomain.com
fi

And you will get an email if wget cannot access the site first time within three seconds.

Set up a cron job to run the script every few minutes.

There are many other alternatives but this is probably the simplest to set up from scratch.

share|improve this answer
5  
as long as you don`t run it on the server that its monitoring - you have no idea how often I have seen that done ;-) –  Geraint Jones Aug 31 '10 at 10:47
    
Thanks. In addition I found that --spider is also an useful option as it avoids to actually save the page to disk. –  Zitrax Sep 1 '10 at 10:16
1  
And without installing 'postfix' the mail command just silently fails to send. –  Zitrax Sep 2 '10 at 8:02
2  
@Zitrax: And without wget being installed you will get an error. Without the network being up the wget will fail. Without the script being executable the cron job will fail and so on. Also I don't have 'postfix' installed and it works fine for me because I am using exim. –  Richard Holloway Sep 2 '10 at 15:45
    
I would add --no-proxy and --spider –  Filippo Mar 29 '12 at 1:25

You have many options, I'll give you two.

  • Nagios is a full-blown monitoring application capable of monitoring much much more than http, but it handles that as well. It can also create all kinds of repots ("Tell me the uptime percentage of our server/service X this week/month/year...")

  • Monit is another popular choice. Maybe not as feature-filled as Nagios, but nevertheless it's nice.

share|improve this answer
    
I was looking for something small and simple, so monit seems closer to that. –  Zitrax Aug 31 '10 at 10:57

Well, if you want to run something yourself.

These are some options:

Or if you want a managed solution:

Personally I think Zabbix and Zenoss are overkill if you simply wish to monitor the status of a web server. But if you also plan to monitor anything else than they have more features than you'll ever need ;)

share|improve this answer
    
I guess pingdom and uptrends can't monitor the sites on my internal network. –  Zitrax Aug 31 '10 at 10:46
    
@Zitrax: no, they can't. I read over that part. –  Wolph Sep 1 '10 at 0:09

I've upvoted Richard and Janne's answer, but if you want some more detail as to what your webserver is sending and receiving, the first couple chapters of the O'Reilly book "Web Client Programming with Perl" by Clinton Wong gives a great overview of the HTTP protocol. If you want more detailed monitoring than just up/down and want to include response codes, etc, it is a fine place to start.

The book is old, but still valid. Published in 1997, O'Reilly has posted the contents of the book online for free at http://oreilly.com/openbook/webclient/ as part of their OpenBook initiative.

share|improve this answer

I would vote up Janne's answer if I had rep.

Important note about Nagios, the fact that it's full blown does not mean it's a hard and long installation, It's quite simple and friendly.

Second thing, you should really check out what your hardware vendor has to offer. For example, I'm using HP Proliants and they have really nice rpm's that help.

share|improve this answer

If you like what Nagios does, but don't want to delve into the internals, you can also check out link text. It is Nagios and a couple of other tools, but delivered through a nice GUI. It's a pretty good starting point.

share|improve this answer

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.