Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrenouard committed Apr 12, 2023
2 parents 8e6b61e + af67fe8 commit 29ad424
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions mysqltuner.pl
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ package main;
# Setting up the colors for the print styles
my $me = `whoami`;
$me =~ s/\n//g;

# Setting up the colors for the print styles
my $good = ( $opt{nocolor} == 0 ) ? "[\e[0;32mOK\e[0m]" : "[OK]";
my $bad = ( $opt{nocolor} == 0 ) ? "[\e[0;31m!!\e[0m]" : "[!!]";
my $info = ( $opt{nocolor} == 0 ) ? "[\e[0;34m--\e[0m]" : "[--]";
Expand Down Expand Up @@ -1420,13 +1418,13 @@ sub log_file_recommendations {
if ( $size > 0 ) {
goodprint "Log file $myvar{'log_error'} is not empty";
if ( $size < 32 * 1024 * 1024 ) {
goodprint "Log file $myvar{'log_error'} is smaller than 32 Mb";
goodprint "Log file $myvar{'log_error'} is smaller than 32 MB";
}
else {
badprint "Log file $myvar{'log_error'} is bigger than 32 Mb";
badprint "Log file $myvar{'log_error'} is bigger than 32 MB";
push @generalrec,
$myvar{'log_error'}
. " is > 32Mb, you should analyze why or implement a rotation log strategy such as logrotate!";
. " is > 32MB, you should analyze why or implement a rotation log strategy such as logrotate!";
}
}
else {
Expand Down Expand Up @@ -1850,14 +1848,14 @@ sub get_system_info {
infoprint "External IP : " . $ext_ip;
$result{'Network'}{'External Ip'} = $ext_ip;
badprint
"External IP : Can't check because of Internet connectivity"
"External IP : Can't check, no Internet connectivity"
unless defined($httpcli);
infoprint "Name Servers : "
. infocmd_one "grep 'nameserver' /etc/resolv.conf \| awk '{print \$2}'";
infoprint "Logged In users : ";
infocmd_tab "who";
$result{'OS'}{'Logged users'} = `who`;
infoprint "Ram Usages in Mb : ";
infoprint "Ram Usages in MB : ";
infocmd_tab "free -m | grep -v +";
$result{'OS'}{'Free Memory RAM'} = `free -m | grep -v +`;
infoprint "Load Average : ";
Expand Down Expand Up @@ -1917,7 +1915,7 @@ sub system_recommendations {
. $opt{'maxportallowed'}
. "allowed.";
push( @generalrec,
"Consider dedicating a server for your database installation with less services running on !"
"Consider dedicating a server for your database installation with fewer services running on it!"
);
}
else {
Expand All @@ -1931,7 +1929,7 @@ sub system_recommendations {
if ( is_open_port($banport) ) {
badprint "Banned port: $banport is opened..";
push( @generalrec,
"Port $banport is opened. Consider stopping program handling this port."
"Port $banport is opened. Consider stopping the program over this port."
);
}
else {
Expand All @@ -1949,7 +1947,7 @@ sub security_recommendations {
subheaderprint "Security Recommendations";

if ( mysql_version_eq(8) ) {
infoprint "Skipped due to unsupported feature for MySQL 8";
infoprint "Skipped due to unsupported feature for MySQL 8.0+";
return;
}

Expand Down Expand Up @@ -2011,7 +2009,7 @@ sub security_recommendations {
#exit 0;
if (@mysqlstatlist) {
push( @generalrec,
"Remove Anonymous User accounts - there are "
"Remove Anonymous User accounts: there are "
. scalar(@mysqlstatlist)
. " anonymous accounts." );
foreach my $line ( sort @mysqlstatlist ) {
Expand Down Expand Up @@ -2254,6 +2252,8 @@ sub validate_mysql_version {
$mysqlverminor ||= 0;
$mysqlvermicro ||= 0;

prettyprint " ";

if ( mysql_version_eq(8)
or mysql_version_eq( 5, 7 )
or mysql_version_eq( 10, 3 )
Expand Down Expand Up @@ -2547,23 +2547,23 @@ sub check_storage_engines {
&& defined $myvar{'have_innodb'}
&& $myvar{'have_innodb'} eq "YES" )
{
badprint "InnoDB is enabled but isn't being used";
badprint "InnoDB is enabled, but isn't being used";
push( @generalrec,
"Add skip-innodb to MySQL configuration to disable InnoDB" );
}
if ( !defined $enginestats{'BerkeleyDB'}
&& defined $myvar{'have_bdb'}
&& $myvar{'have_bdb'} eq "YES" )
{
badprint "BDB is enabled but isn't being used";
badprint "BDB is enabled, but isn't being used";
push( @generalrec,
"Add skip-bdb to MySQL configuration to disable BDB" );
}
if ( !defined $enginestats{'ISAM'}
&& defined $myvar{'have_isam'}
&& $myvar{'have_isam'} eq "YES" )
{
badprint "MyISAM is enabled but isn't being used";
badprint "MyISAM is enabled, but isn't being used";
push( @generalrec,
"Add skip-isam to MySQL configuration to disable MyISAM (MySQL > 4.1.0)"
);
Expand Down Expand Up @@ -2592,7 +2592,7 @@ sub check_storage_engines {
push @generalrec, $generalrec;
}
push @generalrec,
"Total freed space after defragmentation : $total_free MiB";
"Total freed space after defragmentation: $total_free MiB";
}
else {
goodprint "Total fragmented tables: $fragtables";
Expand Down

0 comments on commit 29ad424

Please sign in to comment.