diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index 77e49864..13d22b20 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -556,7 +556,12 @@ fuzzy_pct () { section () { local str="$1" - local line="$(printf '#_%-60s' "${str}_" | sed -e 's/[[:space:]]/#/g' -e 's/_/ /g')" + local line="$(printf '# %-60s' "${str} _" | awk '{ + i = index($0, "_"); + x = substr($0, i); + gsub(/[_ \t]/, "#", x); + printf("%s%s\n", substr($0, 0, i-1), x); + }')" printf "%s\n" "${line}" } @@ -932,6 +937,11 @@ collect_mysql_info () { cat "$cnf_file" > "$dir/mysql-config-file" + local pid_file="$(get_var "pid_file" "$dir/mysql-variables")" + local pid_file_exists="" + [ -e "${pid_file}" ] && pid_file_exists=1 + echo "pt-summary-internal-pid_file_exists $pid_file_exists" >> "$dir/mysql-variables" + echo "pt-summary-internal-current_time $current_time" >> "$dir/mysql-variables" echo "pt-summary-internal-Config_File_path $cnf_file" >> "$dir/mysql-variables" collect_internal_vars "$dir/mysqld-executables" >> "$dir/mysql-variables" @@ -1925,7 +1935,7 @@ section_mysqld () { [ -e "$executables_file" -a -e "$variables_file" ] || return - section MySQL_Executable + section "MySQL Executable" local i=1; while read executable; do name_val "Path to executable" "$executable" @@ -1934,15 +1944,31 @@ section_mysqld () { done < "$executables_file" } +section_mysql_files () { + local variables_file="$1" + + section "MySQL Files" + for file_name in pid_file slow_query_log_file general_log_file log_error; do + local file="$(get_var "${file_name}" "$variables_file")" + local name_out="$(echo "$file_name" | sed 'y/[a-z]/[A-Z]/')" + if [ -e "${file}" ]; then + name_val "$name_out" "$file" + name_val "${name_out} Size" "$(du "$file" | awk '{print $1}')" + else + name_val "$name_out" "(does not exist)" + fi + done +} + report_mysql_summary () { local dir="$1" local NAME_VAL_LEN=25 - section Percona_Toolkit_MySQL_Summary_Report + section "Percona Toolkit MySQL Summary Report" name_val "System time" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" - section Instances + section "Instances" parse_mysqld_instances "$dir/mysqld-instances" "$dir/mysql-variables" section_mysqld "$dir/mysqld-executables" "$dir/mysql-variables" @@ -1950,7 +1976,7 @@ report_mysql_summary () { local user="$(get_var "pt-summary-internal-user" "$dir/mysql-variables")" local port="$(get_var port "$dir/mysql-variables")" local now="$(get_var "pt-summary-internal-now" "$dir/mysql-variables")" - section "Report_On_Port_${port}" + section "Report On Port ${port}" name_val User "${user}" name_val Time "${now} ($(get_mysql_timezone "$dir/mysql-variables"))" name_val Hostname "$(get_var hostname "$dir/mysql-variables")" @@ -1974,37 +2000,37 @@ report_mysql_summary () { name_val Replication "Is ${slave}a slave, has ${slavecount} slaves connected" - local pid_file="$(get_var pid_file "$dir/mysql-variables")" + local pid_file="$(get_var "pid_file" "$dir/mysql-variables")" local PID_EXISTS="" - if [ -e "${pid_file}" ]; then + if [ "$( get_var "pt-summary-internal-pid_file_exists" "$dir/mysql-variables" )" ]; then PID_EXISTS="(exists)" else PID_EXISTS="(does not exist)" fi name_val Pidfile "${pid_file} ${PID_EXISTS}" - section Processlist + section "Processlist" summarize_processlist "$dir/mysql-processlist" - section "Status_Counters_(Wait_${OPT_SLEEP}_Seconds)" + section "Status Counters (Wait ${OPT_SLEEP} Seconds)" wait local noncounters_pattern="$(noncounters_pattern)" format_status_variables "$dir/mysql-status-defer" | grep -v "${noncounters_pattern}" - section Table_cache - local open_tables=$(get_var Open_tables "$dir/mysql-status") + section "Table cache" + local open_tables=$(get_var "Open_tables" "$dir/mysql-status") local table_cache=$(get_table_cache "$dir/mysql-variables") name_val Size $table_cache name_val Usage "$(fuzzy_pct ${open_tables} ${table_cache})" - section Key_Percona_Server_features + section "Key Percona Server features" section_percona_server_features "$dir/mysql-variables" - section Plugins + section "Plugins" name_val "InnoDB compression" "$(get_plugin_status "$dir/mysql-plugins" "INNODB_CMP")" if [ "$(get_var have_query_cache "$dir/mysql-variables")" ]; then - section Query_cache + section "Query cache" local query_cache_size=$(get_var query_cache_size "$dir/mysql-variables") local used=$(( ${query_cache_size} - $(get_var Qcache_free_memory "$dir/mysql-status") )) local hrat=$(fuzzy_pct $(get_var Qcache_hits "$dir/mysql-status") $(get_var Qcache_inserts "$dir/mysql-status")) @@ -2014,9 +2040,9 @@ report_mysql_summary () { name_val HitToInsertRatio "${hrat}" fi - local semisync_enabled_master="$(get_var rpl_semi_sync_master_enabled "$dir/mysql-variables")" + local semisync_enabled_master="$(get_var "rpl_semi_sync_master_enabled" "$dir/mysql-variables")" if [ -n "${semisync_enabled_master}" ]; then - section Semisynchronous_Replication + section "Semisynchronous Replication" if [ "$semisync_enabled_master" = "OFF" -o "$semisync_enabled_master" = "0" -o -z "$semisync_enabled_master" ]; then name_val "Master" "Disabled" else @@ -2030,7 +2056,7 @@ report_mysql_summary () { fi fi - section Schema + section "Schema" local reply="n" if [ "${OPT_DATABASES}" ] || [ "${OPT_READ_SAMPLES}" ] \ || [ -e "$dir/mysqldump" -a -s "$dir/mysqldump" ]; then @@ -2064,7 +2090,7 @@ report_mysql_summary () { echo "Skipping schema analysis" fi - section "Noteworthy_Technologies" + section "Noteworthy Technologies" if [ -s "$dir/mysqldump" ]; then if grep FULLTEXT "$dir/mysqldump" > /dev/null; then name_val "Full Text Indexing" "Yes" @@ -2134,8 +2160,8 @@ report_mysql_summary () { name_val "Prepared statement count" "${prep_count}" fi - section InnoDB - local have_innodb="$(get_var have_innodb "$dir/mysql-variables")" + section "InnoDB" + local have_innodb="$(get_var "have_innodb" "$dir/mysql-variables")" if [ "${have_innodb}" = "YES" ]; then section_innodb "$dir/mysql-variables" "$dir/mysql-status" @@ -2144,15 +2170,15 @@ report_mysql_summary () { fi fi - section MyISAM + section "MyISAM" section_myisam "$dir/mysql-variables" "$dir/mysql-status" - section Security + section "Security" local users="$( format_users "$dir/mysql-users" )" - name_val Users "${users}" + name_val "Users" "${users}" name_val "Old Passwords" "$(get_var old_passwords "$dir/mysql-variables")" - section Binary_Logging + section "Binary Logging" if [ -s "$dir/mysql-master-logs" ] \ || [ -s "$dir/mysql-master-status" ]; then @@ -2166,10 +2192,10 @@ report_mysql_summary () { fi - section Noteworthy_Variables + section "Noteworthy Variables" section_noteworthy_variables "$dir/mysql-variables" - section Configuration_File + section "Configuration File" local cnf_file="$(get_var "pt-summary-internal-Config_File_path" "$dir/mysql-variables")" if [ -n "${cnf_file}" ]; then name_val "Config File" "${cnf_file}" @@ -2178,7 +2204,7 @@ report_mysql_summary () { name_val "Config File" "Cannot autodetect or find, giving up" fi - section The_End + section "The End" } # ########################################################################### @@ -2213,6 +2239,7 @@ check_mysql () { sigtrap() { warn "Caught signal, forcing exit" + rm_tmpdir exit $EXIT_STATUS } @@ -2254,7 +2281,7 @@ main() { # ##################################################################### # Fetch most info, leave a child in the background gathering the rest # ##################################################################### - collect_mysql_info "${data_dir}" + collect_mysql_info "${data_dir}" 2>"${data_dir}/collect.err" fi # ######################################################################## diff --git a/bin/pt-summary b/bin/pt-summary index b7467356..00733776 100755 --- a/bin/pt-summary +++ b/bin/pt-summary @@ -693,7 +693,12 @@ fuzzy_pct () { section () { local str="$1" - local line="$(printf '#_%-60s' "${str}_" | sed -e 's/[[:space:]]/#/g' -e 's/_/ /g')" + local line="$(printf '# %-60s' "${str} _" | awk '{ + i = index($0, "_"); + x = substr($0, i); + gsub(/[_ \t]/, "#", x); + printf("%s%s\n", substr($0, 0, i-1), x); + }')" printf "%s\n" "${line}" } @@ -1897,12 +1902,12 @@ processes_section () { local PTFUNCNAME=processes_section; local vmstat_file="$3" local platform="$4" - section "Top_Processes" + section "Top Processes" cat "$top_process_file" - section "Notable_Processes" + section "Notable Processes" cat "$notable_procs_file" if [ -e "$vmstat_file" ]; then - section "Simplified_and_fuzzy_rounded_vmstat_(wait_please)" + section "Simplified and fuzzy rounded vmstat (wait please)" wait # For the process we forked that was gathering vmstat samples if [ "${platform}" = "Linux" ]; then format_vmstat "$vmstat_file" @@ -1980,7 +1985,7 @@ parse_uptime () { report_system_summary () { local PTFUNCNAME=report_system_summary; local data_dir="$1" - section "Percona_Toolkit_System_Summary_Report" + section "Percona Toolkit System Summary Report" [ -e "$data_dir/summary" ] \ @@ -2021,34 +2026,34 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; if [ -s "$data_dir/mounted_fs" ]; then - section "Mounted_Filesystems" + section "Mounted Filesystems" parse_filesystems "$data_dir/mounted_fs" "${platform}" fi if [ "${platform}" = "Linux" ]; then - section "Disk_Schedulers_And_Queue_Size" + section "Disk Schedulers And Queue Size" local disks="$( get_var "internal::disks" "$data_dir/summary" )" for disk in $disks; do local scheduler="$( get_var "internal::${disk}" "$data_dir/summary" )" name_val "${disk}" "${scheduler:-"UNREADABLE"}" done - section "Disk_Partioning" + section "Disk Partioning" parse_fdisk "$data_dir/partitioning" - section "Kernel_Inode_State" + section "Kernel Inode State" for file in dentry-state file-nr inode-nr; do name_val "${file}" "$(get_var "${file}" "$data_dir/summary")" done - section "LVM_Volumes" + section "LVM Volumes" format_lvs "$data_dir/lvs" - section "LVM_Volume_Groups" + section "LVM Volume Groups" format_lvs "$data_dir/vgs" fi - section "RAID_Controller" + section "RAID Controller" local controller="$(get_var "raid_controller" "$data_dir/summary")" name_val "Controller" "$controller" local key="$(get_var "internal::raid_opt" "$data_dir/summary")" @@ -2076,7 +2081,7 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; if [ "${OPT_SUMMARIZE_NETWORK}" ]; then if [ "${platform}" = "Linux" ]; then - section "Network_Config" + section "Network Config" if [ -s "$data_dir/lspci_file" ]; then parse_ethernet_controller_lspci "$data_dir/lspci_file" fi @@ -2088,17 +2093,17 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; if [ -s "$data_dir/ip" ]; then - section "Interface_Statistics" + section "Interface Statistics" parse_ip_s_link "$data_dir/ip" fi if [ -s "$data_dir/network_devices" ]; then - section "Network_Devices" + section "Network Devices" parse_ethtool "$data_dir/network_devices" fi if [ "${platform}" = "Linux" -a -e "$data_dir/netstat" ]; then - section "Network_Connections" + section "Network Connections" parse_netstat "$data_dir/netstat" fi fi @@ -2109,7 +2114,7 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; "$data_dir/vmstat" \ "$platform" - section "The_End" + section "The End" } # ########################################################################### @@ -2144,7 +2149,7 @@ main () { local PTFUNCNAME=main; if [ -n "$OPT_READ_SAMPLES" -a -d "$OPT_READ_SAMPLES" ]; then data_dir="$OPT_READ_SAMPLES" else - collect_system_data "$data_dir" + collect_system_data "$data_dir" 2>"$data_dir/collect.err" fi report_system_summary "$data_dir" @@ -2154,6 +2159,7 @@ main () { local PTFUNCNAME=main; sigtrap() { local PTFUNCNAME=sigtrap; warn "Caught signal, forcing exit" + rm_tmpdir exit $EXIT_STATUS } diff --git a/lib/bash/collect_mysql_info.sh b/lib/bash/collect_mysql_info.sh index 71b73ecb..79355e61 100644 --- a/lib/bash/collect_mysql_info.sh +++ b/lib/bash/collect_mysql_info.sh @@ -234,6 +234,11 @@ collect_mysql_info () { cat "$cnf_file" > "$dir/mysql-config-file" + local pid_file="$(get_var "pid_file" "$dir/mysql-variables")" + local pid_file_exists="" + [ -e "${pid_file}" ] && pid_file_exists=1 + echo "pt-summary-internal-pid_file_exists $pid_file_exists" >> "$dir/mysql-variables" + # TODO: Do these require a file of their own? echo "pt-summary-internal-current_time $current_time" >> "$dir/mysql-variables" echo "pt-summary-internal-Config_File_path $cnf_file" >> "$dir/mysql-variables" diff --git a/lib/bash/report_formatting.sh b/lib/bash/report_formatting.sh index 20f187a5..fe61e797 100644 --- a/lib/bash/report_formatting.sh +++ b/lib/bash/report_formatting.sh @@ -64,7 +64,12 @@ fuzzy_pct () { # with #'s and all underscores with spaces. section () { local str="$1" - local line="$(printf '#_%-60s' "${str}_" | sed -e 's/[[:space:]]/#/g' -e 's/_/ /g')" + local line="$(printf '# %-60s' "${str} _" | awk '{ + i = index($0, "_"); + x = substr($0, i); + gsub(/[_ \t]/, "#", x); + printf("%s%s\n", substr($0, 0, i-1), x); + }')" printf "%s\n" "${line}" } diff --git a/lib/bash/report_mysql_info.sh b/lib/bash/report_mysql_info.sh index 6c30f0ff..d18d896c 100644 --- a/lib/bash/report_mysql_info.sh +++ b/lib/bash/report_mysql_info.sh @@ -1049,7 +1049,7 @@ section_mysqld () { [ -e "$executables_file" -a -e "$variables_file" ] || return - section MySQL_Executable + section "MySQL Executable" local i=1; while read executable; do name_val "Path to executable" "$executable" @@ -1058,6 +1058,22 @@ section_mysqld () { done < "$executables_file" } +section_mysql_files () { + local variables_file="$1" + + section "MySQL Files" + for file_name in pid_file slow_query_log_file general_log_file log_error; do + local file="$(get_var "${file_name}" "$variables_file")" + local name_out="$(echo "$file_name" | sed 'y/[a-z]/[A-Z]/')" + if [ -e "${file}" ]; then + name_val "$name_out" "$file" + name_val "${name_out} Size" "$(du "$file" | awk '{print $1}')" + else + name_val "$name_out" "(does not exist)" + fi + done +} + report_mysql_summary () { local dir="$1" @@ -1068,9 +1084,9 @@ report_mysql_summary () { # Header for the whole thing, table of discovered instances # ######################################################################## - section Percona_Toolkit_MySQL_Summary_Report + section "Percona Toolkit MySQL Summary Report" name_val "System time" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" - section Instances + section "Instances" parse_mysqld_instances "$dir/mysqld-instances" "$dir/mysql-variables" section_mysqld "$dir/mysqld-executables" "$dir/mysql-variables" @@ -1081,7 +1097,7 @@ report_mysql_summary () { local user="$(get_var "pt-summary-internal-user" "$dir/mysql-variables")" local port="$(get_var port "$dir/mysql-variables")" local now="$(get_var "pt-summary-internal-now" "$dir/mysql-variables")" - section "Report_On_Port_${port}" + section "Report On Port ${port}" name_val User "${user}" name_val Time "${now} ($(get_mysql_timezone "$dir/mysql-variables"))" name_val Hostname "$(get_var hostname "$dir/mysql-variables")" @@ -1107,9 +1123,10 @@ report_mysql_summary () { # TODO move this into a section with other files: error log, slow log and # show the sizes - local pid_file="$(get_var pid_file "$dir/mysql-variables")" + # section_mysql_files "$dir/mysql-variables" + local pid_file="$(get_var "pid_file" "$dir/mysql-variables")" local PID_EXISTS="" - if [ -e "${pid_file}" ]; then + if [ "$( get_var "pt-summary-internal-pid_file_exists" "$dir/mysql-variables" )" ]; then PID_EXISTS="(exists)" else PID_EXISTS="(does not exist)" @@ -1119,13 +1136,13 @@ report_mysql_summary () { # ######################################################################## # Processlist, sliced several different ways # ######################################################################## - section Processlist + section "Processlist" summarize_processlist "$dir/mysql-processlist" # ######################################################################## # Queries and query plans # ######################################################################## - section "Status_Counters_(Wait_${OPT_SLEEP}_Seconds)" + section "Status Counters (Wait ${OPT_SLEEP} Seconds)" # Wait for the child that was forked during collection. wait local noncounters_pattern="$(noncounters_pattern)" @@ -1134,8 +1151,8 @@ report_mysql_summary () { # ######################################################################## # Table cache # ######################################################################## - section Table_cache - local open_tables=$(get_var Open_tables "$dir/mysql-status") + section "Table cache" + local open_tables=$(get_var "Open_tables" "$dir/mysql-status") local table_cache=$(get_table_cache "$dir/mysql-variables") name_val Size $table_cache name_val Usage "$(fuzzy_pct ${open_tables} ${table_cache})" @@ -1143,21 +1160,21 @@ report_mysql_summary () { # ######################################################################## # Percona Server features # ######################################################################## - section Key_Percona_Server_features + section "Key Percona Server features" section_percona_server_features "$dir/mysql-variables" # ######################################################################## # Plugins # ######################################################################## # TODO: what would be good is to show nonstandard plugins here. - section Plugins + section "Plugins" name_val "InnoDB compression" "$(get_plugin_status "$dir/mysql-plugins" "INNODB_CMP")" # ######################################################################## # Query cache # ######################################################################## if [ "$(get_var have_query_cache "$dir/mysql-variables")" ]; then - section Query_cache + section "Query cache" local query_cache_size=$(get_var query_cache_size "$dir/mysql-variables") local used=$(( ${query_cache_size} - $(get_var Qcache_free_memory "$dir/mysql-status") )) local hrat=$(fuzzy_pct $(get_var Qcache_hits "$dir/mysql-status") $(get_var Qcache_inserts "$dir/mysql-status")) @@ -1167,9 +1184,9 @@ report_mysql_summary () { name_val HitToInsertRatio "${hrat}" fi - local semisync_enabled_master="$(get_var rpl_semi_sync_master_enabled "$dir/mysql-variables")" + local semisync_enabled_master="$(get_var "rpl_semi_sync_master_enabled" "$dir/mysql-variables")" if [ -n "${semisync_enabled_master}" ]; then - section Semisynchronous_Replication + section "Semisynchronous Replication" if [ "$semisync_enabled_master" = "OFF" -o "$semisync_enabled_master" = "0" -o -z "$semisync_enabled_master" ]; then name_val "Master" "Disabled" else @@ -1186,7 +1203,7 @@ report_mysql_summary () { # ######################################################################## # Schema, databases, data type, other analysis. # ######################################################################## - section Schema + section "Schema" # Assume "no" if stdin or stdout is not a terminal, so this can be run and # put into a file, or piped into a pager, or something else like that. local reply="n" @@ -1231,7 +1248,7 @@ report_mysql_summary () { # ######################################################################## # Noteworthy Technologies # ######################################################################## - section "Noteworthy_Technologies" + section "Noteworthy Technologies" if [ -s "$dir/mysqldump" ]; then if grep FULLTEXT "$dir/mysqldump" > /dev/null; then name_val "Full Text Indexing" "Yes" @@ -1304,8 +1321,8 @@ report_mysql_summary () { # ######################################################################## # InnoDB # ######################################################################## - section InnoDB - local have_innodb="$(get_var have_innodb "$dir/mysql-variables")" + section "InnoDB" + local have_innodb="$(get_var "have_innodb" "$dir/mysql-variables")" if [ "${have_innodb}" = "YES" ]; then section_innodb "$dir/mysql-variables" "$dir/mysql-status" @@ -1317,22 +1334,21 @@ report_mysql_summary () { # ######################################################################## # MyISAM # ######################################################################## - section MyISAM + section "MyISAM" section_myisam "$dir/mysql-variables" "$dir/mysql-status" # ######################################################################## # Users & Security # ######################################################################## - section Security + section "Security" local users="$( format_users "$dir/mysql-users" )" - # XXX TODO Give it a different formatting? - name_val Users "${users}" + name_val "Users" "${users}" name_val "Old Passwords" "$(get_var old_passwords "$dir/mysql-variables")" # ######################################################################## # Binary Logging # ######################################################################## - section Binary_Logging + section "Binary Logging" if [ -s "$dir/mysql-master-logs" ] \ || [ -s "$dir/mysql-master-status" ]; then @@ -1351,13 +1367,13 @@ report_mysql_summary () { # ######################################################################## # Interesting things that you just ought to know about. # ######################################################################## - section Noteworthy_Variables + section "Noteworthy Variables" section_noteworthy_variables "$dir/mysql-variables" # ######################################################################## # If there is a my.cnf in a standard location, see if we can pretty-print it. # ######################################################################## - section Configuration_File + section "Configuration File" local cnf_file="$(get_var "pt-summary-internal-Config_File_path" "$dir/mysql-variables")" if [ -n "${cnf_file}" ]; then name_val "Config File" "${cnf_file}" @@ -1367,7 +1383,7 @@ report_mysql_summary () { fi # Make sure that we signal the end of the tool's output. - section The_End + section "The End" } # ########################################################################### diff --git a/lib/bash/report_system_info.sh b/lib/bash/report_system_info.sh index 000c4e10..632408e2 100644 --- a/lib/bash/report_system_info.sh +++ b/lib/bash/report_system_info.sh @@ -802,12 +802,12 @@ processes_section () { local PTFUNCNAME=processes_section; local vmstat_file="$3" local platform="$4" - section "Top_Processes" + section "Top Processes" cat "$top_process_file" - section "Notable_Processes" + section "Notable Processes" cat "$notable_procs_file" if [ -e "$vmstat_file" ]; then - section "Simplified_and_fuzzy_rounded_vmstat_(wait_please)" + section "Simplified and fuzzy rounded vmstat (wait please)" wait # For the process we forked that was gathering vmstat samples if [ "${platform}" = "Linux" ]; then format_vmstat "$vmstat_file" @@ -888,7 +888,7 @@ parse_uptime () { report_system_summary () { local PTFUNCNAME=report_system_summary; local data_dir="$1" - section "Percona_Toolkit_System_Summary_Report" + section "Percona Toolkit System Summary Report" # ######################################################################## # General date, time, load, etc @@ -939,34 +939,34 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; # TODO: Add info about software RAID if [ -s "$data_dir/mounted_fs" ]; then - section "Mounted_Filesystems" + section "Mounted Filesystems" parse_filesystems "$data_dir/mounted_fs" "${platform}" fi if [ "${platform}" = "Linux" ]; then - section "Disk_Schedulers_And_Queue_Size" + section "Disk Schedulers And Queue Size" local disks="$( get_var "internal::disks" "$data_dir/summary" )" for disk in $disks; do local scheduler="$( get_var "internal::${disk}" "$data_dir/summary" )" name_val "${disk}" "${scheduler:-"UNREADABLE"}" done - section "Disk_Partioning" + section "Disk Partioning" parse_fdisk "$data_dir/partitioning" - section "Kernel_Inode_State" + section "Kernel Inode State" for file in dentry-state file-nr inode-nr; do name_val "${file}" "$(get_var "${file}" "$data_dir/summary")" done - section "LVM_Volumes" + section "LVM Volumes" format_lvs "$data_dir/lvs" - section "LVM_Volume_Groups" + section "LVM Volume Groups" format_lvs "$data_dir/vgs" fi - section "RAID_Controller" + section "RAID Controller" local controller="$(get_var "raid_controller" "$data_dir/summary")" name_val "Controller" "$controller" local key="$(get_var "internal::raid_opt" "$data_dir/summary")" @@ -1000,7 +1000,7 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; # Network stuff # ##################################################################### if [ "${platform}" = "Linux" ]; then - section "Network_Config" + section "Network Config" if [ -s "$data_dir/lspci_file" ]; then parse_ethernet_controller_lspci "$data_dir/lspci_file" fi @@ -1015,17 +1015,17 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; # in new kernels like Fedora 12? if [ -s "$data_dir/ip" ]; then - section "Interface_Statistics" + section "Interface Statistics" parse_ip_s_link "$data_dir/ip" fi if [ -s "$data_dir/network_devices" ]; then - section "Network_Devices" + section "Network Devices" parse_ethtool "$data_dir/network_devices" fi if [ "${platform}" = "Linux" -a -e "$data_dir/netstat" ]; then - section "Network_Connections" + section "Network Connections" parse_netstat "$data_dir/netstat" fi fi @@ -1042,7 +1042,7 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; # ######################################################################## # All done. Signal the end so it's explicit. # ######################################################################## - section "The_End" + section "The End" } # ########################################################################### diff --git a/t/lib/bash/report_formatting.sh b/t/lib/bash/report_formatting.sh index 3a3c33da..0d594958 100644 --- a/t/lib/bash/report_formatting.sh +++ b/t/lib/bash/report_formatting.sh @@ -68,13 +68,13 @@ is \ is \ "$(section "A B C")" \ - "# A#B#C ######################################################" \ - "section replaces all spaces with #s" + "# A B C ######################################################" \ + "section doesn't replaces spaces with #s" is \ "$(section "A_B_C")" \ - "# A B C ######################################################" \ - "..and all underscores with spaces" + "# A#B#C#######################################################" \ + "..but it does replace everything after and including the first underscore with #s" # name_val diff --git a/t/pt-mysql-summary/pt-mysql-summary.t b/t/pt-mysql-summary/pt-mysql-summary.t index 7d7da788..fb274639 100644 --- a/t/pt-mysql-summary/pt-mysql-summary.t +++ b/t/pt-mysql-summary/pt-mysql-summary.t @@ -36,7 +36,7 @@ my @files = glob("$dir/*"); is( scalar @files, - 14, + 15, "And leaves all files in there" ); diff --git a/t/pt-mysql-summary/samples/temp001/mysql-variables b/t/pt-mysql-summary/samples/temp001/mysql-variables index dd2c6ca4..ba275a1f 100644 --- a/t/pt-mysql-summary/samples/temp001/mysql-variables +++ b/t/pt-mysql-summary/samples/temp001/mysql-variables @@ -353,3 +353,4 @@ pt-summary-internal-user hugmeir@localhost pt-summary-internal-FNV_64 Unknown pt-summary-internal-trigger_count 0 pt-summary-internal-symbols Yes +pt-summary-internal-pid_file_exists 1 diff --git a/t/pt-mysql-summary/samples/temp002/mysql-variables b/t/pt-mysql-summary/samples/temp002/mysql-variables index 4f15018a..9f3aaf14 100644 --- a/t/pt-mysql-summary/samples/temp002/mysql-variables +++ b/t/pt-mysql-summary/samples/temp002/mysql-variables @@ -369,3 +369,4 @@ pt-summary-internal-user hugmeir@localhost pt-summary-internal-FNV_64 Unknown pt-summary-internal-trigger_count 0 pt-summary-internal-symbols Yes +pt-summary-internal-pid_file_exists diff --git a/t/pt-mysql-summary/samples/temp003/mysql-variables b/t/pt-mysql-summary/samples/temp003/mysql-variables index bdb6ed4f..48c9c42e 100644 --- a/t/pt-mysql-summary/samples/temp003/mysql-variables +++ b/t/pt-mysql-summary/samples/temp003/mysql-variables @@ -282,3 +282,4 @@ pt-summary-internal-user msandbox@% pt-summary-internal-FNV_64 Unknown pt-summary-internal-trigger_count 0 pt-summary-internal-symbols Yes +pt-summary-internal-pid_file_exists 1 diff --git a/t/pt-mysql-summary/samples/temp004/mysql-variables b/t/pt-mysql-summary/samples/temp004/mysql-variables index 28eec4ae..c116a1eb 100644 --- a/t/pt-mysql-summary/samples/temp004/mysql-variables +++ b/t/pt-mysql-summary/samples/temp004/mysql-variables @@ -282,3 +282,4 @@ pt-summary-internal-user msandbox@% pt-summary-internal-FNV_64 Unknown pt-summary-internal-trigger_count 6 pt-summary-internal-symbols No +pt-summary-internal-pid_file_exists 1 diff --git a/t/pt-mysql-summary/samples/temp005/mysql-variables b/t/pt-mysql-summary/samples/temp005/mysql-variables index 9b1534d2..830aec4f 100644 --- a/t/pt-mysql-summary/samples/temp005/mysql-variables +++ b/t/pt-mysql-summary/samples/temp005/mysql-variables @@ -360,3 +360,4 @@ pt-summary-internal-user msandbox@% pt-summary-internal-FNV_64 Unknown pt-summary-internal-trigger_count 6 pt-summary-internal-mysqld_executable_1 Yes +pt-summary-internal-pid_file_exists 1