Merge pull request #1 from DutchProgrammer/origin/v1.6.9

inconsistent performance schema info #167
This commit is contained in:
Danny 2016-03-24 19:49:12 +01:00
commit 4084ac6a61

View file

@ -82,8 +82,8 @@ my %opt = (
"noask" => 0, "noask" => 0,
"template" => 0, "template" => 0,
"json" => 0, "json" => 0,
"reportfile" => 0, "prettyjson" => 0,
"prettyjson" => 0 "reportfile" => 0
); );
# Gather the options from the command line # Gather the options from the command line
@ -93,9 +93,10 @@ GetOptions(
'host=s', 'socket=s', 'port=i', 'user=s', 'host=s', 'socket=s', 'port=i', 'user=s',
'pass=s', 'skipsize', 'checkversion', 'mysqladmin=s', 'pass=s', 'skipsize', 'checkversion', 'mysqladmin=s',
'mysqlcmd=s', 'help', 'buffers', 'skippassword', 'mysqlcmd=s', 'help', 'buffers', 'skippassword',
'passwordfile=s', 'outputfile=s', 'silent', 'dbstat', 'json', 'passwordfile=s', 'outputfile=s', 'silent', 'dbstat',
'idxstat', 'noask', 'template=s', 'reportfile=s', 'cvefile=s', 'json', 'prettyjson', 'idxstat', 'noask',
'bannedports=s','maxportallowed=s','prettyjson' 'template=s', 'reportfile=s', 'cvefile=s', 'bannedports=s',
'maxportallowed=s'
); );
if ( defined $opt{'help'} && $opt{'help'} == 1 ) { usage(); } if ( defined $opt{'help'} && $opt{'help'} == 1 ) { usage(); }
@ -191,7 +192,7 @@ my %result;
# Functions that handle the print styles # Functions that handle the print styles
sub prettyprint { sub prettyprint {
print $_[0] . "\n" unless $opt{'silent'}; print $_[0] . "\n" unless ($opt{'silent'} or $opt{'json'});
print $fh $_[0] . "\n" if defined($fh); print $fh $_[0] . "\n" if defined($fh);
} }
sub goodprint { prettyprint $good. " " . $_[0] unless ( $opt{nogood} == 1 ); } sub goodprint { prettyprint $good. " " . $_[0] unless ( $opt{nogood} == 1 ); }
@ -388,7 +389,7 @@ sub os_setup {
# Checks for updates to MySQLTuner # Checks for updates to MySQLTuner
sub validate_tuner_version { sub validate_tuner_version {
if ($opt{checkversion} eq 0) { if ($opt{checkversion} eq 0) {
print "\n"; print "\n" unless ($opt{'silent'} or $opt{'json'});
infoprint "Skipped version check for MySQLTuner script"; infoprint "Skipped version check for MySQLTuner script";
return; return;
} }
@ -2541,9 +2542,9 @@ sub mysqsl_pfs {
# Performance Schema # Performance Schema
unless ( defined($myvar{'performance_schema'}) and $myvar{'performance_schema'} eq 'ON' ) { unless ( defined($myvar{'performance_schema'}) and $myvar{'performance_schema'} eq 'ON' ) {
infoprint "Performance schema is disabled."; infoprint "Performance schema is disabled.";
} } else {
infoprint "Performance schema is enabled."; infoprint "Performance schema is enabled.";
}
} }
@ -2909,7 +2910,7 @@ sub mysql_databases {
$result{'Databases'}{'All databases'}{'Index Pct'} = $result{'Databases'}{'All databases'}{'Index Pct'} =
percentage( $totaldbinfo[2], $totaldbinfo[3] ) . "%"; percentage( $totaldbinfo[2], $totaldbinfo[3] ) . "%";
$result{'Databases'}{'All databases'}{'Total Size'} = $totaldbinfo[3]; $result{'Databases'}{'All databases'}{'Total Size'} = $totaldbinfo[3];
print "\n"; print "\n" unless ($opt{'silent'} or $opt{'json'});
foreach (@dblist) { foreach (@dblist) {
chomp($_); chomp($_);
if ( $_ eq "information_schema" if ( $_ eq "information_schema"
@ -3210,7 +3211,7 @@ sub dump_result {
exit 1; exit 1;
} }
my $json = JSON->new->allow_nonref; my $json = JSON->new->allow_nonref;
print $json->utf8(1)->pretty((defined $opt{'prettyjson'} ? 1 : 0))->encode(\%result); print $json->utf8(1)->pretty(($opt{'prettyjson'} ? 1 : 0))->encode(\%result);
} }
} }