Check my bandwidth usage?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • FLEB

    Check my bandwidth usage?

    Is there a way to check my site's bandwidth usage via PHP? I'd like to
    "gracefully bail" if I start to get near my host's limit. Its running on a
    shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.

    Thanks.

    --
    -- Rudy Fleminger
    -- sp@mmers.and.ev il.ones.will.bo w-down-to.us
    (put "Hey!" in the Subject line for priority processing!)
    -- http://www.pixelsaredead.com
  • Chris Hope

    #2
    Re: Check my bandwidth usage?

    FLEB wrote:
    [color=blue]
    > Is there a way to check my site's bandwidth usage via PHP? I'd like to
    > "gracefully bail" if I start to get near my host's limit. Its running on a
    > shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.[/color]

    Do you have access to the raw site logs for your site only that's in an area
    accessible by your PHP script? If so you can parse that for the outbound
    data sent for each request.

    If they're limiting the amount of bandwidth you're allowed in a month then
    don't they have some sort of traffic meter you can check this yourself?

    --
    Chris Hope
    The Electric Toolbox - http://www.electrictoolbox.com/

    Comment

    • FLEB

      #3
      Re: Check my bandwidth usage?

      Regarding this well-known quote, often attributed to Chris Hope's famous
      "Wed, 16 Jun 2004 14:53:02 +1200" speech:
      [color=blue]
      > FLEB wrote:
      >[color=green]
      >> Is there a way to check my site's bandwidth usage via PHP? I'd like to
      >> "gracefully bail" if I start to get near my host's limit. Its running on a
      >> shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.[/color]
      >
      > Do you have access to the raw site logs for your site only that's in an area
      > accessible by your PHP script? If so you can parse that for the outbound
      > data sent for each request.
      >
      > If they're limiting the amount of bandwidth you're allowed in a month then
      > don't they have some sort of traffic meter you can check this yourself?[/color]

      They monitor my traffic, and I can look up the number through CPanel. I
      just don't know where to get to that number in an automated manner, so the
      site on its own can, for instance, degrade images or reroute if my
      bandwidth is almost gone.

      --
      -- Rudy Fleminger
      -- sp@mmers.and.ev il.ones.will.bo w-down-to.us
      (put "Hey!" in the Subject line for priority processing!)
      -- http://www.pixelsaredead.com

      Comment

      • Michael Austin

        #4
        Re: Check my bandwidth usage?

        FLEB wrote:
        [color=blue]
        > Regarding this well-known quote, often attributed to Chris Hope's famous
        > "Wed, 16 Jun 2004 14:53:02 +1200" speech:
        >
        >[color=green]
        >>FLEB wrote:
        >>
        >>[color=darkred]
        >>>Is there a way to check my site's bandwidth usage via PHP? I'd like to
        >>>"gracefull y bail" if I start to get near my host's limit. Its running on a
        >>>shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.[/color]
        >>
        >>Do you have access to the raw site logs for your site only that's in an area
        >>accessible by your PHP script? If so you can parse that for the outbound
        >>data sent for each request.
        >>
        >>If they're limiting the amount of bandwidth you're allowed in a month then
        >>don't they have some sort of traffic meter you can check this yourself?[/color]
        >
        >
        > They monitor my traffic, and I can look up the number through CPanel. I
        > just don't know where to get to that number in an automated manner, so the
        > site on its own can, for instance, degrade images or reroute if my
        > bandwidth is almost gone.
        >[/color]

        is cpanel a webpage? What is your OS?

        Michael.

        Comment

        • Chris Hope

          #5
          Re: Check my bandwidth usage?

          Michael Austin wrote:
          [color=blue]
          > is cpanel a webpage?  What is your OS?[/color]

          Google is your friend: http://www.google.com/search?q=cpanel

          First link on the results page.

          --
          Chris Hope
          The Electric Toolbox - http://www.electrictoolbox.com/

          Comment

          • R. Rajesh Jeba Anbiah

            #6
            Re: Check my bandwidth usage?

            FLEB <soon.the.sp@mm ers.and.evil.on es.will.bow-down-to.us> wrote in message news:<1j61pi20e e1y5$.1owqi5j8b ycq0$.dlg@40tud e.net>...[color=blue]
            > Is there a way to check my site's bandwidth usage via PHP? I'd like to
            > "gracefully bail" if I start to get near my host's limit. Its running on a
            > shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.[/color]

            I was also searching for similar stuff and found here
            <http://www.xpenguin.co m/calcband.php>

            --
            | Just another PHP saint |
            Email: rrjanbiah-at-Y!com

            Comment

            • R. Rajesh Jeba Anbiah

              #7
              Re: Check my bandwidth usage?

              FLEB <soon.the.sp@mm ers.and.evil.on es.will.bow-down-to.us> wrote in message news:<1j61pi20e e1y5$.1owqi5j8b ycq0$.dlg@40tud e.net>...[color=blue]
              > Is there a way to check my site's bandwidth usage via PHP? I'd like to
              > "gracefully bail" if I start to get near my host's limit. Its running on a
              > shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.[/color]


              Just another thought, if all the files are in PHP, output buffering _may_ help.

              <?php
              function CalcBandwidth($ buffer)
              {
              $file_size = strlen($buffer) ;
              //store the file size in DB or file
              return ($buffer);
              }
              ob_start('CalcB andwidth');
              ?>

              --
              | Just another PHP saint |
              Email: rrjanbiah-at-Y!com

              Comment

              Working...