Poor man’s process monitor

I lost some money a few days ago because Apache crashed on my VPS that is running the Fake Mail Generator. I’m too cheap to pay for web monitoring, so I had no idea it happened until I noticed my earnings were down.

So I had a few options:

Pay for a web monitoring service. Knowing that Apache crashed would have been nice, but I still might have to get up in the middle of the night to start it back up.

Roll my own web monitoring service. This is something I really want to do, and perhaps host on a couple of cheap VPS servers, but it still has the problem of not magically starting Apache for me if it dies.

Install daemontools. This is probably the best option, as it would let me use supervise to make sure Apache restarts if it dies for some reason. But I’m lazy and just want a quick solution.

4 comments

I think that will work fine for now, but I would still want something that would monitor the site externally. Otherwise you could still have the problem of apache is running, but nobody can get to your site because of some load-balancer died, dns entry mixed up, hardware failure not noticed by the host. If those aren’t real worries then this is more than enough. The fact that it is a virtual box does mean that the company hosting it is probably monitoring it for hardware failures as you wouldn’t be the only one on a physical box, but there could still be other problems they aren’t looking out for.

There are so many things that can go wrong with a website though, so I tend to focus on the things that have actually happened to me in the past. For example, my main dedicated server runs an IM bot that keeps an eye on my load average and checks to make sure all the critical processes are running. If something is wrong, it sends me an SMS message and an IM letting me know something is wrong. This has saved me several times in the past.

I really want to make a website monitoring site for myself and also for others. Something more affordable than what is out there. I’ve done a bit of looking and most monitoring packages are stupid expensive, especially when you keep in mind that I have about 50 sites I’d need to monitor. Maybe I’ll make it as my website-of-the-month for July.

If you wanted something more frequent than every minute, you could create it as an init process and use a sleep command to pause for a smaller number of seconds and then just loop back through your script.

I think a minute is fine (it isn’t like Apache crashes all the time — I hope at least…), but doing it as an init process is definitely an interesting idea. That may be useful for some other projects I’m working on.