How to set up notifications about server overload? [duplicate]

Posted on

How to set up notifications about server overload? [duplicate] – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, ubuntu, nginx, monitoring, ddos.

Possible Duplicate:
What tool do you use to monitor your servers?

How to get notified (preferably by email) when my webserver reaches certain amount of incoming requests? This way I’ll be able to quickly react ddos, bruteforce etc.

I’m using apache through nginx proxy, so I’m able to monitor either of them (preferably nginx)

Solution :

If you have Munin, you can use it to send notifications. First, install a plugin to monitor request rate in Nginx (like this one). Then follow the instructions in Munin documentation: Sending Alerts from Munin. An even shorter introduction may be found here: Email Notifications from Munin

You can use monitoring software like nagios to setup notifications (by email/SMS etc). You can define your own notification commands. Also, you can define your check commands and the warning/critial threshold of each command.

For some basic monitoring:

Grab the Nagios check_nginx.sh script: http://exchange.nagios.org/directory/Plugins/Web-Servers/nginx/check_nginx-2Esh/details

(Nagios checks are generally scripts that will return specified exit codes for events — 0 for OK, 1 for WARN, 2 for CRIT; you can use them outside of Nagios.)

Turn on the stub stats module in nginx and have it on http://localhost/stats or something like that: http://wiki.nginx.org/NginxHttpStubStatusModule#Directives

Point the check script at the stats URL: you’ll see connections per second. Set a threshold for it with the -w or -c option. Wrap that in a shell script that will send you email if the script returns a non-zero exit code. Put the script into cron.

The page about the Nginx module has some links on the bottom about other monitoring options.

Other option:

You can install Monit (there’s a free, self-supported package for most Linux distros). There’s apparently some stuff on Apache monitoring here:

http://mmonit.com/wiki/Monit/MonitorApacheStatus

With monitoring software. In the upper right corner there is a search field you can use to find one.