Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotas Bar Charts Incorrect #110

Closed
clawrie opened this issue Feb 17, 2015 · 62 comments
Closed

Quotas Bar Charts Incorrect #110

clawrie opened this issue Feb 17, 2015 · 62 comments

Comments

@clawrie
Copy link

clawrie commented Feb 17, 2015

Bars for disk quotas in System Information are not accurate.
Please refer to attached image.
quotas

@iliajie
Copy link
Collaborator

iliajie commented Feb 17, 2015

Thanks for reporting.
Help me out to solve this. I need to see the array, that is transformed to those wrong % numbers.

Just do the following:

  1. Open authentic-theme/authentic-lib.cgi (it's in Webmin directory, usually /usr/libexec/webmin).
  2. Find foreach my $t ( @{ $info->{'chart'} } ) { (about the line 296)
  3. Right under this line, hit enter to start a new line and add this prt($t);
  4. Save the file and go to browser.
  5. Click View Frame source, while right clicking with your mouse on right frame on the theme (where quotas are) (In case you're using Firefox, you can find this (View Frame Source) under drop down)
  6. Open source of sysinfo.cgi page and click refresh (CTRL+R or F5)
  7. Then find printed VAR1.

I need that content that will contain numbers about the charts. Please send it to me and I will provide fix as soon as possible.

@clawrie
Copy link
Author

clawrie commented Feb 17, 2015

I'll try to do this tonight for you .. at college until 9PM :(

On Tue, Feb 17, 2015 at 6:13 PM, Ilia Rostovtsev [email protected]
wrote:

Thanks for reporting.
Help me out to solve this. I need to see that array that is transformed to
that numbers.

Just do the following:

  1. Open authentic-theme/authentic-lib.cgi (it's in Webmin directory,
    usually /usr/libexec/webmin).
  2. Find foreach my $t ( @{ $info->{'chart'} } ) { (about the line 296)
  3. Right under this line, hit enter to start a new line and add this
    prt($t);
  4. Save the file and go to browser.
  5. Click View Frame source, while right clicking with your mouse on right
    frame
    on the theme (where quotas are) (In case you're using Firefox,
    you can find this (View Frame Source) under drop down)
  6. Open source of sysinfo.cgi page and click refresh (CTRL+R or F5)
  7. Then find printed VAR1.

I need that content that will contain numbers about the charts. Please
send it to me and I will provide fix as soon as possible.


Reply to this email directly or view it on GitHub
#110 (comment)
.

@iliajie
Copy link
Collaborator

iliajie commented Feb 17, 2015

I see. Alright!

@iliajie
Copy link
Collaborator

iliajie commented Feb 18, 2015

You might need to install CPAN module Data::Dumper by going to Webmin->Other->Perl Modules

@iliajie
Copy link
Collaborator

iliajie commented Feb 18, 2015

So can you help me out? Quotas doesn't work on my system for some reasons.. If you don't want to install anything there is another way..

@clawrie
Copy link
Author

clawrie commented Feb 18, 2015

I'll be able to do this today on our teat server.
On 19/02/2015 5:23 am, "Ilia Rostovtsev" [email protected] wrote:

So can you help me out? Quotas doesn't work on my system for some
reasons.. If you don't want to install anything there is another way..


Reply to this email directly or view it on GitHub
#110 (comment)
.

@clawrie
Copy link
Author

clawrie commented Feb 18, 2015

Test server that is :(
On 19/02/2015 6:47 am, "Craig Lawrie" [email protected] wrote:

I'll be able to do this today on our teat server.
On 19/02/2015 5:23 am, "Ilia Rostovtsev" [email protected] wrote:

So can you help me out? Quotas doesn't work on my system for some
reasons.. If you don't want to install anything there is another way..


Reply to this email directly or view it on GitHub
#110 (comment)
.

@iliajie
Copy link
Collaborator

iliajie commented Feb 18, 2015

Any server where quotas are working. If you do it on different machine, please attach a screenshot again. It should only take few minutes really.

@clawrie
Copy link
Author

clawrie commented Feb 19, 2015

Hi

Here is the info... (the test server only has two sites so only two sets of
data - hope that's enough).

$VAR1 = { 'chart' => [ '1073741824', 110587904, 10125312 ],

$VAR1 = { 'chart' => [ '1073741824', 409600, 8192 ],

[image: Inline image 1]

I can create a webmin user account for you if you would like to take a look
and experiment.
The server is pretty slow though - just a 'tiny' Amazon web server instance
for testing things out.

Craig

On Thu, Feb 19, 2015 at 8:46 AM, Ilia Rostovtsev [email protected]
wrote:

Any server where quotas are working. If you do it on different machine,
please attach a screenshot again. It should only take few minutes really.


Reply to this email directly or view it on GitHub
#110 (comment)
.

@iliajie
Copy link
Collaborator

iliajie commented Feb 19, 2015

Thanks. Great. No need for test login. Could you please take a screenshot. What are the numbers on the right?

@clawrie
Copy link
Author

clawrie commented Feb 19, 2015

There's a partial screen capture in my previous message. Are the numbers
on the right the 115.12 MB of 1024 MB and 408kB of 1024MB?? I can't see any
other numbers.
If so, it's used vs allocated disk space.

On Thu, Feb 19, 2015 at 4:52 PM, Ilia Rostovtsev [email protected]
wrote:

Thanks. Great. No need for test login. Could you please take a screenshot.
What are the numbers on the right?


Reply to this email directly or view it on GitHub
#110 (comment)
.

@dreamrae
Copy link

Hi! I'm experiencing the same issue. Below is the requested information:

$VAR1 = { 'value' => '612.75 MB of 5 GB', 'chart' => [ '5368709120', 642482176, 32768 ], 'desc' => 'tld_domain.dns' };
$VAR1 = { 'desc' => 'tld_domain.dns2', 'chart' => [ '5368709120', 212992, 32768 ], 'value' => '240 kB of 1024 MB' };
$VAR1 = { 'desc' => 'tld_domain.dns3', 'chart' => [ '5368709120', 196608, 32768 ], 'value' => '224 kB of 1024 MB' };
$VAR1 = { 'desc' => 'tld_domain.dns4', 'chart' => [ '5368709120', 204800, 8192 ], 'value' => '208 kB of 1024 MB' };

quotas

@iliajie
Copy link
Collaborator

iliajie commented Feb 19, 2015

Alright, guys! Seems like I got it. Please test it. Replace authentic-lib.cgi in with the updated one: https://rostovtsev.ru/pub/src/authentic/9.5.0-patches/authentic-lib.cgi

@dreamrae
Copy link

So glad I could help! Thank you Mr. Rostovtsev!

@iliajie
Copy link
Collaborator

iliajie commented Feb 19, 2015

Could you please test it? It should display correct information now. Is it?

@dreamrae
Copy link

Tested - It is working!

quotas

@iliajie
Copy link
Collaborator

iliajie commented Feb 19, 2015

Ohh, yeah!! :) Now let's see what @clawrie says! I think it should also work fine!

Great, thank you guys!

@clawrie
Copy link
Author

clawrie commented Feb 19, 2015

Hi Ilia

That looks to have fixed the issue - thanks very much.

Craig

On Fri, Feb 20, 2015 at 5:16 AM, Ilia Rostovtsev [email protected]
wrote:

Ohh, yeah!! :) Now let's see what @clawrie https://github.com/clawrie
says! I think it should also work fine!

Great, thank you guys!


Reply to this email directly or view it on GitHub
#110 (comment)
.

@iliajie
Copy link
Collaborator

iliajie commented Feb 20, 2015

Great! Thanks for reporting!

@7starsone
Copy link

to me is wrong yet...
168.40 MB of 2 GB reports as 0% while it should be at least 8%

@iliajie
Copy link
Collaborator

iliajie commented Feb 23, 2015

Print an array please.

@7starsone
Copy link

$VAR1 = {
'chart' => [
'137438953472',
3525713920,
6193991680
],
'value' => '9.05 GB',
'desc' => '<a class='ui_link' href='/virtual-server/edit_domain.cgi?dom=141676138110898'>domain.tld'
};

$VAR1 = {
'chart' => [
'137438953472',
4671164416,
8192
],
'value' => '4.35 GB',
'desc' => '<a class='ui_link' href='/virtual-server/edit_domain.cgi?dom=14167606569562'>domain2.tld'
};

$VAR1 = {
'chart' => [
'137438953472',
176570368,
8192
],
'value' => '168.40 MB of 2 GB',
'desc' => '<a class='ui_link' href='/virtual-server/edit_domain.cgi?dom=141341030325393'>domain3.tld'
};
$VAR1 = {
'chart' => [
'137438953472',
171589632,
1536000
],
'value' => '165.11 MB of 128 GB',
'desc' => '<a class='ui_link' href='/virtual-server/edit_domain.cgi?dom=141676097010212'>domain4.tld'
};
$VAR1 = {
'chart' => [
'137438953472',
56614912,
839680
],
'value' => '54.79 MB of 2 GB',
'desc' => '<a class='ui_link' href='/virtual-server/edit_domain.cgi?dom=141328307217527'>domain5.tld'
};

$VAR1 = {
'chart' => [
'137438953472',
479232,
118784
],
'value' => '584 kB of 4 GB',
'desc' => '<a class='ui_link' href='/virtual-server/edit_domain.cgi?dom=14235034509552'>domain6.tld'
};

.....

@iliajie
Copy link
Collaborator

iliajie commented Feb 23, 2015

Look:

$VAR1 = {
'chart' => [
'137438953472',
479232,
118784
],
'value' => '584 kB of 4 GB',
'desc' => 'domain6.tld'
};

It's totally wrong. Total value (the first one) is never right? I will report it to Webmin developers.

@7starsone
Copy link

I don't know... 137438953472 is the total value of what? are they bytes?
I have 7 account plans (one of which is the default plan with everything Unlimited, for my personal domain(s) ) and the max plan for users is a 128GB disk quota, instead...
but what has this to do with that total value? or isn't related?

@iliajie
Copy link
Collaborator

iliajie commented Feb 23, 2015

Where do you see of 4 GB on the array. It's not there.. What default theme shows?

@7starsone
Copy link

Virtualmin framed theme reports the same: 584 kB of 4 GB

@iliajie
Copy link
Collaborator

iliajie commented Feb 23, 2015

I would call it a bug. Will see what Jamie says.

@iliajie
Copy link
Collaborator

iliajie commented Mar 3, 2015

I will fix it very soon in version 10.0.0.

@clawrie
Copy link
Author

clawrie commented Mar 3, 2015

Great. Looking forward to it.

@iliajie
Copy link
Collaborator

iliajie commented Mar 4, 2015

@7starsone I think the reason for the bandwidth problem is in Virtualmin 4.14. I tested it with Virtualmin pre-release 4.15 and all was fine. Let's please wait. I think it will fix the problem.. but I would like to see the screenshot for the bandwidth, as I never seen it on the System Information Page.

@7starsone
Copy link

ok, the first domain has bandwidth _unlimited_
Image of bandw

@iliajie
Copy link
Collaborator

iliajie commented Mar 4, 2015

How does it show in Virtualmin theme? I would guess the same? If so, please report it to Webmin thread right now.

@iliajie
Copy link
Collaborator

iliajie commented Mar 4, 2015

Ahh, OK. No. It's gonna be fixed in Virtualmin 4.15, I think it's out today. ;)

@7starsone
Copy link

I don't see bandwidth on 4.14 Virtualmin framed theme...
when it comes to Quota i get this error

Error - Perl execution failed
Illegal division by zero at /usr/libexec/webmin/virtual-server-theme/newright.cgi line 104.

is it related?

@iliajie
Copy link
Collaborator

iliajie commented Mar 4, 2015

No worries. It will be fixed in Virtualmin 4.15. I will report a bug for you to Virtualmin.

@7starsone
Copy link

still issues with 4.15, now I see _not unlimited_ domains only (and this is _good...) _BUT...
Image of q15
Image of b15

@iliajie
Copy link
Collaborator

iliajie commented Mar 6, 2015

Restarted Webmin? ;)

@iliajie
Copy link
Collaborator

iliajie commented Mar 6, 2015

...and 170mb out of 2gb = ~8% - where is the problem here?

@7starsone
Copy link

yes and..
no, the problems are all the 2% values.... not always correct

@iliajie
Copy link
Collaborator

iliajie commented Mar 6, 2015

Yes, actually it is.. Hmm.. Ok, can you print the array again? That is wierd.. It's all correct on my server..

@7starsone
Copy link

e.g.

$VAR1 = {
          'chart' => [
                       100,
                       0,
                       0
                     ],
          'value' => '165.11 MB&nbsp;of&nbsp;128 GB',
          'desc' => '<a class=\'ui_link\' href=\'/virtual-server/edit_domain.cgi?dom=141676097010212\'>domain.net</a>'
        };

@7starsone
Copy link

that should be correct and i don't understand... i cleared cache and restarted webmin..
there's something still to be fixed

@7starsone
Copy link

[root@myhost ~]# quota thatuser
Disk quotas for user thatuser (uid 506):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
       /dev/md2  167836  134217728 134217728            4533       0       0

@iliajie
Copy link
Collaborator

iliajie commented Mar 6, 2015

authentic-lib.cgi, line 340

replace
$chart_percent

with
$t->{'chart'}[1]

Does it work?

@7starsone
Copy link

Yes, it works ;-)

@iliajie
Copy link
Collaborator

iliajie commented Mar 6, 2015

Alright, please update to version 10.1.0. Does it fully fix your problem?

@drkskwlkr
Copy link

Attached VAR output as requested (four quota entries in my list):

$VAR1 = {
'desc' => 'Domain1',
'chart' => [
'1157619712',
818016256,
339603456
],
'value' => '1.08 GB'
};

$VAR1 = {
'desc' => 'Domain2',
'value' => '1.02 GB',
'chart' => [
'1157619712',
1088880640,
6811648
]
};

$VAR1 = {
'desc' => 'Domain3',
'value' => '61.32 MB',
'chart' => [
'1157619712',
61534208,
2760704
]
};

$VAR1 = {
'desc' => 'Domain4',
'value' => '208 kB',
'chart' => [
'1157619712',
212992,
0
]
};

@iliajie
Copy link
Collaborator

iliajie commented Mar 7, 2015

From what I can see you have old buged type output. You ether didn't update Virtualmin or still have old, cache version of the lib files in memory... Try to double check please. When I get to PC I will post more things to check. If it persists will create a bug to Virtualmin team.

@drkskwlkr
Copy link

I restarted webmin (service webmin restart) and rebooted the server but nothing changed. I am positive that I am running the latest version of Virtualmin (4.15gpl-2)

@iliajie
Copy link
Collaborator

iliajie commented Mar 7, 2015

What is the content of:

  1. authentic-theme/sysinfo.cgi line 40-50
  2. virtual-server/system_info.pl line 285-363

Besides, what is your version of Webmin?

@drkskwlkr
Copy link

drkskwlkr commented Mar 7, 2015

Contents of /usr/share/webmin/authentic-theme/sysinfo.cgi, line 40-50

    : ''
) . '</h3>' . "\n";

print '</div>';
print '<div class="panel-body">' . "\n";

# Get system info to show
my @info = &list_combined_system_info( { 'qshow', 1 } );

if ( $level == 0 ) {

Contents of /usr/share/webmin/virtual-server/system_info.pl, line 285-363

# Top quota users
my @quota = $info->{'quota'} ?
                grep { &can_edit_domain($_->[0]) } @{$info->{'quota'}} : ( );
if (!$data->{'noquotas'} && @quota && (&master_admin() || &reseller_admin())) {
        my @usage;
        my $max = $data->{'max'} || 10;
        my $maxquota = $info->{'maxquota'};

        # Work out if showing by percent makes sense
        my $qshow = $data->{'qshow'};
        if ($qshow) {
                my @quotawithlimit = grep { $_->[2] } @quota;
                $qshow = 0 if (!@quotawithlimit);
                }


        # Limit to those with a quota limit, if showing a percent
        if ($qshow) {
                @quota = grep { $_->[2] } @quota;
                }

        if ($qshow) {
                # Sort by percent used
                @quota = grep { $_->[2] } @quota;
                @quota = sort { ($b->[1]+$b->[3])/$b->[2] <=>
                                ($a->[1]+$a->[3])/$a->[2] } @quota;
                }
        else {
                # Sort by usage
                @quota = sort { $b->[1]+$b->[3] <=> $a->[1]+$a->[3] } @quota;
                }

        # Message above list
        my $qmsg;
        if (@quota > $max) {
                @quota = @quota[0..($max-1)];
                $qmsg = &text('right_quotamax', $max);
                }
        elsif (&master_admin()) {
                $qmsg = $text{'right_quotaall'};
                }
        else {
                $qmsg = $text{'right_quotayours'};
                }

        my $open = 0;
        foreach my $q (@quota) {
                my $cmd = &can_edit_domain($q->[0]) ? "edit_domain.cgi"
                                                    : "view_domain.cgi";
                my $chart = { 'desc' => &ui_link(
                        '/'.$module_name.'/'.$cmd.'?dom='.$q->[0]->{'id'},
                         &show_domain_name($q->[0])) };
                if ($qshow) {
                        # By percent used
                        my $qpc = int($q->[1]*100 / $q->[2]);
                        my $dpc = int($q->[3]*100 / $q->[2]);
                        $chart->{'chart'} = [ 100, $qpc, $dpc ];
                        }
                else {
                        # By actual usage
                        $chart->{'chart'} = [ $maxquota, $q->[1], $q->[3] ];
                        }
                if ($q->[2]) {
                        # Show used and limit
                        my $pc = int(($q->[1]+$q->[3])*100 / $q->[2]);
                        $pc = "&nbsp;$pc" if ($pc < 10);
                        $chart->{'value'} = &text('right_out',
                                                  &nice_size($q->[1]+$q->[3]),
                                                  &nice_size($q->[2]));
                        }
                else {
                        # Just show used
                        $chart->{'value'} = &nice_size($q->[1]+$q->[3]);
                        }
                if ($q->[2] && $q->[1]+$q->[3] >= $q->[2]) {
                        # Domain is over quota
                        $open = 1;
                        }
                push(@usage, $chart);
                }

Webmin version is 1.730

@drkskwlkr
Copy link

Sure, let's wait and see if the Webmin devs can say something more. I will patch the sysinfo.pl file as suggested && remain at your disposal to troubleshoot this thing. Thank you for your time!

@iliajie
Copy link
Collaborator

iliajie commented Mar 7, 2015

Do you have anything changed in Virtualmin->Configuration, like external/custom commands or something? Or other quotas settings?

@drkskwlkr
Copy link

No, I don't think so. I am not very experienced in Linux server administration and avoid touching anything whose purpose is not clear to me. I have no custom commands regarding quotas in Virtualmin->Configuration; I have defined the quotas for the different virtual servers via Edit Virtual Server->Quotas and Limits.

@drkskwlkr
Copy link

Heh. The problem got solved by itself.

I decided to reset the quotas (by writing 2048 MB instead of 2GB) just to see what would happen and as soon as I did this for all four virtual servers, the chart started showing the proper units (I have not yet patched the authentic-theme/sysinfo.pl file).

@iliajie
Copy link
Collaborator

iliajie commented Mar 7, 2015

Alright, it's cache problem. Jamie is aware! Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants