Retrieving Bandwidth

quackweb

Verified User
Joined
Nov 16, 2003
Messages
184
Location
Denver, Colorado
Hello,

We are currently working on a php script that will integrate grabbing disk space and bandwidth remotely. We were wondering if there is a way to do this without using the API program but instead have a script calculate or retrieve this information from DA and then put the information in a file/database. Is this possible or not? Must you use DA or can you have another script retrieve it from DA or calculate it the same way DA does without using the API pluggin. Any advice is greatly appreciated!
 
On a user account basis or on a server basis? I don't know if this can be done without the API because of permission problems but you can always try it.

I don't know if this command is possible running from a remote location but you could try the exec command in php to execute commands on the server, then you can parse the results into what you want.

This may help:
http://us3.php.net/manual/en/ref.filesystem.php

http://us3.php.net/manual/en/function.disk-free-space.php

As to bandwidth you would have to setup a routine where it could open each of the usage files in each users data directory and then parse it.
That is assuming it would even work. It would be easier to do it through the API

Edit: What might be possible is having a php on the local server with all the necassary command that is executed by the remote script. The local script collects all information and either parses and/or returns it back to the remote script for later parsing or display. Just a theory though, I have a gut feeling that the local php script would be run with the remote scripts permissions, so you'd still have the same problem.
 
Last edited:
Okay I have researched even further and it looks like the best way to do this is via API. However, when I try to access http://www.domain.com:2222/CMD_API_ADMIN_STATS

I get the following response:

RX=%32%34%37%36%2E%37%20Mb&TX=%32%38%33%34%2E%33%20Mb&bandwidth=%31%33%31%33%38%38&disk%31=%2Fdev%2Fsda%33%3A%36%37%31%32%34%36%30%3A%36%33%31%37%37%35%36%3A%35%33%37%32%38%3A%31%30%30%25%3A%2F&disk%32=%2Fdev%2Fsda%31%3A%31%30%31%30%38%36%3A%37%38%37%33%3A%38%37%39%39%34%3A%39%25%3A%2Fboot&disk%33=none%3A%35%31%37%38%32%38%3A%32%30%3A%35%31%37%38%30%38%3A%31%25%3A%2Fdev%2Fshm&disk%34=%2Fdev%2Fsdb%31%3A%34%38%30%37%39%37%33%36%3A%36%35%32%35%38%31%36%3A%33%39%31%31%31%35%38%30%3A%31%35%25%3A%2Fhome%32&disk%35=%2Fdev%2Fhdc%31%3A%31%35%33%38%33%34%38%35%32%3A%37%35%36%37%34%34%34%3A%31%33%38%34%35%32%39%39%32%3A%36%25%3A%2Fhome%33&domainptr=%31%34&ftp=%31%38%37&loadavg=%30%2E%30%32%2C%20%30%2E%30%32%2C%20%30%2E%30%30&mysql=%35%34&nemailf=%32%32&nemailml=%30&nemailr=%30&nemails=%32%32%34&nresellers=%31%36&nsubdomains=%34%32&nusers=%31%33%38&quota=%37%32%39%31%2E%39&vdomains=%31%36%31

How on earth do I use this information? All I see is a bunch of percentages. Do I need to convert them to something or what? From my understanding of the API manual, this should have resulted in numbers and not this non-sense. Any ideas? Possible bug?
 
quackweb said:
How on earth do I use this information? All I see is a bunch of percentages. Do I need to convert them to something or what?
I'm limiting my response to what these are and how to convert them.

The % sign means the next two digits represent an ascii character. so %32 means the ascii character represented by decimal ascii value of 32.

You could convert them to see what they should be.

How to fix 'em? I have no idea :( .

Jeff
 
quackweb said:
Okay I have researched even further and it looks like the best way to do this is via API. However, when I try to access http://www.domain.com:2222/CMD_API_ADMIN_STATS

I get the following response:

RX=%32%34%37%36%2E%37%20Mb&TX=%32%38%33%34%2E%33%20Mb&bandwidth=%31%33%31%33%38%38&disk%31=%2Fdev%2Fsda%33%3A%36%37%31%32%34%36%30%3A%36%33%31%37%37%35%36%3A%35%33%37%32%38%3A%31%30%30%25%3A%2F&disk%32=%2Fdev%2Fsda%31%3A%31%30%31%30%38%36%3A%37%38%37%33%3A%38%37%39%39%34%3A%39%25%3A%2Fboot&disk%33=none%3A%35%31%37%38%32%38%3A%32%30%3A%35%31%37%38%30%38%3A%31%25%3A%2Fdev%2Fshm&disk%34=%2Fdev%2Fsdb%31%3A%34%38%30%37%39%37%33%36%3A%36%35%32%35%38%31%36%3A%33%39%31%31%31%35%38%30%3A%31%35%25%3A%2Fhome%32&disk%35=%2Fdev%2Fhdc%31%3A%31%35%33%38%33%34%38%35%32%3A%37%35%36%37%34%34%34%3A%31%33%38%34%35%32%39%39%32%3A%36%25%3A%2Fhome%33&domainptr=%31%34&ftp=%31%38%37&loadavg=%30%2E%30%32%2C%20%30%2E%30%32%2C%20%30%2E%30%30&mysql=%35%34&nemailf=%32%32&nemailml=%30&nemailr=%30&nemails=%32%32%34&nresellers=%31%36&nsubdomains=%34%32&nusers=%31%33%38&quota=%37%32%39%31%2E%39&vdomains=%31%36%31

How on earth do I use this information? All I see is a bunch of percentages. Do I need to convert them to something or what? From my understanding of the API manual, this should have resulted in numbers and not this non-sense. Any ideas? Possible bug?

Since you are using PHP, try checking the urldecode() function. It may be your best friend.

=C=
 
Back
Top