minor addition for sys schema #193

This commit is contained in:
root 2016-04-21 23:16:35 +02:00
parent 560b45894b
commit c59a852a03

View file

@ -197,8 +197,7 @@ if ( $opt{verbose} ) {
} }
# for RPM distributions # for RPM distributions
$opt{cvefile} = "/usr/share/mysqltuner/vulnerabilities.csv" $opt{cvefile} = "/usr/share/mysqltuner/vulnerabilities.csv" unless ( defined $opt{cvefile} and -f "$opt{cvefile}" );
unless ( defined $opt{cvefile} and -f "$opt{cvefile}" );
$opt{cvefile} = '' unless -f "$opt{cvefile}"; $opt{cvefile} = '' unless -f "$opt{cvefile}";
$opt{cvefile} = './vulnerabilities.csv' if -f './vulnerabilities.csv'; $opt{cvefile} = './vulnerabilities.csv' if -f './vulnerabilities.csv';
@ -264,16 +263,10 @@ sub subheaderprint {
my $ln = length("@_") + 2; my $ln = length("@_") + 2;
prettyprint " "; prettyprint " ";
#prettyprint "-"x$tln;
prettyprint "-" x $sln . " @_ " . "-" x ( $tln - $ln - $sln ); prettyprint "-" x $sln . " @_ " . "-" x ( $tln - $ln - $sln );
#prettyprint "-"x$tln;
} }
sub infoprinthcmd { sub infoprinthcmd {
# print Dumper @_;
subheaderprint "$_[0]"; subheaderprint "$_[0]";
infoprintcmd "$_[1]"; infoprintcmd "$_[1]";
} }
@ -367,8 +360,7 @@ my ( $physical_memory, $swap_memory, $duflags );
sub os_setup { sub os_setup {
sub memerror { sub memerror {
badprint badprint "Unable to determine total memory/swap; use '--forcemem' and '--forceswap'";
"Unable to determine total memory/swap; use '--forcemem' and '--forceswap'";
exit 1; exit 1;
} }
my $os = `uname`; my $os = `uname`;
@ -454,7 +446,8 @@ sub os_setup {
$result{'OS'}{'Physical Memory'}{'pretty'} = hr_bytes($physical_memory); $result{'OS'}{'Physical Memory'}{'pretty'} = hr_bytes($physical_memory);
$result{'OS'}{'Swap Memory'}{'bytes'} = $swap_memory; $result{'OS'}{'Swap Memory'}{'bytes'} = $swap_memory;
$result{'OS'}{'Swap Memory'}{'pretty'} = hr_bytes($swap_memory); $result{'OS'}{'Swap Memory'}{'pretty'} = hr_bytes($swap_memory);
$result{'OS'}{'Other Processes'}{'bytes'} = get_other_process_memory();
$result{'OS'}{'Other Processes'}{'pretty'} = hr_bytes(get_other_process_memory());
} }
sub get_http_cli { sub get_http_cli {
@ -798,24 +791,20 @@ sub mysql_setup {
} }
} }
else { else {
# It's not Plesk or debian, we should try a login # It's not Plesk or debian, we should try a login
debugprint "$mysqladmincmd $remotestring ping 2>&1"; debugprint "$mysqladmincmd $remotestring ping 2>&1";
my $loginstatus = `$mysqladmincmd $remotestring ping 2>&1`; my $loginstatus = `$mysqladmincmd $remotestring ping 2>&1`;
if ( $loginstatus =~ /mysqld is alive/ ) { if ( $loginstatus =~ /mysqld is alive/ ) {
# Login went just fine # Login went just fine
$mysqllogin = " $remotestring "; $mysqllogin = " $remotestring ";
# Did this go well because of a .my.cnf file or is there no password set?
# Did this go well because of a .my.cnf file or is there no password set?
my $userpath = `printenv HOME`; my $userpath = `printenv HOME`;
if ( length($userpath) > 0 ) { if ( length($userpath) > 0 ) {
chomp($userpath); chomp($userpath);
} }
unless ( -e "${userpath}/.my.cnf" or -e "${userpath}/.mylogin.cnf" ) unless ( -e "${userpath}/.my.cnf" or -e "${userpath}/.mylogin.cnf" )
{ {
badprint badprint "Successfully authenticated with no password - SECURITY RISK!";
"Successfully authenticated with no password - SECURITY RISK!";
} }
return 1; return 1;
} }
@ -956,7 +945,6 @@ sub arr2hash {
} }
sub get_all_vars { sub get_all_vars {
# We need to initiate at least one query so that our data is useable # We need to initiate at least one query so that our data is useable
$dummyselect = select_one "SELECT VERSION()"; $dummyselect = select_one "SELECT VERSION()";
debugprint "VERSION: " . $dummyselect . ""; debugprint "VERSION: " . $dummyselect . "";
@ -1054,18 +1042,20 @@ sub cve_recommendations {
return; return;
} }
#prettyprint "Look for related CVE for $myvar{'version'} or lower in $opt{cvefile}"; #prettyprint "Look for related CVE for $myvar{'version'} or lower in $opt{cvefile}";
my $cvefound = 0; my $cvefound = 0;
open( FH, "<$opt{cvefile}" ) or die "Can't open $opt{cvefile} for read: $!"; open( FH, "<$opt{cvefile}" ) or die "Can't open $opt{cvefile} for read: $!";
while ( my $cveline = <FH> ) { while ( my $cveline = <FH> ) {
my @cve = split( ';', $cveline ); my @cve = split( ';', $cveline );
if ( mysql_micro_version_le( $cve[1], $cve[2], $cve[3] ) ) { if ( mysql_micro_version_le( $cve[1], $cve[2], $cve[3] ) ) {
badprint "$cve[4] : $cve[5]"; badprint "$cve[4] : $cve[5]";
$result{'CVE'}{'List'}{$cvefound}="$cve[4] : $cve[5]";
$cvefound++; $cvefound++;
} }
} }
close FH or die "Cannot close $opt{cvefile}: $!"; close FH or die "Cannot close $opt{cvefile}: $!";
$result{'CVE'}{'nb'}=$cvefound;
if ( $cvefound == 0 ) { if ( $cvefound == 0 ) {
goodprint "NO SECURITY CVE FOUND FOR YOUR VERSION"; goodprint "NO SECURITY CVE FOUND FOR YOUR VERSION";
return; return;
@ -3027,11 +3017,19 @@ sub mysqsl_pfs {
and $myvar{'performance_schema'} eq 'ON' ) and $myvar{'performance_schema'} eq 'ON' )
{ {
infoprint "Performance schema is disabled."; infoprint "Performance schema is disabled.";
return;
} }
else { else {
infoprint "Performance schema is enabled."; infoprint "Performance schema is enabled.";
} }
infoprint "Memory used by P_S: " . hr_bytes( get_pf_memory() ); infoprint "Memory used by P_S: " . hr_bytes( get_pf_memory() );
if (grep /^sys$/, select_array("SHOW DATABASES")) {
infoprint "Sys schema is installed.";
} else {
infoprint "Sys schema isn't installed.";
return;
}
} }
# Recommendations for Ariadb # Recommendations for Ariadb
@ -4032,7 +4030,7 @@ cve_recommendations; # Display related CVE
calculations; # Calculate everything we need calculations; # Calculate everything we need
mysql_stats; # Print the server stats mysql_stats; # Print the server stats
mysqsl_pfs # Print Performance schema info mysqsl_pfs # Print Performance schema info
mariadb_threadpool; # Print MaraiDB ThreadPool stats mariadb_threadpool; # Print MaraiDB ThreadPool stats
mysql_myisam; # Print MyISAM stats mysql_myisam; # Print MyISAM stats
mariadb_ariadb; # Print MaraiDB AriaDB stats mariadb_ariadb; # Print MaraiDB AriaDB stats
mysql_innodb; # Print InnoDB stats mysql_innodb; # Print InnoDB stats