Merge branch 'master' of https://github.com/major/MySQLTuner-perl
This commit is contained in:
commit
0bc46fbc9b
2 changed files with 51 additions and 18 deletions
|
@ -40,17 +40,16 @@ $mech->add_handler("response_redirect" => sub { print '#'x80,"\nREDIRECT RESPONS
|
||||||
my $url = 'http://cve.mitre.org/data/downloads/allitems.csv';
|
my $url = 'http://cve.mitre.org/data/downloads/allitems.csv';
|
||||||
my $resp;
|
my $resp;
|
||||||
|
|
||||||
unless (-f 'cve.csv')
|
unlink ('cve.csv') if (-f 'cve.csv');
|
||||||
{
|
|
||||||
$resp=$mech->get($url);
|
$resp=$mech->get($url);
|
||||||
$mech->save_content( "cve.csv" );
|
$mech->save_content( "cve.csv" );
|
||||||
}
|
|
||||||
|
|
||||||
my $f=File::Util->new('readlimit' => 100000000, 'use_flock'=>'false');
|
my $f=File::Util->new('readlimit' => 100000000, 'use_flock'=>'false');
|
||||||
my(@lines) = $f->load_file('cve.csv', '--as-lines');
|
my(@lines) = $f->load_file('cve.csv', '--as-lines');
|
||||||
my @versions;
|
my @versions;
|
||||||
my $temp;
|
my $temp;
|
||||||
unlink 'vulnerabilities.csv' if -f 'vulnerabilities.csv';
|
unlink '../vulnerabilities.csv' if -f '../vulnerabilities.csv';
|
||||||
foreach my $line (@lines) {
|
foreach my $line (@lines) {
|
||||||
if ($line =~ /(mysql|mariadb)/i
|
if ($line =~ /(mysql|mariadb)/i
|
||||||
and $line =~ /server/i
|
and $line =~ /server/i
|
||||||
|
@ -67,9 +66,11 @@ foreach my $line (@lines) {
|
||||||
my @nb=split('\.', $vers);
|
my @nb=split('\.', $vers);
|
||||||
#print $vers."\n".Dumper @nb;
|
#print $vers."\n".Dumper @nb;
|
||||||
#exit 0;
|
#exit 0;
|
||||||
$f->write_file('file' => 'vulnerabilities.csv', 'content' => "$vers;$nb[0];$nb[1];$nb[2];$line\n", 'mode' => 'append');
|
$f->write_file('file' => '../vulnerabilities.csv', 'content' => "$vers;$nb[0];$nb[1];$nb[2];$line\n", 'mode' => 'append');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(0);
|
unlink ('cve.csv') if (-f 'cve.csv');
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
# mysqltuner.pl - Version 1.6.5
|
# mysqltuner.pl - Version 1.6.6
|
||||||
# High Performance MySQL Tuning Script
|
# High Performance MySQL Tuning Script
|
||||||
# Copyright (C) 2006-2015 Major Hayden - major@mhtx.net
|
# Copyright (C) 2006-2015 Major Hayden - major@mhtx.net
|
||||||
#
|
#
|
||||||
|
@ -51,7 +51,7 @@ use Data::Dumper;
|
||||||
$Data::Dumper::Pair = " : ";
|
$Data::Dumper::Pair = " : ";
|
||||||
|
|
||||||
# Set up a few variables for use in the script
|
# Set up a few variables for use in the script
|
||||||
my $tunerversion = "1.6.5";
|
my $tunerversion = "1.6.6";
|
||||||
my ( @adjvars, @generalrec );
|
my ( @adjvars, @generalrec );
|
||||||
|
|
||||||
# Set defaults
|
# Set defaults
|
||||||
|
@ -1114,7 +1114,20 @@ sub check_storage_engines {
|
||||||
"\n-------- Storage Engine Statistics -------------------------------------------";
|
"\n-------- Storage Engine Statistics -------------------------------------------";
|
||||||
|
|
||||||
my $engines;
|
my $engines;
|
||||||
if ( mysql_version_ge( 5, 1, 5 ) ) {
|
if ( mysql_version_ge( 5, 5 ) ) {
|
||||||
|
my @engineresults = select_array
|
||||||
|
"SELECT ENGINE,SUPPORT FROM information_schema.ENGINES ORDER BY ENGINE ASC";
|
||||||
|
foreach my $line (@engineresults) {
|
||||||
|
my ( $engine, $engineenabled );
|
||||||
|
( $engine, $engineenabled ) = $line =~ /([a-zA-Z_]*)\s+([a-zA-Z]+)/;
|
||||||
|
$result{'Engine'}{$engine}{'Enabled'} = $engineenabled;
|
||||||
|
$engines .=
|
||||||
|
( $engineenabled eq "YES" || $engineenabled eq "DEFAULT" )
|
||||||
|
? greenwrap "+" . $engine . " "
|
||||||
|
: redwrap "-" . $engine . " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ( mysql_version_ge( 5, 1, 5 ) ) {
|
||||||
my @engineresults = select_array
|
my @engineresults = select_array
|
||||||
"SELECT ENGINE,SUPPORT FROM information_schema.ENGINES WHERE ENGINE NOT IN ('performance_schema','MyISAM','MERGE','MEMORY') ORDER BY ENGINE ASC";
|
"SELECT ENGINE,SUPPORT FROM information_schema.ENGINES WHERE ENGINE NOT IN ('performance_schema','MyISAM','MERGE','MEMORY') ORDER BY ENGINE ASC";
|
||||||
foreach my $line (@engineresults) {
|
foreach my $line (@engineresults) {
|
||||||
|
@ -1149,10 +1162,6 @@ sub check_storage_engines {
|
||||||
( defined $myvar{'have_isam'} && $myvar{'have_isam'} eq "YES" )
|
( defined $myvar{'have_isam'} && $myvar{'have_isam'} eq "YES" )
|
||||||
? greenwrap "+ISAM "
|
? greenwrap "+ISAM "
|
||||||
: redwrap "-ISAM ";
|
: redwrap "-ISAM ";
|
||||||
$engines .=
|
|
||||||
( defined $myvar{'have_aria'} && $myvar{'have_aria'} eq "YES" )
|
|
||||||
? greenwrap "+Aria "
|
|
||||||
: redwrap "-Aria ";
|
|
||||||
$engines .=
|
$engines .=
|
||||||
( defined $myvar{'have_ndbcluster'}
|
( defined $myvar{'have_ndbcluster'}
|
||||||
&& $myvar{'have_ndbcluster'} eq "YES" )
|
&& $myvar{'have_ndbcluster'} eq "YES" )
|
||||||
|
@ -1884,6 +1893,15 @@ sub mysql_stats {
|
||||||
push( @generalrec,
|
push( @generalrec,
|
||||||
"Upgrade MySQL to version 4+ to utilize query caching" );
|
"Upgrade MySQL to version 4+ to utilize query caching" );
|
||||||
}
|
}
|
||||||
|
elsif (mysql_version_ge(5,6))
|
||||||
|
{
|
||||||
|
if ( $myvar{'query_cache_type'} ne "OFF" ) {
|
||||||
|
badprint "Query cache should be disabled by default due to mutex contention.";
|
||||||
|
push( @adjvars, "query_cache_type (=0)" );
|
||||||
|
} else {
|
||||||
|
goodprint "Query cache is disabled by default due to mutex contention.";
|
||||||
|
}
|
||||||
|
}
|
||||||
elsif ( $myvar{'query_cache_size'} < 1 ) {
|
elsif ( $myvar{'query_cache_size'} < 1 ) {
|
||||||
badprint "Query cache is disabled";
|
badprint "Query cache is disabled";
|
||||||
push( @adjvars, "query_cache_size (>= 8M)" );
|
push( @adjvars, "query_cache_size (>= 8M)" );
|
||||||
|
@ -2338,6 +2356,19 @@ sub mariadb_threadpool {
|
||||||
infoprint "ThreadPool stat is enabled.";
|
infoprint "ThreadPool stat is enabled.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Recommendations for Performance Schema
|
||||||
|
sub mysqsl_pfs {
|
||||||
|
prettyprint
|
||||||
|
"\n-------- Performance schema --------------------------------------------------";
|
||||||
|
|
||||||
|
# Performance Schema
|
||||||
|
unless ( defined($myvar{'performance_schema'}) and $myvar{'performance_schema'} eq 'ON' ) {
|
||||||
|
infoprint "Performance schema is disabled.";
|
||||||
|
}
|
||||||
|
|
||||||
|
infoprint "Performance schema is enabled.";
|
||||||
|
}
|
||||||
|
|
||||||
# Recommendations for Ariadb
|
# Recommendations for Ariadb
|
||||||
sub mariadb_ariadb {
|
sub mariadb_ariadb {
|
||||||
prettyprint
|
prettyprint
|
||||||
|
@ -2977,10 +3008,11 @@ security_recommendations; # Display some security recommendations
|
||||||
cve_recommendations; # Display related CVE
|
cve_recommendations; # Display related CVE
|
||||||
calculations; # Calculate everything we need
|
calculations; # Calculate everything we need
|
||||||
mysql_stats; # Print the server stats
|
mysql_stats; # Print the server stats
|
||||||
mysql_myisam; # Print MyISAM stats
|
mysqsl_pfs # Print Performance schema info
|
||||||
mysql_innodb; # Print InnoDB stats
|
|
||||||
mariadb_threadpool; # Print MaraiDB ThreadPool stats
|
mariadb_threadpool; # Print MaraiDB ThreadPool stats
|
||||||
|
mysql_myisam; # Print MyISAM stats
|
||||||
mariadb_ariadb; # Print MaraiDB AriaDB stats
|
mariadb_ariadb; # Print MaraiDB AriaDB stats
|
||||||
|
mysql_innodb; # Print InnoDB stats
|
||||||
mariadb_tokudb; # Print MaraiDB TokuDB stats
|
mariadb_tokudb; # Print MaraiDB TokuDB stats
|
||||||
mariadb_galera; # Print MaraiDB Galera Cluster stats
|
mariadb_galera; # Print MaraiDB Galera Cluster stats
|
||||||
get_replication_status; # Print replication info
|
get_replication_status; # Print replication info
|
||||||
|
@ -3001,7 +3033,7 @@ __END__
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
MySQLTuner 1.6.5 - MySQL High Performance Tuning Script
|
MySQLTuner 1.6.6 - MySQL High Performance Tuning Script
|
||||||
|
|
||||||
=head1 IMPORTANT USAGE GUIDELINES
|
=head1 IMPORTANT USAGE GUIDELINES
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue