Need a Script to find out domain with zero bandwidth usage

bashcpanel

Well-Known Member
Apr 15, 2007
48
0
156
Hello All,

My client has asked me to write a script which will find out the domains which are having Zero bandwidth usage.

I started writing this , but got stucked where to look for information. Allotted Bandwidth we can find in "/var/cpanel/users/username" , but where to look for the thing i am searching for?

I hope i am clear with my doubt. If not , please do let me know. I will make it more detailed.

Please help me in this.

Thanks, :)
 

Spiral

BANNED
Jun 24, 2005
2,018
8
193
I am not entirely certain a script would be needed since you could just
tell the client which domains have no bandwidth usage just from looking
at the "Bandwidth Usage" screen in WHM.
 

prath

Member
Dec 10, 2005
5
0
151
Yes... that is correct. :)

But it seems that "bashcpanel" is specifying about the file in which bandwidth usage is saved.
Then he can refer that file to find the user with ZERO bandwidth usage and can write script accordingly.
:cool:
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Yes... that is correct. :)

But it seems that "bashcpanel" is specifying about the file in which bandwidth usage is saved.
Then he can refer that file to find the user with ZERO bandwidth usage and can write script accordingly.
:cool:
Bandwidth is not stored in any single file, hence it's always been a pain to script for.

However, I will say that there is an undocumented function showbw in the XML-API you may want to consider using in conjunction with such a script.
 

bashcpanel

Well-Known Member
Apr 15, 2007
48
0
156
Hello Every one,

Thank you very much for your replies. :)

Yes "prath" is correct , i am looking for a file where i can check the bandwidth usage of domain.

David , it would be very much helpful for me , if u can tell me how to use "showbw"showbw function. I am stuck after greping the domain name from "/etc/userdomains" file.

===============
#!/bin/bash
cat /etc/userdomains | cut -d ":" -f2 > testuser
for i in `cat testuser`
do
?
?
?
:confused:
================

After do , how can i use "showbw" function ? Or, if this approach is not gonna help me , then please let me know some other way.

Thanks To all for your valuable replies. :)

Hope i can get it.

Thanks,
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Hello Every one,

Thank you very much for your replies. :)

Yes "prath" is correct , i am looking for a file where i can check the bandwidth usage of domain.

David , it would be very much helpful for me , if u can tell me how to use "showbw"showbw function. I am stuck after greping the domain name from "/etc/userdomains" file.

===============
#!/bin/bash
cat /etc/userdomains | cut -d ":" -f2 > testuser
for i in `cat testuser`
do
?
?
?
:confused:
================

After do , how can i use "showbw" function ? Or, if this approach is not gonna help me , then please let me know some other way.

Thanks To all for your valuable replies. :)

Hope i can get it.

Thanks,
It works like any other XML API function: ...:2087/xml-api/showbw
 

brianoz

Well-Known Member
Mar 13, 2004
1,146
7
168
Melbourne, Australia
cPanel Access Level
Root Administrator
Would you please to tell me what are the input variables?
My guess is that there are no input variables. It worked well when I visited the URL myself, so check it out if you're confused. If what's been discussed so far doesn't mean much to you, there are a few options - either read more and do some research and work it out, or hire someone to help.
 

lwbbs

Member
Nov 2, 2007
5
0
51
I found two parameters: year and month

My guess is that there are no input variables. It worked well when I visited the URL myself, so check it out if you're confused. If what's been discussed so far doesn't mean much to you, there are a few options - either read more and do some research and work it out, or hire someone to help.