Skip to main content

How to get disk usage for reseller from command line

Comments

1 comment

  • cPRex Jurassic Moderator

    Hey there!  Yes - there are 2 ways to get that information from the system.  The first is from the WHM >> "View Reseller Usage and Manage Account Status" page as the root user.  That will show the disk usage for each account the reseller owns, as well as the individual disk usage for all their domains.

    The resellerstats call does show this output in the bottom section, but it's tricky to filter because the "diskused" output gets used as the name under each domain.  So you'd be looking for the very last "diskused" entry on the box.  Here is the output from my test server showing this, which is a reseller that owns 2 accounts:

    # whmapi1 resellerstats user='reseller'
    --- 
    data: 
      reseller: 
        acct: 
          - 
            bandwidthlimit: '1048576.00'
            bandwidthused: '1.83'
            deleted: 0
            diskquota: '10240.00'
            diskused: '228.15'
          domain: reseller.net
          package: reseller
            suspended: ~
          user: reseller
          - 
            bandwidthlimit: '0.00'
            bandwidthused: '0.00'
            deleted: 0
            diskquota: 0
            diskused: '0.21'
            domain: resell1.com
            package: default
            suspended: ~
            user: resell1
          - 
            bandwidthlimit: '0.00'
            bandwidthused: '0.00'
            deleted: 0
            diskquota: 0
            diskused: '0.20'
            domain: resell2.com
            package: default
            suspended: ~
            user: resell2
        bandwidthlimit: 0
        bwoverselling: 0
        diskoverselling: 0
        diskquota: 0
        diskused: '228.56'
        month: 10
        totalbwalloc: 1048576
        totalbwused: '1.83'
        totaldiskalloc: 10240
        user: aaron
        year: 2024
    metadata: 
      command: resellerstats
      reason: OK
      result: 1
      version: 1

    That final line showing

    diskused: '228.56'

    is the usage for all the accounts combined.

    If you do something like this and filter just that total number, you can use the last number shown as the value you want:

    # whmapi1 resellerstats user='aaron' | grep diskused
            diskused: '228.15'
            diskused: '0.22'
            diskused: '0.21'
        diskused: '228.58'
    0

Please sign in to leave a comment.