Jump to content

Disk usage doesn't update for customer but does for admin


bluesteam
Go to solution Solved by andrezzz,

Recommended Posts

I received a call from a client this morning asking me why his stats dashboard in WHMCS is still showing that his account is full but his cPanel account shows his account is empty.

image.png.1fa3086748adc9215a2d2e1779ff2cad.png   image.png.1893fed03b1bdd2d09cc7d17f7459b41.png

After checking with the client, I  determined that his account WAS originally full and he went and cleared out a bunch of files to free up space.

So I asked him how long ago and he said about 10minutes ago. So I explained to him that this statistic on his dashboard doesn't update immediately but could take some time.

HOWEVER, After checking on my side on his account through the ADMIN dashboard, I see that it has updated correctly for me.

image.png.774248d938909fdaab38f3092acddb9b.png

So I thought, "hmmm...maybe I should update the disk usage report to force it to update" so I navigate to the Disk Usage Summary Report and right at the bottom, I click the Update Now link to force it to update.

I then go back to his profile only to find that the stat is still showing the old value.

This is VERY confusing to the clients as they could think that they still have rogue files somewhere and will pollute our help desk with these questions.

Am I the only one who sees this as a problem?

In my opinion, what should happen is whenever the client accesses the product page, it should quickly perform a cPanel API call to get the latest disk usage information to correctly reflect the details to the client to prevent this confusion.

 

 

Link to comment
Share on other sites

12 minutes ago, andrezzz said:

Hello @bluesteam,
How are you?

Just to check this first, can you show me, this table here in the Service Profile?
image.thumb.png.a2acb380ad0c433a1b502b96d330b946.png

And also try to show me this, do you have it? 

image.thumb.png.b9418babf010c9dd4220cc746e8fd8d3.png

 

See you soon!

 

Thank you so much for being willing to help me understand this. Here is the Statistics:

image.thumb.png.b56b2d8febd9e2426a926ed45feb688c.png

So as you can see, it still shows the old values for the client even though at the top for me on the same profile page it shows it as updated.

I have also checked the client's service page and the Last Updated does not show there at all.  This might be theme related though.

As a last note, I know that if I click the "Refresh now" button on the bottom right, it will update it but we shouldn't have to update it if it has already updated for us as admins.

Link to comment
Share on other sites

50 minutes ago, andrezzz said:

Just to be clear on this, to check if it's possible to create a Hook or not for it if you Refresh now, does it update on the Client Side? 

Hello,

Yes, hitting the refresh now definitely corrects the issue but I just feel that we shouldn't have to write any hooks or mods just to get this to work like it should.

Don't you agree?

Link to comment
Share on other sites

Well... I agree, but what should we do? We can't change the code or wait some months/years, for it to be changed, so I usually make Hooks to work around it.

There are differences between the statistics since one is for "the record" and the other one is for Billing for excessive usage etc.

The upper one is the Service Metric (Usage Update), saved on the table `tblhosting`, as `diskusage`, `disklimit`, `bwusage` and`bwlimit` columns. Belongs to WHMCS\Service\Service. This is a daily import of the usage of ALL the services inside that Server. Runs on Daily Cron Job.

image.png.ab53d15e56a2c00adf0de4e7df402d81.png

The other is a Usage Billing (Usage Metrics), saved on the table `tbltenant_stats` (`tenant_id` from `tblserver_tenants`, searching by the domain). Belongs to, I think, since it calls the function `MetricProvider`, WHMCS\Product\Server. According to the documentation, this runs twice a day, via the `TenantUsageMetrics` cron task, maybe isn't running correctly? Try running this command and check for any errors:

php -q /path/to/whmcs/crons/cron.php --TenantUsageMetrics -vvv

More information: https://docs.whmcs.com/Cron_Job_Issues

image.png.c944fe3a181d64cd72cc3bd03943a25c.png

image.png.bb17e9b6cd7e9c5f6759b34eb3654f0a.png

If you wanna, dm me and we discuss it further.

Edited by andrezzz
Link to comment
Share on other sites

Its awful and misleading as the updated time just shows the time you visited the product details page in the client area.

You can hook on to the cron (which theoretically should run every 5 minutes or so) to automatically update these more frequently.

use WHMCS\Service\Service;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

add_hook( 'AfterCronJob', 1, function () {
    try {
        Service::active()
            ->with( [ 'serverModel' => function ( BelongsTo $query ) {
                $query->where( 'type', 'cpanel' );
            } ] )
            ->each( function ( Service $service ) {
                $service->serverModel->syncTenantUsage( $service->domain );
            } );
    } catch ( \Exception $e ) {}
} );

 

Edited by leemahoney3
Link to comment
Share on other sites

  • WHMCS Support Manager

Hi all,

I'd like to take the opportunity to provide some clarification on how WHMCS collects and shows usage for shared hosting services.

1. The Disk and Bandwidth usage stats (and last updated date) shown at the top of the Products/Services tab and the client area Service Details page, are taken from the same source.

This is collected once per day by the UpdateServerUsage task of the by the Daily Cron Job.

Here's what those interfaces look like:

Admin Area

Client Area

 

2. The  Metric Statistics, further down the admin area and client area pages, are handled separately. They relate to the Usage Billing feature and will be updated twice per day, if you've enabled billing usage billing for that particular Metric.

These value are updated twice per day when the TenantUsageMetrics task is run by cron task scheduler, and also immediately prior to invoice generation.

Here's what those interfaces look like when Usage Billing is enabled:

Admin Area

Client Area

 

 

Link to comment
Share on other sites

@WHMCS John

Hi John,

I respectfully disagree. Actually what the client sees is what is shown below. I confirmed that in my post linked below as well as my original post:

Not the stat at the top of the Product/Services page as you mentioned.  And this is why it's an issue as the client is seeing old data that will only be updated the next day and now they pollute the help desk with queries as to why cPanel and their account is different and ask us why is WHMCS telling them to STILL upgrade after they have already cleared out their disk usage.

image.thumb.png.2773fe2d8d3eaf2f58bf494b123e197a.png

Edited by bluesteam
Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated