Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was wondering if I deploy a server at home, with apache2. I would like to know how much traffic is currently on my site, in real time.

Please and thank you.

:)

share|improve this question
    
What kind of traffic? Number of page hits, or how much bandwidth is used/ number of bytes transferred via network interface? –  txwikinger Oct 28 '10 at 2:36
    
@txwikinger all the above! long time no see! –  myusuf3 Oct 28 '10 at 2:58
    
Well.. have been busy with other Ubuntu stuff :D –  txwikinger Oct 28 '10 at 3:04
    
Use JetHTTP :) Seriously though, I am curious to know if there is a way to do this with Apache. –  Nathan Osman Oct 28 '10 at 6:00

6 Answers 6

up vote 5 down vote accepted

You can install the package iptraf which gives you realtime monitoring of various tcp and udp information. Page hits are realtime logged in the apache log that you have configured. You can either scan that file for number of lines matching your time period, or you can use some like piwik for your apache server which gives you analysis similar to google analytics.

share|improve this answer

I frequently add the status module to my apache configuration so that I can examine the running state of Apache (this example restricts access to only localhost status requests).

This goes in the virtualhost configuration:

 # Server status
 <IfModule mod_status.c>
  <Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost
  </Location>
 </IfModule>

This goes in the general server configuration (I used /etc/apache2/conf.d/10status.conf):

# Turn on extended status collection
<IfModule mod_status.c>
    ExtendedStatus On
</IfModule>

And then I make sure mod_status is enabled:

sudo a2enmod status

After that, I can just visit http://your-virtual-host.example.com/server-status and get all kinds of details, including the high-level summary, like this:

Server uptime: 7 days 22 hours 56 minutes 45 seconds
Total accesses: 292855 - Total Traffic: 5.6 GB
CPU Usage: u85.78 s8.21 cu1.49 cs0 - .0139% CPU load
.426 requests/sec - 8.5 kB/second - 19.9 kB/request
2 requests currently being processed, 8 idle workers
....
Srv PID Acc M   CPU     SS  Req Conn    Child   Slot    Client  VHost   Request
0-1 27078   0/9/21119   _   0.06    3   101 0.0 0.04    372.17  67.195.113.233  example.com GET /foo.php?state=ND&thing=Madison
1-1 -   0/0/21273   .   0.01    137 0   0.0 0.00    402.35  128.61.99.146   example.com GET /favicon.ico HTTP/1.1
....

I especially like the requests/sec, and the detailed report about what URLs are being (or were recently) served.

share|improve this answer

I would recommend using apachetop, unfortunately it seems the development stopped, but it works well.

This site is more recent.

share|improve this answer
    
apachetop is cool. able to view summary realtime accessed page. –  apis17 Mar 16 '13 at 6:34

If every 5 minutes or so is realtime enough for you, take a look at Munin. It collects system information and displays them in nice graphs, see here for a live example-installation.

alt text

share|improve this answer

ssh root@HOST tcpdump -U -s0 -w - 'not port 22' | wireshark -k -i -

HOST = your webserver Chose Statistics fro Menu and Click IO Graphs

share|improve this answer

Try cacti.

aptitude install cacti
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.