11# !/usr/bin/env perl
22# mysqltuner.pl - Version 1.7.1
33# High Performance MySQL Tuning Script
4- # Copyright (C) 2006-2016 Major Hayden - major@mhtx.net
4+ # Copyright (C) 2006-2017 Major Hayden - major@mhtx.net
55#
66# For the latest updates, please visit http://mysqltuner.com/
77# Git repository available at http://github.com/major/MySQLTuner-perl
@@ -537,16 +537,15 @@ sub validate_tuner_version {
537537 }
538538
539539 my $update ;
540- my $url =
541- " https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl" ;
540+ my $url = " https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl" ;
542541 my $httpcli = get_http_cli();
543542 if ( $httpcli =~ / curl$ / ) {
544543 debugprint " $httpcli is available." ;
545544
546545 debugprint
547- " $httpcli --connect-timeout 5 -silent '$url ' 2>/dev/null | grep 'my \$ tunerversion'| cut -d\\\" -f2" ;
546+ " $httpcli -m 3 -silent '$url ' 2>/dev/null | grep 'my \$ tunerversion'| cut -d\\\" -f2" ;
548547 $update =
549- ` $httpcli --connect-timeout 5 -silent '$url ' 2>/dev/null | grep 'my \$ tunerversion'| cut -d\\\" -f2` ;
548+ ` $httpcli -m 3 -silent '$url ' 2>/dev/null | grep 'my \$ tunerversion'| cut -d\\\" -f2` ;
550549 chomp ($update );
551550 debugprint " VERSION: $update " ;
552551
@@ -558,9 +557,9 @@ sub validate_tuner_version {
558557 debugprint " $httpcli is available." ;
559558
560559 debugprint
561- " $httpcli -e timestamping=off -t 1 -T 5 -O - '$url ' 2>$devnull | grep 'my \$ tunerversion'| cut -d\\\" -f2" ;
560+ " $httpcli -e timestamping=off -t 1 -T 3 -O - '$url ' 2>$devnull | grep 'my \$ tunerversion'| cut -d\\\" -f2" ;
562561 $update =
563- ` $httpcli -e timestamping=off -t 1 -T 5 -O - '$url ' 2>$devnull | grep 'my \$ tunerversion'| cut -d\\\" -f2` ;
562+ ` $httpcli -e timestamping=off -t 1 -T 3 -O - '$url ' 2>$devnull | grep 'my \$ tunerversion'| cut -d\\\" -f2` ;
564563 chomp ($update );
565564 compare_tuner_version($update );
566565 return ;
@@ -580,7 +579,6 @@ sub update_tuner_version {
580579 return ;
581580 }
582581
583- # use Cwd;
584582 my $update ;
585583 my $url = " https://raw.githubusercontent.com/major/MySQLTuner-perl/master/" ;
586584 my @scripts =
@@ -595,9 +593,9 @@ sub update_tuner_version {
595593 debugprint " $httpcli is available." ;
596594
597595 debugprint
598- " $httpcli --connect-timeout 5 '$url$script ' 2>$devnull > $script " ;
596+ " $httpcli --connect-timeout 3 '$url$script ' 2>$devnull > $script " ;
599597 $update =
600- ` $httpcli --connect-timeout 5 '$url$script ' 2>$devnull > $script ` ;
598+ ` $httpcli --connect-timeout 3 '$url$script ' 2>$devnull > $script ` ;
601599 chomp ($update );
602600 debugprint " $script updated: $update " ;
603601
@@ -614,9 +612,9 @@ sub update_tuner_version {
614612 debugprint " $httpcli is available." ;
615613
616614 debugprint
617- " $httpcli -qe timestamping=off -T 5 -O $script '$url$script '" ;
615+ " $httpcli -qe timestamping=off -t 1 -T 3 -O $script '$url$script '" ;
618616 $update =
619- ` $httpcli -qe timestamping=off -T 5 -O $script '$url$script '` ;
617+ ` $httpcli -qe timestamping=off -t 1 -T 3 -O $script '$url$script '` ;
620618 chomp ($update );
621619
622620 if ( -s $script eq 0 ) {
@@ -651,7 +649,7 @@ sub compare_tuner_version {
651649 # exit 0;
652650 if ( $remoteversion ne $tunerversion ) {
653651 badprint
654- " There is a new version of MySQLTuner available ($remoteversion )" ;
652+ " There is a new version of MySQLTuner available($remoteversion )" ;
655653 update_tuner_version();
656654 return ;
657655 }
@@ -1170,7 +1168,7 @@ sub log_file_recommandations {
11701168 badprint " Log file $myvar {'log_error'} is bigger than 32 Mb" ;
11711169 push @generalrec ,
11721170 $myvar {' log_error' }
1173- . " is > 32Mb, you should analyze why or implement a rotation log strategy such as logrotate!" ;
1171+ . " is > 32Mb, you should analyze why or implement a rotation log strategy such as logrotate!" ;
11741172 }
11751173
11761174 my @log_content = get_file_contents( $myvar {' log_error' } );
@@ -1541,11 +1539,11 @@ sub get_system_info {
15411539
15421540 my $ext_ip = " " ;
15431541 if ( $httpcli =~ / curl$ / ) {
1544- $ext_ip = infocmd_one " $httpcli ipecho.net/plain" ;
1542+ $ext_ip = infocmd_one " $httpcli -m 3 ipecho.net/plain" ;
15451543 }
15461544 elsif ( $httpcli =~ / wget$ / ) {
15471545
1548- $ext_ip = infocmd_one " $httpcli -q -O - ipecho.net/plain" ;
1546+ $ext_ip = infocmd_one " $httpcli -t 1 -T 3 - q -O - ipecho.net/plain" ;
15491547 }
15501548 infoprint " External IP : " . $ext_ip ;
15511549 $result {' Network' }{' External Ip' } = $ext_ip ;
@@ -2149,7 +2147,7 @@ sub check_storage_engines {
21492147 $data_free = $data_free / 1024 / 1024;
21502148 $total_free += $data_free ;
21512149 push ( @generalrec ,
2152- " OPTIMIZE TABLE $table_name ; -- can free $data_free MB" );
2150+ " OPTIMIZE TABLE ` $table_name ` ; -- can free $data_free MB" );
21532151 }
21542152 push ( @generalrec ,
21552153 " Total freed space after theses OPTIMIZE TABLE : $total_free Mb" );
0 commit comments