Update Vulnerabilities list

Indenting mysqltuner
Update Usage information
This commit is contained in:
Jean-Marie Renouard 2022-02-07 23:34:34 +01:00
parent 2b44229a8e
commit cd30f9c852
2 changed files with 98 additions and 65 deletions

View file

@ -1,6 +1,6 @@
# NAME # NAME
MySQLTuner 1.9.0 - MySQL High Performance Tuning Script MySQLTuner 1.9.3 - MySQL High Performance Tuning Script
# IMPORTANT USAGE GUIDELINES # IMPORTANT USAGE GUIDELINES
@ -22,49 +22,51 @@ You must provide the remote server's total memory when connecting to other serve
--mysqladmin <path> Path to a custom mysqladmin executable --mysqladmin <path> Path to a custom mysqladmin executable
--mysqlcmd <path> Path to a custom mysql executable --mysqlcmd <path> Path to a custom mysql executable
--defaults-file <path> Path to a custom .my.cnf --defaults-file <path> Path to a custom .my.cnf
--server-log <path> Path to explict log file --server-log <path> Path to explict log file (error_log)
# PERFORMANCE AND REPORTING OPTIONS # PERFORMANCE AND REPORTING OPTIONS
--skipsize Don't enumerate tables and their types/sizes (default: on) --skipsize Don't enumerate tables and their types/sizes (default: on)
(Recommended for servers with many tables) (Recommended for servers with many tables)
--json Print result as JSON string
--prettyjson Print result as JSON formatted string
--skippassword Don't perform checks on user passwords(default: off) --skippassword Don't perform checks on user passwords(default: off)
--checkversion Check for updates to MySQLTuner (default: don't check) --checkversion Check for updates to MySQLTuner (default: don't check)
--updateversion Check for updates to MySQLTuner and update when newer version is available (default: don't check) --updateversion Check for updates to MySQLTuner and update when newer version is available (default: don't check)
--forcemem <size> Amount of RAM installed in megabytes --forcemem <size> Amount of RAM installed in megabytes
--forceswap <size> Amount of swap memory configured in megabytes --forceswap <size> Amount of swap memory configured in megabytes
--passwordfile <path> Path to a password file list(one password by line) --passwordfile <path> Path to a password file list(one password by line)
--cvefile <path> CVE File for vulnerability checks
--outputfile <path> Path to a output txt file
--reportfile <path> Path to a report txt file
--template <path> Path to a template file
# OUTPUT OPTIONS # OUTPUT OPTIONS
--silent Don't output anything on screen --silent Don't output anything on screen
--verbose Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
--nocolor Don't print output in color
--nogood Remove OK responses --nogood Remove OK responses
--nobad Remove negative/suggestion responses --nobad Remove negative/suggestion responses
--noinfo Remove informational responses --noinfo Remove informational responses
--debug Print debug information --debug Print debug information
--noprocess Consider no other process is running --noprocess Consider no other process is running
--dbstat Print database information --dbstat Print database information
--nodbstat Don't Print database information --nodbstat Don't Print database information
--tbstat Print table information --tbstat Print table information
--notbstat Don't Print table information --notbstat Don't Print table information
--colstat Print column information --colstat Print column information
--nocolstat Don't Print column information --nocolstat Don't Print column information
--idxstat Print index information --idxstat Print index information
--noidxstat Don't Print index information --noidxstat Don't Print index information
--sysstat Print system information --sysstat Print system information
--nosysstat Don't Print system information --nosysstat Don't Print system information
--pfstat Print Performance schema --pfstat Print Performance schema
--nopfstat Don't Print Performance schema --nopfstat Don't Print Performance schema
--verbose Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
--bannedports Ports banned separated by comma(,) --bannedports Ports banned separated by comma(,)
--server-log Define specifi error_log to analyze
--maxportallowed Number of ports opened allowed on this hosts --maxportallowed Number of ports opened allowed on this hosts
--cvefile <path> CVE File for vulnerability checks
--nocolor Don't print output in color
--json Print result as JSON string
--buffers Print global and per-thread buffer values --buffers Print global and per-thread buffer values
--outputfile <path> Path to a output txt file
--reportfile <path> Path to a report txt file
--template <path> Path to a template file
# PERLDOC # PERLDOC

View file

@ -1,5 +1,5 @@
#!/usr/bin/env perl #!/usr/bin/env perl
# mysqltuner.pl - Version 1.9.2 # mysqltuner.pl - Version 1.9.3
# High Performance MySQL Tuning Script # High Performance MySQL Tuning Script
# Copyright (C) 2006-2022 Major Hayden - major@mhtx.net # Copyright (C) 2006-2022 Major Hayden - major@mhtx.net
# #
@ -56,7 +56,7 @@ use Cwd 'abs_path';
#use Env; #use Env;
# Set up a few variables for use in the script # Set up a few variables for use in the script
my $tunerversion = "1.9.2"; my $tunerversion = "1.9.3";
my ( @adjvars, @generalrec ); my ( @adjvars, @generalrec );
# Set defaults # Set defaults
@ -1602,20 +1602,24 @@ sub get_fs_info {
shift @iinfo; shift @iinfo;
foreach my $info (@sinfo) { foreach my $info (@sinfo) {
#exit(0); #exit(0);
if ( $info =~ /.*?(\d+)\s+(\d+)\s+(\d+)\s+(\d+)%\s+(.*)$/ ) { if ( $info =~ /.*?(\d+)\s+(\d+)\s+(\d+)\s+(\d+)%\s+(.*)$/ ) {
next if $5 =~ m{(run|dev|sys|proc|snap|init)}; next if $5 =~ m{(run|dev|sys|proc|snap|init)};
if ( $4 > 85 ) { if ( $4 > 85 ) {
badprint "mount point $5 is using $4 % total space (".human_size($2*1024)." / ". human_size($1*1024). ")"; badprint "mount point $5 is using $4 % total space ("
. human_size( $2 * 1024 ) . " / "
. human_size( $1 * 1024 ) . ")";
push( @generalrec, "Add some space to $4 mountpoint." ); push( @generalrec, "Add some space to $4 mountpoint." );
} }
else { else {
infoprint infoprint "mount point $5 is using $4 % total space ("
"mount point $5 is using $4 % total space (".human_size($2*1024)." / ". human_size($1*1024). ")"; . human_size( $2 * 1024 ) . " / "
. human_size( $1 * 1024 ) . ")";
} }
$result{'Filesystem'}{'Space Pct'}{$5} = $4; $result{'Filesystem'}{'Space Pct'}{$5} = $4;
$result{'Filesystem'}{'Used Space'}{$5} = $2; $result{'Filesystem'}{'Used Space'}{$5} = $2;
$result{'Filesystem'}{'Free Space'}{$5} = $3; $result{'Filesystem'}{'Free Space'}{$5} = $3;
$result{'Filesystem'}{'Total Space'}{$5} = $1; $result{'Filesystem'}{'Total Space'}{$5} = $1;
} }
} }
@ -3799,7 +3803,8 @@ sub mysqsl_pfs {
subheaderprint "Performance schema"; subheaderprint "Performance schema";
# Performance Schema # Performance Schema
$myvar{'performance_schema'} = 'OFF' unless defined( $myvar{'performance_schema'} ); $myvar{'performance_schema'} = 'OFF'
unless defined( $myvar{'performance_schema'} );
if ( $myvar{'performance_schema'} eq 'OFF' ) { if ( $myvar{'performance_schema'} eq 'OFF' ) {
} }
@ -3811,8 +3816,8 @@ sub mysqsl_pfs {
infoprint "Performance schema is disabled."; infoprint "Performance schema is disabled.";
badprint "Performance_schema should be activated."; badprint "Performance_schema should be activated.";
push( @adjvars, "performance_schema=ON" ); push( @adjvars, "performance_schema=ON" );
push( @generalrec, push( @generalrec,
"Performance schema should be activated for better diagnostics" ); "Performance schema should be activated for better diagnostics" );
} }
if ( $myvar{'performance_schema'} eq 'ON' ) { if ( $myvar{'performance_schema'} eq 'ON' ) {
@ -3820,16 +3825,16 @@ sub mysqsl_pfs {
debugprint "Performance schema is " . $myvar{'performance_schema'}; debugprint "Performance schema is " . $myvar{'performance_schema'};
infoprint "Memory used by P_S: " . hr_bytes( get_pf_memory() ); infoprint "Memory used by P_S: " . hr_bytes( get_pf_memory() );
if ( mysql_version_le( 5, 5 ) ) { if ( mysql_version_le( 5, 5 ) ) {
push( @generalrec, push( @generalrec,
"Performance schema shouldn't be activated for MySQL and MariaDB 5.5 and lower version" "Performance schema shouldn't be activated for MySQL and MariaDB 5.5 and lower version"
); );
push( @adjvars, "performance_schema = OFF disable PFS" ); push( @adjvars, "performance_schema = OFF disable PFS" );
} }
if ( mysql_version_eq( 10, 0 ) ) { if ( mysql_version_eq( 10, 0 ) ) {
push( @generalrec, push( @generalrec,
"Performance schema shouldn't be activated for MariaDB 10.0 for performance issue" "Performance schema shouldn't be activated for MariaDB 10.0 for performance issue"
); );
push( @adjvars, "performance_schema = OFF" ); push( @adjvars, "performance_schema = OFF" );
return; return;
} }
@ -6064,8 +6069,20 @@ sub mysql_innodb {
} }
# InnoDB Log Waits # InnoDB Log Waits
if ( defined $mystat{'Innodb_log_waits'} my $mystat{'Innodb_log_waits_computed'} = 0;
&& $mystat{'Innodb_log_waits'} > 0 )
if ( defined( $mystat{'Innodb_log_waits'} )
and defined( $mystat{'Innodb_log_writes'} ) )
{
$mystat{'Innodb_log_waits_computed'} =
$mystat{'Innodb_log_waits'} / $mystat{'Innodb_log_writes'};
}
else {
undef $mystat{'Innodb_log_waits_computed'};
}
if ( defined $mystat{'Innodb_log_waits_computed'}
&& $mystat{'Innodb_log_waits_computed'} > 0.000001 )
{ {
badprint "InnoDB log waits: " badprint "InnoDB log waits: "
. percentage( $mystat{'Innodb_log_waits'}, . percentage( $mystat{'Innodb_log_waits'},
@ -6132,28 +6149,33 @@ sub mysql_databases {
); );
infoprint "All User Databases:"; infoprint "All User Databases:";
infoprint " +-- TABLE : " infoprint " +-- TABLE : "
. select_one( "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='BASE TABLE' AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )" ) . select_one(
. ""; "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='BASE TABLE' AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )"
) . "";
infoprint " +-- VIEW : " infoprint " +-- VIEW : "
. select_one( "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='VIEW' AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )" ) . select_one(
. ""; "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='VIEW' AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )"
) . "";
infoprint " +-- INDEX : " infoprint " +-- INDEX : "
. select_one( "SELECT count(distinct(concat(TABLE_NAME, TABLE_SCHEMA, INDEX_NAME))) from information_schema.STATISTICS WHERE TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )" ) . select_one(
. ""; "SELECT count(distinct(concat(TABLE_NAME, TABLE_SCHEMA, INDEX_NAME))) from information_schema.STATISTICS WHERE TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )"
) . "";
infoprint " +-- CHARS : " infoprint " +-- CHARS : "
. ( $totaldbinfo[5] eq 'NULL' ? 0 : $totaldbinfo[5] ) . " (" . ( $totaldbinfo[5] eq 'NULL' ? 0 : $totaldbinfo[5] ) . " ("
. ( . (
join ", ", join ", ",
select_array( select_array(
"select distinct(CHARACTER_SET_NAME) from information_schema.columns WHERE CHARACTER_SET_NAME IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );") "select distinct(CHARACTER_SET_NAME) from information_schema.columns WHERE CHARACTER_SET_NAME IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );"
)
) . ")"; ) . ")";
infoprint " +-- COLLA : " infoprint " +-- COLLA : "
. ( $totaldbinfo[5] eq 'NULL' ? 0 : $totaldbinfo[5] ) . " (" . ( $totaldbinfo[5] eq 'NULL' ? 0 : $totaldbinfo[5] ) . " ("
. ( . (
join ", ", join ", ",
select_array( select_array(
"SELECT DISTINCT(TABLE_COLLATION) FROM information_schema.TABLES WHERE TABLE_COLLATION IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );") "SELECT DISTINCT(TABLE_COLLATION) FROM information_schema.TABLES WHERE TABLE_COLLATION IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );"
)
) . ")"; ) . ")";
infoprint " +-- ROWS : " infoprint " +-- ROWS : "
. ( $totaldbinfo[0] eq 'NULL' ? 0 : $totaldbinfo[0] ) . ""; . ( $totaldbinfo[0] eq 'NULL' ? 0 : $totaldbinfo[0] ) . "";
@ -6168,7 +6190,9 @@ sub mysql_databases {
. ( $totaldbinfo[6] eq 'NULL' ? 0 : $totaldbinfo[6] ) . " (" . ( $totaldbinfo[6] eq 'NULL' ? 0 : $totaldbinfo[6] ) . " ("
. ( . (
join ", ", join ", ",
select_array("SELECT DISTINCT(ENGINE) FROM information_schema.TABLES WHERE ENGINE IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );") select_array(
"SELECT DISTINCT(ENGINE) FROM information_schema.TABLES WHERE ENGINE IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );"
)
) . ")"; ) . ")";
$result{'Databases'}{'All databases'}{'Rows'} = $result{'Databases'}{'All databases'}{'Rows'} =
@ -6190,21 +6214,26 @@ sub mysql_databases {
next unless defined $dbinfo[0]; next unless defined $dbinfo[0];
infoprint "Database: " . $dbinfo[0] . ""; infoprint "Database: " . $dbinfo[0] . "";
infoprint " +-- TABLE : " infoprint " +-- TABLE : "
. select_one( "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='BASE TABLE' AND TABLE_SCHEMA='$_'" ) . select_one(
. ""; "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='BASE TABLE' AND TABLE_SCHEMA='$_'"
) . "";
infoprint " +-- VIEW : " infoprint " +-- VIEW : "
. select_one( "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='VIEW' AND TABLE_SCHEMA='$_'" ) . select_one(
. ""; "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='VIEW' AND TABLE_SCHEMA='$_'"
) . "";
infoprint " +-- INDEX : " infoprint " +-- INDEX : "
. select_one( "SELECT count(distinct(concat(TABLE_NAME, TABLE_SCHEMA, INDEX_NAME))) from information_schema.STATISTICS WHERE TABLE_SCHEMA='$_'" ) . select_one(
. ""; "SELECT count(distinct(concat(TABLE_NAME, TABLE_SCHEMA, INDEX_NAME))) from information_schema.STATISTICS WHERE TABLE_SCHEMA='$_'"
infoprint " +-- CHARS : " ) . "";
. ( $totaldbinfo[5] eq 'NULL' ? 0 : $totaldbinfo[5] ) . " (" infoprint " +-- CHARS : "
. ( . ( $totaldbinfo[5] eq 'NULL' ? 0 : $totaldbinfo[5] ) . " ("
join ", ", . (
select_array( join ", ",
"select distinct(CHARACTER_SET_NAME) from information_schema.columns WHERE CHARACTER_SET_NAME IS NOT NULL AND TABLE_SCHEMA='$_';") select_array(
) . ")";infoprint " +-- COLLA : " "select distinct(CHARACTER_SET_NAME) from information_schema.columns WHERE CHARACTER_SET_NAME IS NOT NULL AND TABLE_SCHEMA='$_';"
)
) . ")";
infoprint " +-- COLLA : "
. ( $dbinfo[7] eq 'NULL' ? 0 : $dbinfo[7] ) . " (" . ( $dbinfo[7] eq 'NULL' ? 0 : $dbinfo[7] ) . " ("
. ( . (
join ", ", join ", ",
@ -6821,7 +6850,7 @@ __END__
=head1 NAME =head1 NAME
MySQLTuner 1.9.2 - MySQL High Performance Tuning Script MySQLTuner 1.9.3 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES =head1 IMPORTANT USAGE GUIDELINES
@ -6843,49 +6872,51 @@ You must provide the remote server's total memory when connecting to other serve
--mysqladmin <path> Path to a custom mysqladmin executable --mysqladmin <path> Path to a custom mysqladmin executable
--mysqlcmd <path> Path to a custom mysql executable --mysqlcmd <path> Path to a custom mysql executable
--defaults-file <path> Path to a custom .my.cnf --defaults-file <path> Path to a custom .my.cnf
--server-log <path> Path to explict log file --server-log <path> Path to explict log file (error_log)
=head1 PERFORMANCE AND REPORTING OPTIONS =head1 PERFORMANCE AND REPORTING OPTIONS
--skipsize Don't enumerate tables and their types/sizes (default: on) --skipsize Don't enumerate tables and their types/sizes (default: on)
(Recommended for servers with many tables) (Recommended for servers with many tables)
--json Print result as JSON string
--prettyjson Print result as JSON formatted string
--skippassword Don't perform checks on user passwords(default: off) --skippassword Don't perform checks on user passwords(default: off)
--checkversion Check for updates to MySQLTuner (default: don't check) --checkversion Check for updates to MySQLTuner (default: don't check)
--updateversion Check for updates to MySQLTuner and update when newer version is available (default: don't check) --updateversion Check for updates to MySQLTuner and update when newer version is available (default: don't check)
--forcemem <size> Amount of RAM installed in megabytes --forcemem <size> Amount of RAM installed in megabytes
--forceswap <size> Amount of swap memory configured in megabytes --forceswap <size> Amount of swap memory configured in megabytes
--passwordfile <path> Path to a password file list(one password by line) --passwordfile <path> Path to a password file list(one password by line)
--cvefile <path> CVE File for vulnerability checks
--outputfile <path> Path to a output txt file
--reportfile <path> Path to a report txt file
--template <path> Path to a template file
=head1 OUTPUT OPTIONS =head1 OUTPUT OPTIONS
--silent Don't output anything on screen --silent Don't output anything on screen
--verbose Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
--nocolor Don't print output in color
--nogood Remove OK responses --nogood Remove OK responses
--nobad Remove negative/suggestion responses --nobad Remove negative/suggestion responses
--noinfo Remove informational responses --noinfo Remove informational responses
--debug Print debug information --debug Print debug information
--noprocess Consider no other process is running --noprocess Consider no other process is running
--dbstat Print database information --dbstat Print database information
--nodbstat Don't Print database information --nodbstat Don't Print database information
--tbstat Print table information --tbstat Print table information
--notbstat Don't Print table information --notbstat Don't Print table information
--colstat Print column information --colstat Print column information
--nocolstat Don't Print column information --nocolstat Don't Print column information
--idxstat Print index information --idxstat Print index information
--noidxstat Don't Print index information --noidxstat Don't Print index information
--sysstat Print system information --sysstat Print system information
--nosysstat Don't Print system information --nosysstat Don't Print system information
--pfstat Print Performance schema --pfstat Print Performance schema
--nopfstat Don't Print Performance schema --nopfstat Don't Print Performance schema
--verbose Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
--bannedports Ports banned separated by comma(,) --bannedports Ports banned separated by comma(,)
--server-log Define specifi error_log to analyze
--maxportallowed Number of ports opened allowed on this hosts --maxportallowed Number of ports opened allowed on this hosts
--cvefile <path> CVE File for vulnerability checks
--nocolor Don't print output in color
--json Print result as JSON string
--buffers Print global and per-thread buffer values --buffers Print global and per-thread buffer values
--outputfile <path> Path to a output txt file
--reportfile <path> Path to a report txt file
--template <path> Path to a template file
=head1 PERLDOC =head1 PERLDOC