Bandwidth stats from inside VPS?

Mr. DOS

Member
Messages
230
Reaction score
5
Points
18
Hi,

I'd like to use a PHP script running inside my VPS to monitor my bandwidth totals for the month. Short of scraping numbers out of the HyperVM page, is there any way I can interact with OpenVZ/HyperVM from within the VPS?

--- Mr. DOS
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
One option would be to use netstat to get interface statistics. Two potential problems are that the stats are in terms of packets rather than bytes (on Linux; Windows should be fine on this count) and they're measured from system start. The latter is what makes netstat a poor tool for the job, since you'd have to contend with both restarts (which produce too-low stats) and new months (which produce too-high stats, and are easier to deal with than restarts).

There are also many fine bandwidth monitoring tools for Linux ([2]) or Windows.
 
Last edited:

Mr. DOS

Member
Messages
230
Reaction score
5
Points
18
Yes, I'm aware of that option and the problems associated with it, which are why I'd like to directly retrieve what HyperVM says I've used.

I will use something like that if no other method can be found, though.

--- Mr. DOS
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
HyperVM provides a web API, though I'm not certain if the name ("Traffic") you see on the main panel is the resource name used in the API.
 
Top