This commit is contained in:
Jean-Marie RENOUARD 2016-03-21 15:28:25 +01:00
commit 0bc46fbc9b
2 changed files with 51 additions and 18 deletions

View file

@ -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 $resp;
unless (-f 'cve.csv')
{
$resp=$mech->get($url);
$mech->save_content( "cve.csv" );
}
unlink ('cve.csv') if (-f 'cve.csv');
$resp=$mech->get($url);
$mech->save_content( "cve.csv" );
my $f=File::Util->new('readlimit' => 100000000, 'use_flock'=>'false');
my(@lines) = $f->load_file('cve.csv', '--as-lines');
my @versions;
my $temp;
unlink 'vulnerabilities.csv' if -f 'vulnerabilities.csv';
unlink '../vulnerabilities.csv' if -f '../vulnerabilities.csv';
foreach my $line (@lines) {
if ($line =~ /(mysql|mariadb)/i
and $line =~ /server/i
@ -67,9 +66,11 @@ foreach my $line (@lines) {
my @nb=split('\.', $vers);
#print $vers."\n".Dumper @nb;
#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);

View file

@ -1,5 +1,5 @@
#!/usr/bin/env perl
# mysqltuner.pl - Version 1.6.5
# mysqltuner.pl - Version 1.6.6
# High Performance MySQL Tuning Script
# Copyright (C) 2006-2015 Major Hayden - major@mhtx.net
#
@ -51,7 +51,7 @@ use Data::Dumper;
$Data::Dumper::Pair = " : ";
# Set up a few variables for use in the script
my $tunerversion = "1.6.5";
my $tunerversion = "1.6.6";
my ( @adjvars, @generalrec );
# Set defaults
@ -1114,7 +1114,20 @@ sub check_storage_engines {
"\n-------- Storage Engine Statistics -------------------------------------------";
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
"SELECT ENGINE,SUPPORT FROM information_schema.ENGINES WHERE ENGINE NOT IN ('performance_schema','MyISAM','MERGE','MEMORY') ORDER BY ENGINE ASC";
foreach my $line (@engineresults) {
@ -1149,10 +1162,6 @@ sub check_storage_engines {
( defined $myvar{'have_isam'} && $myvar{'have_isam'} eq "YES" )
? greenwrap "+ISAM "
: redwrap "-ISAM ";
$engines .=
( defined $myvar{'have_aria'} && $myvar{'have_aria'} eq "YES" )
? greenwrap "+Aria "
: redwrap "-Aria ";
$engines .=
( defined $myvar{'have_ndbcluster'}
&& $myvar{'have_ndbcluster'} eq "YES" )
@ -1884,6 +1893,15 @@ sub mysql_stats {
push( @generalrec,
"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 ) {
badprint "Query cache is disabled";
push( @adjvars, "query_cache_size (>= 8M)" );
@ -2338,6 +2356,19 @@ sub mariadb_threadpool {
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
sub mariadb_ariadb {
prettyprint
@ -2977,10 +3008,11 @@ security_recommendations; # Display some security recommendations
cve_recommendations; # Display related CVE
calculations; # Calculate everything we need
mysql_stats; # Print the server stats
mysql_myisam; # Print MyISAM stats
mysql_innodb; # Print InnoDB stats
mysqsl_pfs # Print Performance schema info
mariadb_threadpool; # Print MaraiDB ThreadPool stats
mysql_myisam; # Print MyISAM stats
mariadb_ariadb; # Print MaraiDB AriaDB stats
mysql_innodb; # Print InnoDB stats
mariadb_tokudb; # Print MaraiDB TokuDB stats
mariadb_galera; # Print MaraiDB Galera Cluster stats
get_replication_status; # Print replication info
@ -3001,7 +3033,7 @@ __END__
=head1 NAME
MySQLTuner 1.6.5 - MySQL High Performance Tuning Script
MySQLTuner 1.6.6 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES