Forum Moderators: bakedjake
The aim being the webserver doesn't get so busy that I can't log in using ssh and kill apache before it brings the whole system down
I.ex:
#! /usr/bin/perl
$alertvalue = 400;
#let's find a 'load' value of the 'waiting' HTTP:80 requests.
$numwait = `netstat -an ¦ grep -c ':80.*TIME_WAIT'`;
if($numwait > $alertvalue) {
# do something with your httpd.conf
# [ i.ex. change MaxClients & ThreadsPerChild values, if you're on a Apache 2]
# gracefully restart the server
system "kill -USR1 `cat /var/run/httpd.pid`";
}
exit 0;
And, as Brett pointed out, if you're often under SYN-ddos attack, an:
echo 1 > /proc/sys/net/ipv4/tcp_syncookies P.S. [this board changes some ASCII chars..
so be careful in typing 'your' pipe (-> '¦' here) char.]
cminblues
re the perl script, nice :) i'll give ti a go