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
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
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 by misson; 12-06-2009 at 08:46 AM.
Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.Misson, not Mission.
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
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.
Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.Misson, not Mission.