Is there a way to get alerted when MaxClients is reached?


Does anybody know a way to get alerted via e-mail when MaxClients is reached? I have a Ubuntu 10.04 VPS with Apache, PHP, and MySQL, and have been trying to figure out a way to do this with LogWatch, but have been unsuccessful. Maybe there's another way?

I'd appreciate any thoughts or suggestions you might have!


8 Replies

And why would you want to know when MaxClients is reached? It's not an error, it has no implications for security, and it could happen dozens of times a day depending on your configuration. Raising the value of MaxClients whenever you get the alert is also a recipe for disaster. See this thread.

You could write a script that uses "tail" to grab the last X lines of Apache's error log, "grep" to find the MaxClients entry, and "wc -l" to check if there are any matching lines. If a matching line is found, use the "mail" program to send an e-mail. You could put the script in root's crontab and run it every Y minutes.

Sounds like a lot of "you could" work.

Are there any "they could" solutions?

A good point. I guess what I really want is a way of telling when MaxClients is reached repeatedly, as that might be an indication that I need a VPS with more memory. My intention is not to raise MaxClients without raising the amount of RAM I have, as that would cause the VPS to go into swap space. What I'm really looking for is a way to tell if my VPS is underpowered, and unable to keep up with web requests.

Wait a few days, run grep "MaxClients" /path/to/your/apache/log and see how many it throws at you.

Or just, ya know, log actual resource usage…

Since your desired result is knowing whether or not your setup needs more resources or not, why use a middleman like MaxClients to get an answer? It seems like what you really want to do is monitor actual system load during standard use.

@akerl - Any recommendations on how to do that?


Any recommendations on how to do that?

Thanks! I played around with Munin. It's great!


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct