EOF
) > ${REPORT_NAME}
perl ${_DIR}/txt2Html.pl - mysqltuner_${server}.txt >> ${REPORT_NAME}
(
cat << 'EOF'
EOF
) >> ${REPORT_NAME}
perl ${_DIR}/txt2Html.pl \# pt-summary_${server}.txt >> ${REPORT_NAME}
(
cat << 'EOF'
EOF
) >> ${REPORT_NAME}
perl ${_DIR}/txt2Html.pl \# pt-mysql-summary_${server}.txt >> ${REPORT_NAME}
(
cat << 'EOF'
EOF
) >> ${REPORT_NAME}
cat innotop_${server}.txt >> ${REPORT_NAME}
(
cat << 'EOF'
";
my $i=1;
while (my $row = <$fh>) {
chomp $row;
if ($row =~ /^$headerSep/) {
print "\n";
$row =~ s/$headerSep//g;
print "";
$i++;
next;
}
print "$row\n" unless $row =~ /^\s*$/;
}
print "\n";
close $fh;
MySQLTuner-perl-1.7.17/build/updateCVElist.pl 0000664 0000000 0000000 00000005437 13544753346 0020731 0 ustar 00root root 0000000 0000000 #!/usr/bin/perl
use warnings;
use strict;
use WWW::Mechanize::GZip;
use File::Util;
use Data::Dumper;
use List::MoreUtils qw(uniq);
my $verbose=1;
sub AUTOLOAD {
use vars qw($AUTOLOAD);
my $cmd = $AUTOLOAD;
$cmd=~s/.*:://;
print "\n","*" x 60, "\n* Catching system call : $cmd \n", "*"x60 if defined $verbose;
print "\nExecution : \t", $cmd, " ", join " ", @_ if defined $verbose;
my $outp=`$cmd @_ 2>&1`;
my $rc=$?;
print "\nResult : \t$outp", if defined $verbose;
print "Code : \t", $rc, "\n" if defined $verbose;
return $rc;
}
my $mech = WWW::Mechanize->new();
$mech->agent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0');
#$mech->proxy( ['http'], 'http://XXX.XXX.XXX.XXX:3128' );
#$mech->proxy( ['https'], 'http://XXX.XXX.XXX.XXX:3128' );
$mech->env_proxy;
$mech->ssl_opts( 'verify_hostname' => 0 );
$mech->requests_redirectable(['GET', 'POST', 'HEAD']);
$mech->add_handler("request_send", sub { print '#'x80,"\nSEND REQUEST:\n"; shift->dump; print '#'x80,"\n";return } ) if defined $verbose;
$mech->add_handler("response_done", sub { print '#'x80,"\nDONE RESPONSE:\n"; shift->dump; print '#'x80,"\n"; return }) if defined $verbose;
$mech->add_handler("response_redirect" => sub { print '#'x80,"\nREDIRECT RESPONSE:\n"; shift->dump; print '#'x80,"\n"; return }) if defined $verbose;
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" );
}
my $f=File::Util->new( readlimit => 152428800);
File::Util->flock_rules( qw/ IGNORE/ );
my @versions;
my $temp;
unlink '../vulnerabilities.csv' if -f '../vulnerabilities.csv';
open(CVE, 'cve.csv') or die("Could not open file.");
foreach my $line (
{$data}
END_TEMPLATE
}
sub dump_result {
debugprint Dumper( \%result ) if ( $opt{'debug'} );
debugprint "HTML REPORT: $opt{'reportfile'}";
if ( $opt{'reportfile'} ne 0 ) {
eval { require Text::Template };
eval { require JSON };
if ($@) {
badprint "Text::Template Module is needed.";
die "Text::Template Module is needed.";
}
my $json = JSON->new->allow_nonref;
my $json_text = $json->pretty->encode( \%result );
my %vars = (
'data' => \%result,
'debug' => $json_text,
);
my $template;
{
no warnings 'once';
$template = Text::Template->new(
TYPE => 'STRING',
PREPEND => q{;},
SOURCE => $templateModel,
DELIMITERS => [ '[%', '%]' ]
) or die "Couldn't construct template: $Text::Template::ERROR";
}
open my $fh, q(>), $opt{'reportfile'}
or die
"Unable to open $opt{'reportfile'} in write mode. please check permissions for this file or directory";
$template->fill_in( HASH => \%vars, OUTPUT => $fh );
close $fh;
}
if ( $opt{'json'} ne 0 ) {
eval { require JSON };
if ($@) {
print "$bad JSON Module is needed.\n";
return 1;
}
my $json = JSON->new->allow_nonref;
print $json->utf8(1)->pretty( ( $opt{'prettyjson'} ? 1 : 0 ) )
->encode( \%result );
if ( $opt{'outputfile'} ne 0 ) {
unlink $opt{'outputfile'} if ( -e $opt{'outputfile'} );
open my $fh, q(>), $opt{'outputfile'}
or die
"Unable to open $opt{'outputfile'} in write mode. please check permissions for this file or directory";
print $fh $json->utf8(1)->pretty( ( $opt{'prettyjson'} ? 1 : 0 ) )
->encode( \%result );
close $fh;
}
}
}
sub which {
my $prog_name = shift;
my $path_string = shift;
my @path_array = split /:/, $ENV{'PATH'};
for my $path (@path_array) {
return "$path/$prog_name" if ( -x "$path/$prog_name" );
}
return 0;
}
# ---------------------------------------------------------------------------
# BEGIN 'MAIN'
# ---------------------------------------------------------------------------
headerprint; # Header Print
validate_tuner_version; # Check last version
mysql_setup; # Gotta login first
debugprint "MySQL FINAL Client : $mysqlcmd $mysqllogin";
debugprint "MySQL Admin FINAL Client : $mysqladmincmd $mysqllogin";
#exit(0);
os_setup; # Set up some OS variables
get_all_vars; # Toss variables/status into hashes
get_tuning_info; # Get information about the tuning connexion
validate_mysql_version; # Check current MySQL version
check_architecture; # Suggest 64-bit upgrade
system_recommendations; # avoid to many service on the same host
log_file_recommendations; # check log file content
check_storage_engines; # Show enabled storage engines
check_metadata_perf; # Show parameter impacting performance during analysis
mysql_databases; # Show informations about databases
mysql_tables; # Show informations about table column
mysql_indexes; # Show informations about indexes
security_recommendations; # Display some security recommendations
cve_recommendations; # Display related CVE
calculations; # Calculate everything we need
mysql_stats; # Print the server stats
mysqsl_pfs; # Print Performance schema info
mariadb_threadpool; # Print MariaDB ThreadPool stats
mysql_myisam; # Print MyISAM stats
mysql_innodb; # Print InnoDB stats
mariadb_ariadb; # Print MariaDB AriaDB stats
mariadb_tokudb; # Print MariaDB Tokudb stats
mariadb_xtradb; # Print MariaDB XtraDB stats
#mariadb_rockdb; # Print MariaDB RockDB stats
#mariadb_spider; # Print MariaDB Spider stats
#mariadb_connect; # Print MariaDB Connect stats
mariadb_galera; # Print MariaDB Galera Cluster stats
get_replication_status; # Print replication info
make_recommendations; # Make recommendations based on stats
dump_result; # Dump result if debug is on
close_outputfile; # Close reportfile if needed
# ---------------------------------------------------------------------------
# END 'MAIN'
# ---------------------------------------------------------------------------
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
MySQLTuner 1.7.17 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES
To run the script with the default options, run the script without arguments
Allow MySQL server to run for at least 24-48 hours before trusting suggestions
Some routines may require root level privileges (script will provide warnings)
You must provide the remote server's total memory when connecting to other servers
=head1 CONNECTION AND AUTHENTICATION
--host