Saturday, June 28, 2008

Checking number of apache connections

Checking number of apache connections
===============================

= netstat -an |grep :80

= netstat -autpn | grep :80

= netstat -anop | grep 995

= netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1

= netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

Block the IP that has too many connections :

= apf -d 203.200.84.194

= iptables -I INPUT -s 123.123.123.123 -j DROP

= route add -host 67.15.111.131 reject

= service httpd restart

= /usr/local/apache/bin/apachectl start

No comments: