The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need a Script to find out domain with zero bandwidth usage

Discussion in 'General Discussion' started by bashcpanel, Jul 20, 2007.

  1. bashcpanel

    bashcpanel Well-Known Member

    Joined:
    Apr 15, 2007
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    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, :)
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    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.
     
  3. prath

    prath Member

    Joined:
    Dec 10, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    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:
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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.
     
  5. bashcpanel

    bashcpanel Well-Known Member

    Joined:
    Apr 15, 2007
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    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,
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    It works like any other XML API function: ...:2087/xml-api/showbw
     
  7. lwbbs

    lwbbs Member

    Joined:
    Nov 2, 2007
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hello, cPanelDavidG,

    Where can I find detail document for showbw?
    I can't find it at http://www.cpanel.net/plugins/xmlapi/index.html

    Thanks.

     
  8. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    At this time, that function has not yet been documented. API documentation continues to be a work in progress.
     
  9. lwbbs

    lwbbs Member

    Joined:
    Nov 2, 2007
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Would you please to tell me what are the input variables?
    Thanks.

     
  10. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    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.
     
  11. lwbbs

    lwbbs Member

    Joined:
    Nov 2, 2007
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I found two parameters: year and month

     
Loading...

Share This Page