# PHP Network Monitoring

Is there a way that I can monitor the traffic, Upload/Download (separately) using PHP? I`d like to echo out something like that:

This should be based on the System Uptime, so if I restart the computer, the count should restart.

-

I think *mod_cband* could do the trick. I don't know if it works on Hasefroch but you could try it...

Edit: Oh, I see that you need a global counter so ifconfig would be the way. I don't like PHP doing system calls so what about a C daemon writing a log file that would be readed by PHP?

Bye

-

ever consider looking at nagios? Free open source monitoring tool. We use it extensively at work to monitor all sorts of things

-

You could write a script that parses the RX and TX counters from ifconfig (on a Linux box), those get reset on boot. The only problem is that it wont be just HTTP traffic, it's a global counter for all traffic on the box.

-
Yes, thanks no problem I need the global counter, not only HTTP. Thanks a lot. –  user38997 Mar 27 '10 at 22:30
Just run `ifconfig` from within php and parse out the TX/RX fields.