Minor fix if no selects have been run (Thanks Kevin)
This commit is contained in:
parent
efc984f945
commit
44f465ae0a
1 changed files with 4 additions and 3 deletions
|
@ -147,8 +147,9 @@ sub mysql_setup {
|
|||
}
|
||||
}
|
||||
|
||||
my (%mystat,%myvar);
|
||||
my (%mystat,%myvar,$dummyselect);
|
||||
sub get_all_vars {
|
||||
$dummyselect = `mysql $mysqllogin -Bse "SELECT VERSION();"`;
|
||||
my @mysqlvarlist = `mysql $mysqllogin -Bse "SHOW /*!50000 GLOBAL */ VARIABLES;"`;
|
||||
foreach my $line (@mysqlvarlist) {
|
||||
$line =~ /([a-zA-Z_]*)\s*(.*)/;
|
||||
|
@ -285,9 +286,9 @@ sub calculations {
|
|||
if ($mysqlvermajor > 3) {
|
||||
$mycalc{'query_cache_efficiency'} = sprintf("%.1f",($mystat{'Qcache_hits'} / ($mystat{'Com_select'} + $mystat{'Qcache_hits'})) * 100);
|
||||
if ($myvar{'query_cache_size'}) {
|
||||
$mycalc{'pct_query_cache_used'} = sprintf("%.1f",100 - ($mystat{'Qcache_free_memory'} / $myvar{'query_cache_size'}) * 100);
|
||||
$mycalc{'pct_query_cache_used'} = sprintf("%.1f",100 - ($mystat{'Qcache_free_memory'} / $myvar{'query_cache_size'}) * 100);
|
||||
}
|
||||
if ($mystat{'Qcache_lowmem_prunes'} == 0) {
|
||||
if ($mystat{'Qcache_lowmem_prunes'} == 0) {
|
||||
$mycalc{'query_cache_prunes_per_day'} = 0;
|
||||
} else {
|
||||
$mycalc{'query_cache_prunes_per_day'} = int($mystat{'Qcache_lowmem_prunes'} / ($mystat{'Uptime'}/86400));
|
||||
|
|
Loading…
Reference in a new issue