create a dedicated sub for innodb

This commit is contained in:
root 2015-06-18 10:56:47 +02:00
parent 0e66f16b05
commit 9d619be2e2

View file

@ -1140,8 +1140,22 @@ sub mysql_stats {
push(@generalrec,"Your applications are not closing MySQL connections properly");
}
}
# Recommandations for Innodb
sub mysql_innodb {
prettyprint "\n-------- InnoDB Metrics -----------------------------------------------------\n";
# InnoDB
if (defined $myvar{'have_innodb'} && $myvar{'have_innodb'} eq "YES" && defined $enginestats{'InnoDB'}) {
unless (defined $myvar{'have_innodb'} && $myvar{'have_innodb'} eq "YES" && defined $enginestats{'InnoDB'}) {
infoprint "InnoDB is disabled.";
if (mysql_version_ge(5,5)) {
badprint "InnoDB Storage engine is disabled. InnoDB is the default storage engine\n";
}
return;
}
infoprint "InnoDB is enabled.\n";
infoprint "InnoDB BufferPool Size :".hr_bytes($myvar{'innodb_buffer_pool_size'})."\n";
infoprint "InnoDB BufferPool Inst :".$myvar{'innodb_buffer_pool_instances'}."\n" if defined($myvar{'innodb_buffer_pool_instances'});
# InnoDB Buffer Pull Size
if ($myvar{'innodb_buffer_pool_size'} > $enginestats{'InnoDB'}) {
goodprint "InnoDB buffer pool / data size: ".hr_bytes($myvar{'innodb_buffer_pool_size'})."/".hr_bytes($enginestats{'InnoDB'})."\n";
@ -1149,13 +1163,15 @@ sub mysql_stats {
badprint "InnoDB buffer pool / data size: ".hr_bytes($myvar{'innodb_buffer_pool_size'})."/".hr_bytes($enginestats{'InnoDB'})."\n";
push(@adjvars,"innodb_buffer_pool_size (>= ".hr_bytes_rnd($enginestats{'InnoDB'}).")");
}
# InnoDB Buffer Pull Instances (MySQL 5.6.6+)
if (defined($myvar{'innodb_buffer_pool_instances'})) {
# Bad Value if > 64
if ($myvar{'innodb_buffer_pool_instances'} > 64) {
badprint "InnoDB buffer pool instances: ".$myvar{'innodb_buffer_pool_instances'}."\n";
push(@adjvars,"innodb_buffer_pool_instances (<= 64)");
} else {
}
# InnoDB Buffer Pull Size > 1Go
if ($myvar{'innodb_buffer_pool_size'} > 1024*1024*1024
and $myvar{'innodb_buffer_pool_instances'} != int($myvar{'innodb_buffer_pool_size'}/(1024*1024*1024))
@ -1170,8 +1186,9 @@ sub mysql_stats {
goodprint "InnoDB buffer pool instances: ".$myvar{'innodb_buffer_pool_instances'}."\n";
}
}
}
}
# InnoDB Log Waits
if (defined $mystat{'Innodb_log_waits'} && $mystat{'Innodb_log_waits'} > 0) {
badprint "InnoDB log waits: ".$mystat{'Innodb_log_waits'};
@ -1179,9 +1196,7 @@ sub mysql_stats {
} else {
goodprint "InnoDB log waits: ".$mystat{'Innodb_log_waits'}."\n";
}
}
}
# Take the two recommendation arrays and display them at the end of the output
sub make_recommendations {
prettyprint "\n-------- Recommendations -----------------------------------------------------\n";
@ -1219,6 +1234,7 @@ check_storage_engines; # Show enabled storage engines
security_recommendations; # Display some security recommendations
calculations; # Calculate everything we need
mysql_stats; # Print the server stats
mysql_innodb; # Print InnoDB stats
make_recommendations; # Make recommendations based on stats
close_reportfile; # Close reportfile if needed