Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to track traffic spikes

Discussion in 'General Discussion' started by wookiee, Dec 17, 2006.

  1. wookiee

    wookiee Well-Known Member

    Feb 28, 2005
    Likes Received:
    Trophy Points:
    Las Vegas
    Apache on my brand new shiny dedicated managed server is shutting down every hour or so.

    From the managers...
    The problem appeared to be the http usage was running high and wasn't serving the pages
    The log I setup only tracks the number of connections, it doesn't track the domain getting the traffic. Since the traffic is spikes only, it's hard to see what sites are being hit when it does spike. When I look at it now, the traffic is normal, about 15 connections. But all of a sudden it may spike to 300+ connections then fail, and by the time it is seen, the stats showing which domains are being accessed are inaccessible.

    There must be some way log what is being hit to the last second before apache shut-down.

    I have about 150 domains with only 4-5 with any kind of activity.

    When the server was first activated I got a lot of...
    httpd failed @ Sun Dec 10 04:48:59 2006. A restart was attempted automagicly.

    They shut off the 'internal http restarts' to see what the problem was.
    I went to the Grand Canyon. Came back only to find the server not serving for 24 hours!!!

    For some reason they won't turn 'internal http restarts' back on, but they just put in System Integrity Monitor with a warning that it doesn't always restart apache!

    Any ideas will be appreciated.
  2. carock

    carock Well-Known Member

    Sep 25, 2002
    Likes Received:
    Trophy Points:
    St. Charles, MO
    I have used this line running from cron every 5 minutes. Don't forget to set up log rotate.

    */5 * * * * /root/scripts/ >> /var/log/apachestatuslog


    @output = `lynx -width=190 -dump`;

    print @output;

    I also created another two scripts to display that output in a way to count the number of times a specific IP is connected. For attacks, offline web browsers etc.


    @apachestatus = `/bin/bash`;

    %seen = ();
    foreach $item (@apachestatus) {
    @values = values %seen;
    @uniq = keys %seen;

    print "\nIP connections \n";
    foreach $v (@values){
    $h = $uniq[$count];
    printf("\t%6.0f %s",$v,$h);
    print "\n";



    lynx -width=190 -dump | sed -n 55,204p | awk '{print $11}'
  3. gorilla

    gorilla Well-Known Member

    Feb 3, 2004
    Likes Received:
    Trophy Points:
    Sydney / Australia
    Nice one Carock , i have to give this a fiddle :D
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice