use SNMP (in particular, for monitoring bandwidth you'll want to use ifInOctets and ifOutOctets). SNMP is cross platform and very standard. Best of all, there are lots of SNMP perl modules... | [reply] |
We did something similar here but not for bandwidth usage. It might prove helpful. We took a filehandle and did a tie() on it, and selected it as the default output filehandle.
Using something like this you could count the bytes that go by unobtrusively and then when the object is destroyed (the program ends), put the data out to a logfile somewhere..
| [reply] |