diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index 28d9f42b..094926c6 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -492,8 +492,16 @@ _lsof() { fi } + + _which() { - [ -x /usr/bin/which ] && /usr/bin/which "$1" 2>/dev/null | awk '{print $1}' + if [ -x /usr/bin/which ]; then + /usr/bin/which "$1" 2>/dev/null | awk '{print $1}' + elif which which 1>/dev/null 2>&1; then + which "$1" 2>/dev/null | awk '{print $1}' + else + echo "$1" + fi } # ########################################################################### @@ -608,7 +616,7 @@ CMD_OBJDUMP="$( _which objdump 2>/dev/null )" get_nice_of_pid () { local pid="$1" - local niceness=$(ps -p $pid -o nice | tail -n+2 | awk '{print $1; exit;}') + local niceness="$(ps -p $pid -o nice | awk '$1 !~ /[^0-9]/ {print $1; exit}')" if [ -n "${niceness}" ]; then echo $niceness @@ -647,7 +655,7 @@ get_oom_of_pid () { local pid="$1" local oom_adj="" - if [ -n "${pid}" ] && [ -e /proc/cpuinfo ]; then + if [ -n "${pid}" -a -e /proc/cpuinfo ]; then if [ -s "/proc/$pid/oom_score_adj" ]; then oom_adj=$(cat "/proc/$pid/oom_score_adj" 2>/dev/null) _d "For $pid, the oom value is $oom_adj, retreived from oom_score_adj" @@ -692,6 +700,7 @@ has_symbols () { } setup_data_dir () { + local OPT_SAVE_DATA="$1" local data_dir="" if [ -z "$OPT_SAVE_DATA" ]; then mkdir "$TMPDIR/data" || die "Cannot mkdir $TMPDIR/data" @@ -710,13 +719,7 @@ setup_data_dir () { get_var () { local varname="$1" local file="$2" - local v="$(awk "\$1 ~ /^${varname}$/ { if (length(\$2)) { print substr(\$0, index(\$0,\$2)) } }" "${file}")" - if [ -n "$v" ]; then - echo "$v" - return 0 - else - return 1 - fi + echo "$(awk "\$1 ~ /^${varname}$/ { if (length(\$2)) { print substr(\$0, index(\$0,\$2)) } }" "${file}")" } # ########################################################################### @@ -739,7 +742,25 @@ CMD_MYSQLDUMP="${CMD_MYSQLDUMP:-""}" collect_mysqld_instances () { local file="$1" - ps auxww 2>/dev/null | grep mysqld > "$file" + local variables_file="$2" + + local pids="$(_pidof mysqld)" + + if [ -n "$pids" ]; then + + for pid in $pids; do + local nice="$( get_nice_of_pid $pid )" + local oom="$( get_oom_of_pid $pid )" + echo "internal::nice_of_$pid $nice" >> "$variables_file" + echo "internal::oom_of_$pid $oom" >> "$variables_file" + done + + pids="$(echo $pids | sed -e 's/ /,/g')" + ps ww -p "$pids" 2>/dev/null > "$file" + else + echo "mysqld doesn't appear to be running" > "$file" + fi + } find_my_cnf_file() { @@ -758,7 +779,6 @@ find_my_cnf_file() { fi if [ ! -n "${cnf_file}" ]; then - _d "Cannot autodetect config file, trying common locations" cnf_file="/etc/my.cnf"; if [ ! -e "${cnf_file}" ]; then cnf_file="/etc/mysql/my.cnf"; @@ -840,6 +860,7 @@ collect_internal_vars () { local trigger_count=$($CMD_MYSQL $EXT_ARGV -ss -e "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS" 2>/dev/null) local has_symbols="$(has_symbols "${CMD_MYSQL}")" + echo "pt-summary-internal-mysql_executable $CMD_MYSQL" >> "$file" echo "pt-summary-internal-now $now" >> "$file" echo "pt-summary-internal-user $user" >> "$file" echo "pt-summary-internal-FNV_64 $FNV_64" >> "$file" @@ -850,12 +871,12 @@ collect_internal_vars () { get_mysqldump_for () { local file="$1" local args="$2" - local dbtodump="${3:---all-databases}" + local dbtodump="${3:-"--all-databases"}" $CMD_MYSQLDUMP $EXT_ARGV --no-data --skip-comments \ --skip-add-locks --skip-add-drop-table --compact \ --skip-lock-all-tables --skip-lock-tables --skip-set-charset \ - ${args} "${dbtodump}" > "$file" + ${args} --databases $( local IFS=,; echo ${dbtodump}) >> "$file" } get_mysqldump_args () { @@ -863,7 +884,6 @@ get_mysqldump_args () { local trg_arg="" if $CMD_MYSQLDUMP --help --verbose 2>&1 | grep triggers >/dev/null; then - _d "mysqldump supports triggers" trg_arg="--routines" fi @@ -871,7 +891,6 @@ get_mysqldump_args () { local triggers="--skip-triggers" local trg=$(get_var "pt-summary-internal-trigger_count" "$file" ) if [ -n "${trg}" ] && [ "${trg}" -gt 0 ]; then - _d "We have triggers to dump" triggers="--triggers" fi trg_arg="${trg_arg} ${triggers}"; @@ -883,8 +902,6 @@ collect_mysql_info () { local dir="$1" local prefix="${2:-percona-toolkit}" - collect_mysqld_instances "$dir/${prefix}-mysqld-instances" - collect_mysql_variables "$dir/${prefix}-mysql-variables" collect_mysql_status "$dir/${prefix}-mysql-status" collect_mysql_databases "$dir/${prefix}-mysql-databases" @@ -894,9 +911,10 @@ collect_mysql_info () { collect_mysql_processlist "$dir/${prefix}-mysql-processlist" collect_mysql_users "$dir/${prefix}-mysql-users" + collect_mysqld_instances "$dir/${prefix}-mysqld-instances" "$dir/${prefix}-mysql-variables" + local binlog="$(get_var log_bin "$dir/${prefix}-mysql-variables")" if [ "${binlog}" ]; then - _d "Got a binlog, going to get MASTER LOGS and MASTER STATUS" collect_master_logs_status "$dir/${prefix}-mysql-master-logs" "$dir/${prefix}-mysql-master-status" fi @@ -911,10 +929,9 @@ collect_mysql_info () { echo "pt-summary-internal-Config_File $cnf_file" >> "$dir/${prefix}-mysql-variables" collect_internal_vars "$dir/${prefix}-mysql-variables" - if [ -n "${OPT_DUMP_SCHEMAS}" ]; then - _d "--dump-schemas passed in, dumping early" + if [ -n "${OPT_DATABASES}" ]; then local trg_arg="$( get_mysqldump_args "$dir/${prefix}-mysql-variables" )" - get_mysqldump_for "$dir/${prefix}-mysqldump" "${trg_arg}" "${OPT_DUMP_SCHEMAS}" + get_mysqldump_for "$dir/${prefix}-mysqldump" "${trg_arg}" "${OPT_DATABASES}" fi ( @@ -1007,6 +1024,8 @@ get_plugin_status () { _NO_FALSE_NEGATIVES="" parse_mysqld_instances () { local file="$1" + local variables_file="$2" + local socket=${socket:-""} local port=${port:-""} local datadir="${datadir:-""}" @@ -1029,13 +1048,13 @@ parse_mysqld_instances () { datadir="$(echo "${word}" | cut -d= -f2)" fi done - local nice=$(get_nice_of_pid $pid ) - local oom=$(get_oom_of_pid $pid ) + local nice="$(get_var "internal::nice_of_$pid" "$variables_file")" + local oom="$(get_var "internal::oom_of_$pid" "$variables_file")" if [ -n "${_NO_FALSE_NEGATIVES}" ]; then nice="?" oom="?" fi - printf " %5s %-26s %-4s %-3s %s\n" "${port}" "${datadir}" "${nice}" "${oom}" "${socket}" + printf " %5s %-26s %-4s %-3s %s\n" "${port}" "${datadir}" "${nice:-"?"}" "${oom:-"?"}" "${socket}" done } @@ -1709,7 +1728,7 @@ section_percona_server_features () { "$(feat_on "$file" innodb_adaptive_checkpoint ne none)" name_val "HandlerSocket NoSQL" \ "$(feat_on "$file" handlersocket_port)" - name_val "Fast Maatkit Hashes" \ + name_val "Fast Hash UDFs" \ "$(get_var "pt-summary-internal-FNV_64" "$file")" } @@ -1903,9 +1922,10 @@ report_mysql_summary () { section Percona_Toolkit_MySQL_Summary_Report name_val "System time" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" section Instances - parse_mysqld_instances "$dir/${prefix}-mysqld-instances" + parse_mysqld_instances "$dir/${prefix}-mysqld-instances" "$dir/${prefix}-mysql-variables" section MySQL_Executable + name_val "Path to executable" "$( get_var pt-summary-internal-mysql_executable "$dir/${prefix}-mysql-variables" )" name_val "Has symbols" "$( get_var "pt-summary-internal-symbols" "$dir/${prefix}-mysql-variables" )" local user="$(get_var "pt-summary-internal-user" "$dir/${prefix}-mysql-variables")" @@ -1993,7 +2013,8 @@ report_mysql_summary () { section Schema local reply="n" - if [ -n "${OPT_DUMP_SCHEMAS}" ]; then + if [ -n "${OPT_DATABASES}" ] || [ -n "${OPT_READ_SAMPLES}" ] \ + || [ -e "$dir/${prefix}-mysqldump" -a -s "$dir/${prefix}-mysqldump" ]; then reply="y" elif [ -t 0 -a -t 1 ]; then echo -n "Would you like to mysqldump -d the schema and analyze it? y/n " @@ -2001,8 +2022,8 @@ report_mysql_summary () { reply=${reply:-n} fi if echo "${reply:-n}" | grep -i '^y' > /dev/null ; then - if [ -z "${OPT_DUMP_SCHEMAS}" ]; then - + if [ -z "${OPT_DATABASES}" ] && [ -z "$OPT_READ_SAMPLES" ] \ + && [ ! -e "$dir/${prefix}-mysqldump" ]; then echo "There are ${num_dbs} databases. Would you like to dump all, or just one?" echo -n "Type the name of the database, or press Enter to dump all of them. " local dbtodump="" @@ -2011,7 +2032,6 @@ report_mysql_summary () { get_mysqldump_for "$dir/${prefix}-mysqldump" "${trg_arg}" "${dbtodump}" fi - if [ -e "$dir/${prefix}-mysqldump" -a -s "$dir/${prefix}-mysqldump" ] \ && grep 'CREATE TABLE' "$dir/${prefix}-mysqldump" >/dev/null 2>&1; then format_overall_db_stats "$dir/${prefix}-mysqldump" @@ -2176,7 +2196,7 @@ main() { # Prepending SIG to these doesn't work with NetBSD's sh trap sigtrap HUP INT TERM - local RAN_WITH="--sleep=$OPT_SLEEP --dump-schemas=$OPT_DUMP_SCHEMAS --save-data=$OPT_SAVE_DATA" + local RAN_WITH="--sleep=$OPT_SLEEP --databases=$OPT_DATABASES --save-samples=$OPT_SAVE_SAMPLES" _d "Starting $0 $RAN_WITH" @@ -2193,14 +2213,18 @@ main() { mk_tmpdir # Set DATA_DIR where we'll save collected data files. - local data_dir="$(setup_data_dir)" + local data_dir="$(setup_data_dir "${OPT_SAVE_SAMPLES:-""}")" - _d "Temp dir is [$TMPDIR], saving data in [$data_dir]" - - # ######################################################################## - # Fetch most info, leave a child in the background gathering the rest - # ######################################################################## - collect_mysql_info "${data_dir}" + if [ -n "$OPT_READ_SAMPLES" -a -d "$OPT_READ_SAMPLES" ]; then + # --read-samples was set and is a directory, so the samples + # will already be there. + data_dir="$OPT_READ_SAMPLES" + else + # ##################################################################### + # Fetch most info, leave a child in the background gathering the rest + # ##################################################################### + collect_mysql_info "${data_dir}" + fi # ######################################################################## # Format and pretty-print the data @@ -2253,7 +2277,7 @@ pt-mysql-summary - Summarize MySQL information in a nice way. =head1 SYNOPSIS -Usage: pt-mysql-summary [MYSQL-OPTIONS] +Usage: pt-mysql-summary [OPTIONS] [-- MYSQL OPTIONS] pt-mysql-summary conveniently summarizes the status and configuration of a MySQL database server so that you can learn about it at a glance. It is not @@ -2328,18 +2352,25 @@ first option on the command line. Print help and exit. -=item --save-data +=item --save-samples type: string Save the data files used to generate the summary in this directory. -=item --dump-schemas +=item --read-samples + +type: string + +Create a report from the files found in this directory. + +=item --databases type: string Names of databases to dump through myslqdump. If you want all of them, -you can use --all-databases. If not provided, the program will ask you +you can use --all-databases; you can also pass in a comma-separated list +of database names. If not provided, the program will ask you for manual input. =item --sleep diff --git a/bin/pt-summary b/bin/pt-summary index 4e07229d..1fafaa41 100644 --- a/bin/pt-summary +++ b/bin/pt-summary @@ -4,8 +4,6 @@ # See "COPYRIGHT, LICENSE, AND WARRANTY" at the end of this file for legal # notices and disclaimers. -ARGS="$@" # For NetBSD's sh - set -u # ######################################################################## @@ -15,8 +13,6 @@ TOOL="pt-summary" POSIXLY_CORRECT=1 export POSIXLY_CORRECT -PT_SUMMARY_SKIP="${PT_SUMMARY_SKIP:-""}" - # ########################################################################### # log_warn_die package # This package is a copy without comments from the original. The original @@ -503,8 +499,16 @@ _lsof() { fi } + + _which() { - [ -x /usr/bin/which ] && /usr/bin/which "$1" 2>/dev/null | awk '{print $1}' + if [ -x /usr/bin/which ]; then + /usr/bin/which "$1" 2>/dev/null | awk '{print $1}' + elif which which 1>/dev/null 2>&1; then + which "$1" 2>/dev/null | awk '{print $1}' + else + echo "$1" + fi } # ########################################################################### @@ -529,7 +533,7 @@ CMD_OBJDUMP="$( _which objdump 2>/dev/null )" get_nice_of_pid () { local pid="$1" - local niceness=$(ps -p $pid -o nice | tail -n+2 | awk '{print $1; exit;}') + local niceness="$(ps -p $pid -o nice | awk '$1 !~ /[^0-9]/ {print $1; exit}')" if [ -n "${niceness}" ]; then echo $niceness @@ -568,7 +572,7 @@ get_oom_of_pid () { local pid="$1" local oom_adj="" - if [ -n "${pid}" ] && [ -e /proc/cpuinfo ]; then + if [ -n "${pid}" -a -e /proc/cpuinfo ]; then if [ -s "/proc/$pid/oom_score_adj" ]; then oom_adj=$(cat "/proc/$pid/oom_score_adj" 2>/dev/null) _d "For $pid, the oom value is $oom_adj, retreived from oom_score_adj" @@ -613,6 +617,7 @@ has_symbols () { } setup_data_dir () { + local OPT_SAVE_DATA="$1" local data_dir="" if [ -z "$OPT_SAVE_DATA" ]; then mkdir "$TMPDIR/data" || die "Cannot mkdir $TMPDIR/data" @@ -631,13 +636,7 @@ setup_data_dir () { get_var () { local varname="$1" local file="$2" - local v="$(awk "\$1 ~ /^${varname}$/ { if (length(\$2)) { print substr(\$0, index(\$0,\$2)) } }" "${file}")" - if [ -n "$v" ]; then - echo "$v" - return 0 - else - return 1 - fi + echo "$(awk "\$1 ~ /^${varname}$/ { if (length(\$2)) { print substr(\$0, index(\$0,\$2)) } }" "${file}")" } # ########################################################################### @@ -745,8 +744,6 @@ group_concat () { -PT_SUMMARY_SKIP="${PT_SUMMARY_SKIP:-""}" - set -u CMD_SYSCTL="$(_which sysctl 2>/dev/null )" @@ -772,8 +769,9 @@ CMD_IP="$( _which ip 2>/dev/null )" CMD_NETSTAT="$( _which netstat 2>/dev/null )" CMD_PSRINFO="$( _which psrinfo 2>/dev/null )" CMD_SWAPCTL="$( _which swapctl 2>/dev/null )" +CMD_LSB_RELEASE="$( _which lsb_release 2>/dev/null )" -collect_system_data () { local FUNCNAME=collect_system_data; +collect_system_data () { local PTFUNCNAME=collect_system_data; local data_dir="$1" if [ -r /var/log/dmesg -a -s /var/log/dmesg ]; then @@ -782,110 +780,99 @@ collect_system_data () { local FUNCNAME=collect_system_data; $CMD_SYSCTL -a > "$data_dir/sysctl" 2>/dev/null - if [ -n "${CMD_LSPCI}" ]; then + if [ "${CMD_LSPCI}" ]; then $CMD_LSPCI > "$data_dir/lspci_file" 2>/dev/null fi local platform="$(uname -s)" echo "platform $platform" >> "$data_dir/summary" echo "hostname $(uname -n)" >> "$data_dir/summary" - echo "uptime $(uptime | awk '{print substr($0, index($0, "up") + 3)}')" >> "$data_dir/summary" + uptime >> "$data_dir/uptime" processor_info "$data_dir" - find_release_and_kernel "$data_dir/summary" "$platform" - cpu_and_os_arch "$data_dir/summary" "$platform" - find_virtualization "$data_dir/summary" "$platform" "$data_dir/dmesg_file" "$data_dir/lspci_file" - dmidecode_system_info "$data_dir/summary" + find_release_and_kernel "$platform" >> "$data_dir/summary" + cpu_and_os_arch "$platform" >> "$data_dir/summary" + find_virtualization "$platform" "$data_dir/dmesg_file" "$data_dir/lspci_file" >> "$data_dir/summary" + dmidecode_system_info >> "$data_dir/summary" - if [ "${platform}" = "SunOS" ] && [ -n "${CMD_ZONENAME}" ]; then + if [ "${platform}" = "SunOS" -a "${CMD_ZONENAME}" ]; then echo "zonename $($CMD_ZONENAME)" >> "$data_dir/summary" fi - if [ "${platform}" = "Linux" ]; then - echo "threading $(getconf GNU_LIBPTHREAD_VERSION)" >> "$data_dir/summary" - fi if [ -x /lib/libc.so.6 ]; then echo "compiler $(/lib/libc.so.6 | grep 'Compiled by' | cut -c13-)" >> "$data_dir/summary" fi - if [ "${platform}" = "Linux" ]; then - local getenforce="" - if [ -n "$CMD_GETENFORCE" ]; then - getenforce="$($CMD_GETENFORCE 2>&1)"; - fi - echo "getenforce ${getenforce:-No SELinux detected}" >> "$data_dir/summary" - fi - local rss=$(ps -eo rss 2>/dev/null | awk '/[0-9]/{total += $1 * 1024} END {print total}') echo "rss ${rss}" >> "$data_dir/summary" - if [ "${platform}" = "Linux" ]; then - echo "swappiness $(awk '/vm.swappiness/{print $3}' "$data_dir/sysctl")">> "$data_dir/summary" - echo "dirtypolicy $(awk '/vm.dirty_ratio/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_ratio/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary" - if $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl") > /dev/null 2>&1; then - echo "dirtystatus $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_bytes/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary" - fi - fi + [ "$CMD_DMIDECODE" ] && $CMD_DMIDECODE > "$data_dir/dmidecode" 2>/dev/null - if [ -n "$CMD_DMIDECODE" ]; then - $CMD_DMIDECODE > "$data_dir/dmidecode" 2>/dev/null - fi - - find_memory_stats "$data_dir/memory" "$platform" - mounted_fs_info "$data_dir/mounted_fs" "$platform" "$PT_SUMMARY_SKIP" - raid_controller "$data_dir/summary" "$data_dir/dmesg_file" "$data_dir/lspci_file" + find_memory_stats "$platform" > "$data_dir/memory" + [ "$OPT_SUMMARIZE_MOUNTS" ] && mounted_fs_info "$platform" > "$data_dir/mounted_fs" + raid_controller "$data_dir/dmesg_file" "$data_dir/lspci_file" >> "$data_dir/summary" local controller="$(get_var raid_controller "$data_dir/summary")" propietary_raid_controller "$data_dir/raid-controller" "$data_dir/summary" "$data_dir" "$controller" - if [ "${platform}" = "Linux" ]; then - linux_exclusive_collection "$data_dir" - fi + [ "${platform}" = "Linux" ] && linux_exclusive_collection "$data_dir" - if [ -n "$CMD_IP" ] && echo "${PT_SUMMARY_SKIP}" | grep -v NETWORK >/dev/null; then - $CMD_IP -s link > "$data_dir/ip" - fi + [ "$CMD_IP" -a "$OPT_SUMMARIZE_NETWORK" ] && $CMD_IP -s link > "$data_dir/ip" - if [ -n "$CMD_SWAPCTL" ]; then - $CMD_SWAPCTL -s > "$data_dir/swapctl" - fi + [ "$CMD_SWAPCTL" ] && $CMD_SWAPCTL -s > "$data_dir/swapctl" - top_processes "$data_dir/processes" "$PT_SUMMARY_SKIP" - notable_processes_info "$data_dir/notable_procs" "$PT_SUMMARY_SKIP" + if [ "$OPT_SUMMARIZE_PROCESSES" ]; then + top_processes > "$data_dir/processes" + notable_processes_info > "$data_dir/notable_procs" - if [ -n "$CMD_VMSTAT" ]; then - touch "$data_dir/vmstat" - ( - $CMD_VMSTAT 1 $OPT_SLEEP > "$data_dir/vmstat" - ) & + if [ "$CMD_VMSTAT" ]; then + touch "$data_dir/vmstat" + ( + $CMD_VMSTAT 1 $OPT_SLEEP > "$data_dir/vmstat" + ) & + fi fi } -linux_exclusive_collection () { local FUNCNAME=linux_exclusive_collection; +linux_exclusive_collection () { local PTFUNCNAME=linux_exclusive_collection; local data_dir="$1" + echo "threading $(getconf GNU_LIBPTHREAD_VERSION)" >> "$data_dir/summary" + + local getenforce="" + [ "$CMD_GETENFORCE" ] && $CMD_GETENFORCE 2>&1 + echo "getenforce ${getenforce:-"No SELinux detected"}" >> "$data_dir/summary" + + echo "swappiness $(awk '/vm.swappiness/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary" + + local dirty_ratio="$(awk '/vm.dirty_ratio/{print $3}' "$data_dir/sysctl")" + local dirty_bg_ratio="$(awk '/vm.dirty_background_ratio/{print $3}' "$data_dir/sysctl")" + if [ "$dirty_ratio" -a "$dirty_bg_ratio" ]; then + echo "dirtypolicy $dirty_ratio, $dirty_bg_ratio" >> "$data_dir/summary" + fi + + local dirty_bytes="$(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl")" + if [ "$dirty_bytes" ]; then + echo "dirtystatus $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_bytes/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary" + fi + schedulers_and_queue_size "$data_dir/summary" "$data_dir/partitioning" for file in dentry-state file-nr inode-nr; do echo "${file} $(cat /proc/sys/fs/${file} 2>&1)" >> "$data_dir/summary" done - if [ -n "$CMD_LVS" ] && test -x "$CMD_LVS"; then - $CMD_LVS 1>"$data_dir/lvs" 2>&1 - fi + [ "$CMD_LVS" -a -x "$CMD_LVS" ] && $CMD_LVS 1>"$data_dir/lvs" 2>&1 - if [ -n "$CMD_VGS" ] && test -x "$CMD_VGS"; then + [ "$CMD_VGS" -a -x "$CMD_VGS" ] && \ $CMD_VGS -o vg_name,vg_size,vg_free 2>/dev/null > "$data_dir/vgs" - fi - if [ -n "$CMD_NETSTAT" ] && echo "${PT_SUMMARY_SKIP}" | grep -v NETWORK >/dev/null; then + [ "$CMD_NETSTAT" -a "$OPT_SUMMARIZE_NETWORK" ] && \ $CMD_NETSTAT -antp > "$data_dir/netstat" 2>/dev/null - fi } -find_release_and_kernel () { local FUNCNAME=find_release_and_kernel; - local file="$1" - local platform="$2" +find_release_and_kernel () { local PTFUNCNAME=find_release_and_kernel; + local platform="$1" local kernel="" local release="" @@ -897,8 +884,8 @@ find_release_and_kernel () { local FUNCNAME=find_release_and_kernel; release=$(cat /etc/redhat-release); elif [ -e /etc/system-release ]; then release=$(cat /etc/system-release); - elif _which lsb_release >/dev/null 2>&1; then - release="$(lsb_release -ds) ($(lsb_release -cs))" + elif [ "$CMD_LSB_RELEASE" ]; then + release="$($CMD_LSB_RELEASE -ds) ($($CMD_LSB_RELEASE -cs))" elif [ -e /etc/lsb-release ]; then release=$(grep DISTRIB_DESCRIPTION /etc/lsb-release |awk -F'=' '{print $2}' |sed 's#"##g'); elif [ -e /etc/debian_version ]; then @@ -916,8 +903,8 @@ find_release_and_kernel () { local FUNCNAME=find_release_and_kernel; release=$(cat /etc/*release | head -n1); fi fi - elif [ "${platform}" = "FreeBSD" ] \ - || [ "${platform}" = "NetBSD" ] \ + elif [ "${platform}" = "FreeBSD" ] \ + || [ "${platform}" = "NetBSD" ] \ || [ "${platform}" = "OpenBSD" ]; then release="$(uname -r)" kernel="$($CMD_SYSCTL -n kern.osrevision)" @@ -928,13 +915,12 @@ find_release_and_kernel () { local FUNCNAME=find_release_and_kernel; fi kernel="$(uname -v)" fi - echo "kernel $kernel" >> "$file" - echo "release $release" >> "$file" + echo "kernel $kernel" + echo "release $release" } -cpu_and_os_arch () { local FUNCNAME=cpu_and_os_arch; - local file="$1" - local platform="$2" +cpu_and_os_arch () { local PTFUNCNAME=cpu_and_os_arch; + local platform="$1" local CPU_ARCH='32-bit' local OS_ARCH='32-bit' @@ -961,15 +947,14 @@ cpu_and_os_arch () { local FUNCNAME=cpu_and_os_arch; OS_ARCH='64-bit' fi - echo "CPU_ARCH $CPU_ARCH" >> "$file" - echo "OS_ARCH $OS_ARCH" >> "$file" + echo "CPU_ARCH $CPU_ARCH" + echo "OS_ARCH $OS_ARCH" } -find_virtualization () { local FUNCNAME=find_virtualization; - local vars_file="$1" - local platform="$2" - local dmesg_file="$3" - local lspci_file="$4" +find_virtualization () { local PTFUNCNAME=find_virtualization; + local platform="$1" + local dmesg_file="$2" + local lspci_file="$3" local tempfile="$TMPDIR/find_virtualziation.tmp" @@ -978,58 +963,57 @@ find_virtualization () { local FUNCNAME=find_virtualization; virt="$(find_virtualization_dmesg "$dmesg_file")" fi if [ -z "${virt}" ] && [ -s "$lspci_file" ]; then - if grep -qi virtualbox "$lspci_file" ; then - virt=VirtualBox - elif grep -qi vmware "$lspci_file" ; then - virt=VMWare + if grep -qi "virtualbox" "$lspci_file" ; then + virt="VirtualBox" + elif grep -qi "vmware" "$lspci_file" ; then + virt="VMWare" fi elif [ "${platform}" = "FreeBSD" ]; then if ps -o stat | grep J ; then virt="FreeBSD Jail" fi elif [ "${platform}" = "SunOS" ]; then - if [ -n "$CMD_PRTDIAG" ] && $CMD_PRTDIAG > "$tempfile" 2>/dev/null; then + if [ "$CMD_PRTDIAG" ] && $CMD_PRTDIAG > "$tempfile" 2>/dev/null; then virt="$(find_virtualization_generic "$tempfile" )" - elif [ -n "$CMD_SMBIOS" ] && $CMD_SMBIOS > "$tempfile" 2>/dev/null; then + elif [ "$CMD_SMBIOS" ] && $CMD_SMBIOS > "$tempfile" 2>/dev/null; then virt="$(find_virtualization_generic "$tempfile" )" fi elif [ -e /proc/user_beancounters ]; then virt="OpenVZ/Virtuozzo" fi - echo "virt ${virt:-"No virtualization detected"}" >> "$vars_file" + echo "virt ${virt:-"No virtualization detected"}" } find_virtualization_generic() { local PTFUNCNAME=find_virtualization_generic; local file="$1" - if grep -i -e virtualbox "$file" >/dev/null; then - echo VirtualBox - elif grep -i -e vmware "$file" >/dev/null; then - echo VMWare + if grep -i -e "virtualbox" "$file" >/dev/null; then + echo "VirtualBox" + elif grep -i -e "vmware" "$file" >/dev/null; then + echo "VMWare" fi } find_virtualization_dmesg () { local PTFUNCNAME=find_virtualization_dmesg; local file="$1" - if grep -qi -e vmware -e vmxnet -e 'paravirtualized kernel on vmi' "${file}"; then + if grep -qi -e "vmware" -e "vmxnet" -e 'paravirtualized kernel on vmi' "${file}"; then echo "VMWare"; elif grep -qi -e 'paravirtualized kernel on xen' -e 'Xen virtual console' "${file}"; then echo "Xen"; - elif grep -qi qemu "${file}"; then + elif grep -qi "qemu" "${file}"; then echo "QEmu"; elif grep -qi 'paravirtualized kernel on KVM' "${file}"; then echo "KVM"; - elif grep -q VBOX "${file}"; then + elif grep -q "VBOX" "${file}"; then echo "VirtualBox"; elif grep -qi 'hd.: Virtual .., ATA.*drive' "${file}"; then echo "Microsoft VirtualPC"; fi } -dmidecode_system_info () { local FUNCNAME=dmidecode_system_info; - local file="$1" - if [ -n "${CMD_DMIDECODE}" ]; then +dmidecode_system_info () { local PTFUNCNAME=dmidecode_system_info; + if [ "${CMD_DMIDECODE}" ]; then local vendor="$($CMD_DMIDECODE -s system-manufacturer 2>/dev/null | sed 's/ *$//g')" - echo "vendor ${vendor}" >> "$file" + echo "vendor ${vendor}" if [ "${vendor}" ]; then local product="$($CMD_DMIDECODE -s system-product-name 2>/dev/null | sed 's/ *$//g')" local version="$($CMD_DMIDECODE -s system-version 2>/dev/null | sed 's/ *$//g')" @@ -1037,48 +1021,39 @@ dmidecode_system_info () { local FUNCNAME=dmidecode_system_info; local servicetag="$($CMD_DMIDECODE -s system-serial-number 2>/dev/null | sed 's/ *$//g')" local system="${vendor}; ${product}; v${version} (${chassis})" - echo "system ${system}" >> "$file" - echo "servicetag ${servicetag:-Not found}" >> "$file" + echo "system ${system}" + echo "servicetag ${servicetag:-Not found}" fi fi } find_memory_stats () { local PTFUNCNAME=find_memory_stats; - local file="$1" - local platform="$2" + local platform="$1" + if [ "${platform}" = "Linux" ]; then - _d "In Linux, so saving the output of free -b" \ - "and /proc/meminfo into $file" - free -b > "$file" - cat /proc/meminfo >> "$file" + free -b + cat /proc/meminfo elif [ "${platform}" = "SunOS" ]; then - _d "In SunOS, calling prtconf" - $CMD_PRTCONF | awk -F: '/Memory/{print $2}' > "$file" + $CMD_PRTCONF | awk -F: '/Memory/{print $2}' fi } mounted_fs_info () { local PTFUNCNAME=mounted_fs_info; - local file="$1" - local platform="$2" - local skip="${3:-$PT_SUMMARY_SKIP}" + local platform="$1" - if echo "${skip}" | grep -v MOUNT >/dev/null; then - if [ "${platform}" != "SunOS" ]; then - local cmd="df -h" - if [ "${platform}" = "Linux" ]; then - cmd="df -h -P" - fi - _d "calling $cmd" - $cmd | sort > "$TMPDIR/mounted_fs_info.tmp" - mount | sort | join "$TMPDIR/mounted_fs_info.tmp" - > "$file" + if [ "${platform}" != "SunOS" ]; then + local cmd="df -h" + if [ "${platform}" = "Linux" ]; then + cmd="df -h -P" fi + $cmd | sort > "$TMPDIR/mounted_fs_info.tmp" + mount | sort | join "$TMPDIR/mounted_fs_info.tmp" - fi } raid_controller () { local PTFUNCNAME=raid_controller; - local file="$1" - local dmesg_file="$2" - local lspci_file="$3" + local dmesg_file="$1" + local lspci_file="$2" local tempfile="$TMPDIR/raid_controller.tmp" @@ -1090,7 +1065,7 @@ raid_controller () { local PTFUNCNAME=raid_controller; controller="$(find_raid_controller_dmesg "$dmesg_file")" fi - echo "raid_controller ${controller:-"No RAID controller detected"}" >> "$file" + echo "raid_controller ${controller:-"No RAID controller detected"}" } find_raid_controller_dmesg () { local PTFUNCNAME=find_raid_controller_dmesg; @@ -1126,7 +1101,7 @@ find_raid_controller_lspci () { local PTFUNCNAME=find_raid_controller_lspci; fi } -schedulers_and_queue_size () { local FUNCNAME=schedulers_and_queue_size; +schedulers_and_queue_size () { local PTFUNCNAME=schedulers_and_queue_size; local file="$1" local disk_partitioning_file="$2" @@ -1141,72 +1116,60 @@ schedulers_and_queue_size () { local FUNCNAME=schedulers_and_queue_size; done } -top_processes () { local FUNCNAME=top_processes; - local top_processes_file="$1" - local skip="${2:-"$PT_SUMMARY_SKIP"}" - - if echo "${skip}" | grep -v PROCESS >/dev/null; then - if [ -n "$CMD_PRSTAT" ]; then - $CMD_PRSTAT | head > "$top_processes_file" - elif [ -n "$CMD_TOP" ]; then - local cmd="$CMD_TOP -bn 1" - if [ "${platform}" = "FreeBSD" ] \ - || [ "${platform}" = "NetBSD" ] \ - || [ "${platform}" = "OpenBSD" ]; then - cmd="$CMD_TOP -b -d 1" - fi - $cmd | sed -e 's# *$##g' -e '/./{H;$!d;}' -e 'x;/PID/!d;' | grep . | head > "$top_processes_file" +top_processes () { local PTFUNCNAME=top_processes; + if [ "$CMD_PRSTAT" ]; then + $CMD_PRSTAT | head + elif [ "$CMD_TOP" ]; then + local cmd="$CMD_TOP -bn 1" + if [ "${platform}" = "FreeBSD" ] \ + || [ "${platform}" = "NetBSD" ] \ + || [ "${platform}" = "OpenBSD" ]; then + cmd="$CMD_TOP -b -d 1" fi + $cmd \ + | sed -e 's# *$##g' -e '/./{H;$!d;}' -e 'x;/PID/!d;' \ + | grep . \ + | head fi } notable_processes_info () { local PTFUNCNAME=notable_processes_info; - local notable_processes_file="$1" - local skip="${2:-"$PT_SUMMARY_SKIP"}" + local format="%5s %+2d %s\n" + local sshd_pid=$(_pidof "/usr/sbin/sshd") - if echo "${skip}" | grep -v PROCESS >/dev/null; then - local format="%5s %+2d %s\n" - local sshd_pid=$(_pidof "/usr/sbin/sshd") + echo " PID OOM COMMAND" - echo " PID OOM COMMAND" > "$notable_processes_file" - - if [ "$sshd_pid" ]; then - printf "$format" $sshd_pid $(get_oom_of_pid $sshd_pid) "sshd" >> "$notable_processes_file" - else - printf "%5s %3s %s\n" "?" "?" "sshd doesn't appear to be running" >> "$notable_processes_file" - fi - - local PTDEBUG="" - ps -eo pid,ucomm | tail -n +2 | while read pid proc; do - [ "$sshd_pid" ] && [ "$sshd_pid" = "$pid" ] && continue - local oom="$(get_oom_of_pid $pid)" - if [ "$oom" ] && [ "$oom" != "?" ] && [ "$oom" = "-17" ]; then - printf "$format" $pid $oom $proc >> "$notable_processes_file" - fi - done + if [ "$sshd_pid" ]; then + printf "$format" "$sshd_pid" "$(get_oom_of_pid $sshd_pid)" "sshd" + else + printf "%5s %3s %s\n" "?" "?" "sshd doesn't appear to be running" fi + + local PTDEBUG="" + ps -eo pid,ucomm | grep '^[0-9]' | while read pid proc; do + [ "$sshd_pid" ] && [ "$sshd_pid" = "$pid" ] && continue + local oom="$(get_oom_of_pid $pid)" + if [ "$oom" ] && [ "$oom" != "?" ] && [ "$oom" = "-17" ]; then + printf "$format" "$pid" "$oom" "$proc" + fi + done } -processor_info () { local FUNCNAME=processor_info; +processor_info () { local PTFUNCNAME=processor_info; local data_dir="$1" if [ -f /proc/cpuinfo ]; then - _d "Got /proc/cpuinfo, copying that" cat /proc/cpuinfo > "$data_dir/proc_cpuinfo_copy" 2>/dev/null elif [ "${platform}" = "SunOS" ]; then - _d "On SunOS, using psrinfo" $CMD_PSRINFO -v > "$data_dir/psrinfo_minus_v" fi } -propietary_raid_controller () { local FUNCNAME=propietary_raid_controller; +propietary_raid_controller () { local PTFUNCNAME=propietary_raid_controller; local file="$1" local variable_file="$2" local data_dir="$3" local controller="$4" - rm -f "$file" - touch "$file" - notfound="" if [ "${controller}" = "AACRAID" ]; then if [ -z "$CMD_ARCCONF" ]; then @@ -1261,8 +1224,8 @@ parse_proc_cpuinfo () { local PTFUNCNAME=parse_proc_cpuinfo; local physical="$(grep 'physical id' "${file}" | sort -u | wc -l)"; local cores="$(grep 'cpu cores' "${file}" | head -n 1 | cut -d: -f2)"; - if [ "${physical}" = "0" ]; then physical="${virtual}"; fi - if [ -z "${cores}" ]; then cores=0; fi + [ "${physical}" = "0" ] && physical="${virtual}" + [ -z "${cores}" ] && cores=0 cores=$((${cores} * ${physical})); local htt="" @@ -1285,7 +1248,7 @@ parse_proc_cpuinfo () { local PTFUNCNAME=parse_proc_cpuinfo; parse_sysctl_cpu_freebsd() { local PTFUNCNAME=parse_sysctl_cpu_freebsd; local file="$1" - test ! -e "$file" && return; + [ -e "$file" ] || return; local virtual="$(awk '/hw.ncpu/{print $2}' "$file")" name_val "Processors" "virtual = ${virtual}" name_val "Speeds" "$(awk '/hw.clockrate/{print $2}' "$file")" @@ -1295,7 +1258,7 @@ parse_sysctl_cpu_freebsd() { local PTFUNCNAME=parse_sysctl_cpu_freebsd; parse_sysctl_cpu_netbsd() { local PTFUNCNAME=parse_sysctl_cpu_netbsd; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local virtual="$(awk '/hw.ncpu /{print $NF}' "$file")" name_val "Processors" "virtual = ${virtual}" @@ -1305,7 +1268,7 @@ parse_sysctl_cpu_netbsd() { local PTFUNCNAME=parse_sysctl_cpu_netbsd; parse_sysctl_cpu_openbsd() { local PTFUNCNAME=parse_sysctl_cpu_openbsd; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return name_val "Processors" "$(awk -F= '/hw.ncpu=/{print $2}' "$file")" name_val "Speeds" "$(awk -F= '/hw.cpuspeed/{print $2}' "$file")" @@ -1315,9 +1278,9 @@ parse_sysctl_cpu_openbsd() { local PTFUNCNAME=parse_sysctl_cpu_openbsd; parse_psrinfo_cpus() { local PTFUNCNAME=parse_psrinfo_cpus; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return - name_val Processors "$(grep -c 'Status of .* processor' "$file")" + name_val "Processors" "$(grep -c 'Status of .* processor' "$file")" awk '/operates at/ { start = index($0, " at ") + 4; end = length($0) - start - 4 @@ -1329,25 +1292,25 @@ parse_psrinfo_cpus() { local PTFUNCNAME=parse_psrinfo_cpus; parse_free_minus_b () { local PTFUNCNAME=parse_free_minus_b; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local physical=$(awk '/Mem:/{print $3}' "${file}") local swap_alloc=$(awk '/Swap:/{print $2}' "${file}") local swap_used=$(awk '/Swap:/{print $3}' "${file}") local virtual=$(shorten $(($physical + $swap_used)) 1) - name_val Total $(shorten $(awk '/Mem:/{print $2}' "${file}") 1) - name_val Free $(shorten $(awk '/Mem:/{print $4}' "${file}") 1) - name_val Used "physical = $(shorten ${physical} 1), swap allocated = $(shorten ${swap_alloc} 1), swap used = $(shorten ${swap_used} 1), virtual = ${virtual}" - name_val Buffers $(shorten $(awk '/Mem:/{print $6}' "${file}") 1) - name_val Caches $(shorten $(awk '/Mem:/{print $7}' "${file}") 1) - name_val Dirty "$(awk '/Dirty:/ {print $2, $3}' "${file}")" + name_val "Total" $(shorten $(awk '/Mem:/{print $2}' "${file}") 1) + name_val "Free" $(shorten $(awk '/Mem:/{print $4}' "${file}") 1) + name_val "Used" "physical = $(shorten ${physical} 1), swap allocated = $(shorten ${swap_alloc} 1), swap used = $(shorten ${swap_used} 1), virtual = ${virtual}" + name_val "Buffers" $(shorten $(awk '/Mem:/{print $6}' "${file}") 1) + name_val "Caches" $(shorten $(awk '/Mem:/{print $7}' "${file}") 1) + name_val "Dirty" "$(awk '/Dirty:/ {print $2, $3}' "${file}")" } parse_memory_sysctl_freebsd() { local PTFUNCNAME=parse_memory_sysctl_freebsd; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local physical=$(awk '/hw.realmem:/{print $2}' "${file}") local mem_hw=$(awk '/hw.physmem:/{print $2}' "${file}") @@ -1364,39 +1327,39 @@ parse_memory_sysctl_freebsd() { local PTFUNCNAME=parse_memory_sysctl_freebsd; print mem_hw - mem_inactive - mem_cache - mem_free; } ' "$file"); - name_val Total $(shorten ${mem_hw} 1) - name_val Virtual $(shorten ${physical} 1) - name_val Used $(shorten ${mem_used} 1) + name_val "Total" $(shorten ${mem_hw} 1) + name_val "Virtual" $(shorten ${physical} 1) + name_val "Used" $(shorten ${mem_used} 1) } parse_memory_sysctl_netbsd() { local PTFUNCNAME=parse_memory_sysctl_netbsd; local file="$1" local swapctl_file="$2" - test ! -e "$file" -o ! -e "$swapctl_file" && return + [ -e "$file" -a -e "$swapctl_file" ] || return local swap_mem="$(echo "$(awk '{print $2;}' "$swapctl_file")*512" | bc -l)" - name_val Total $(shorten "$(awk '/hw.physmem /{print $NF}' "$file")" 1) - name_val User $(shorten "$(awk '/hw.usermem /{print $NF}' "$file")" 1) - name_val Swap $(shorten ${swap_mem} 1) + name_val "Total" $(shorten "$(awk '/hw.physmem /{print $NF}' "$file")" 1) + name_val "User" $(shorten "$(awk '/hw.usermem /{print $NF}' "$file")" 1) + name_val "Swap" $(shorten ${swap_mem} 1) } parse_memory_sysctl_openbsd() { local PTFUNCNAME=parse_memory_sysctl_openbsd; local file="$1" local swapctl_file="$2" - test ! -e "$file" -o ! -e "$swapctl_file" && return + [ -e "$file" -a -e "$swapctl_file" ] || return local swap_mem="$(echo "$(awk '{print $2;}' "$swapctl_file")*512" | bc -l)" - name_val Total $(shorten "$(awk -F= '/hw.physmem/{print $2}' "$file")" 1) - name_val User $(shorten "$(awk -F= '/hw.usermem/{print $2}' "$file")" 1) - name_val Swap $(shorten ${swap_mem} 1) + name_val "Total" $(shorten "$(awk -F= '/hw.physmem/{print $2}' "$file")" 1) + name_val "User" $(shorten "$(awk -F= '/hw.usermem/{print $2}' "$file")" 1) + name_val "Swap" $(shorten ${swap_mem} 1) } parse_dmidecode_mem_devices () { local PTFUNCNAME=parse_dmidecode_mem_devices; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo " Locator Size Speed Form Factor Type Type Detail" echo " ========= ======== ================= ============= ============= ===========" @@ -1416,7 +1379,7 @@ parse_dmidecode_mem_devices () { local PTFUNCNAME=parse_dmidecode_mem_devices; parse_ip_s_link () { local PTFUNCNAME=parse_ip_s_link; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo " interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors" echo " ========= ========= ========== ========== ========== ========== ==========" @@ -1444,7 +1407,7 @@ parse_ip_s_link () { local PTFUNCNAME=parse_ip_s_link; parse_netstat () { local PTFUNCNAME=parse_netstat; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo " Connections from remote IP addresses" awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ { @@ -1490,7 +1453,7 @@ parse_filesystems () { local PTFUNCNAME=parse_filesystems; local file="$1" local platform="$2" - test ! -e "$file" && return + [ -e "$file" ] || return local spec="$(awk " BEGIN { @@ -1543,7 +1506,7 @@ parse_filesystems () { local PTFUNCNAME=parse_filesystems; parse_fdisk () { local PTFUNCNAME=parse_fdisk; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return awk ' BEGIN { @@ -1576,29 +1539,29 @@ parse_fdisk () { local PTFUNCNAME=parse_fdisk; parse_ethernet_controller_lspci () { local PTFUNCNAME=parse_ethernet_controller_lspci; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return grep -i ethernet "${file}" | cut -d: -f3 | while read line; do - name_val Controller "${line}" + name_val "Controller" "${line}" done } parse_hpacucli () { local PTFUNCNAME=parse_hpacucli; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return grep 'logicaldrive\|physicaldrive' "${file}" } parse_arcconf () { local PTFUNCNAME=parse_arcconf; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local model="$(awk -F: '/Controller Model/{print $2}' "${file}")" local chan="$(awk -F: '/Channel description/{print $2}' "${file}")" local cache="$(awk -F: '/Installed memory/{print $2}' "${file}")" local status="$(awk -F: '/Controller Status/{print $2}' "${file}")" - name_val Specs "$(echo "$model" | sed -e 's/ //'),${chan},${cache} cache,${status}" + name_val "Specs" "$(echo "$model" | sed -e 's/ //'),${chan},${cache} cache,${status}" local battery="" if grep -q "ZMM" "$file"; then @@ -1612,7 +1575,7 @@ parse_arcconf () { local PTFUNCNAME=parse_arcconf; /Time remaining/ {t=sprintf("%dd%dh%dm", $7, $9, $11)} END {printf("%d%%, %s remaining, %s", c, t, s)}')" fi - name_val Battery "${battery}" + name_val "Battery" "${battery}" echo echo " LogicalDev Size RAID Disks Stripe Status Cache" @@ -1699,7 +1662,7 @@ parse_fusionmpt_lsiutil () { local PTFUNCNAME=parse_fusionmpt_lsiutil; parse_lsi_megaraid_adapter_info () { local PTFUNCNAME=parse_lsi_megaraid_adapter_info; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local name="$(awk -F: '/Product Name/{print substr($2, 2)}' "${file}")"; local int=$(awk '/Host Interface/{print $4}' "${file}"); @@ -1712,19 +1675,19 @@ parse_lsi_megaraid_adapter_info () { local PTFUNCNAME=parse_lsi_megaraid_adapter local crd=$(awk '/Critical Disks/{print $4}' "${file}"); local fad=$(awk '/Failed Disks/{print $4}' "${file}"); - name_val Model "${name}, ${int} interface, ${prt} ports" - name_val Cache "${mem} Memory, BBU ${bbu}" + name_val "Model" "${name}, ${int} interface, ${prt} ports" + name_val "Cache" "${mem} Memory, BBU ${bbu}" } parse_lsi_megaraid_bbu_status () { local PTFUNCNAME=parse_lsi_megaraid_bbu_status; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local charge=$(awk '/Relative State/{print $5}' "${file}"); local temp=$(awk '/^Temperature/{print $2}' "${file}"); local soh=$(awk '/isSOHGood:/{print $2}' "${file}"); - name_val BBU "${charge}% Charged, Temperature ${temp}C, isSOHGood=${soh}" + name_val "BBU" "${charge}% Charged, Temperature ${temp}C, isSOHGood=${soh}" } format_lvs () { local PTFUNCNAME=format_lvs; @@ -1734,7 +1697,7 @@ format_lvs () { local PTFUNCNAME=format_lvs; if [ -e "$lvs_file" -a -e "$vgs_file" ]; then local header="$(head -n1 "$lvs_file")$(head -n1 "$vgs_file" | sed -e 's/^ *VG//')" - echo $header + echo "$header" tail -n+2 "$lvs_file" | while read lvs_line; do local current_vg="$(echo $lvs_line | awk '{print $2}')" while read vgs_line; do @@ -1758,7 +1721,7 @@ format_lvs () { local PTFUNCNAME=format_lvs; parse_lsi_megaraid_devices () { local PTFUNCNAME=parse_lsi_megaraid_devices; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo echo " PhysiclDev Type State Errors Vendor Model Size" @@ -1784,7 +1747,7 @@ parse_lsi_megaraid_devices () { local PTFUNCNAME=parse_lsi_megaraid_devices; parse_lsi_megaraid_virtual_devices () { local PTFUNCNAME=parse_lsi_megaraid_virtual_devices; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo echo " VirtualDev Size RAID Level Disks SpnDpth Stripe Status Cache" @@ -1853,7 +1816,7 @@ parse_lsi_megaraid_virtual_devices () { local PTFUNCNAME=parse_lsi_megaraid_virt format_vmstat () { local PTFUNCNAME=format_vmstat; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return awk " BEGIN { @@ -1890,64 +1853,27 @@ processes_section () { local PTFUNCNAME=processes_section; local vmstat_file="$3" local platform="$4" - if echo "${PT_SUMMARY_SKIP}" | grep -v PROCESS >/dev/null; then - section Top_Processes - cat "$top_process_file" - section Notable_Processes - cat "$notable_procs_file" - if [ -e "$vmstat_file" ]; then - 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" - else - cat "$vmstat_file" - fi + section "Top_Processes" + cat "$top_process_file" + section "Notable_Processes" + cat "$notable_procs_file" + if [ -e "$vmstat_file" ]; then + 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" + else + cat "$vmstat_file" fi fi } -report_system_summary () { local PTFUNCNAME=report_system_summary; - local data_dir="$1" +section_Processor () { + local platform="$1" + local data_dir="$2" - section Percona_Toolkit_System_Summary_Report + section "Processor" - - test ! -e "$data_dir/summary" \ - && die "The data directory doesn't have a summary file, exiting." - - local platform="$(get_var platform "$data_dir/summary")" - name_val "Date" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" - name_val "Hostname" "$(get_var hostname "$data_dir/summary")" - name_val "Uptime" "$(get_var uptime "$data_dir/summary")" - - if [ -n "$(get_var vendor "$data_dir/summary")" ]; then - name_val "System" "$(get_var system "$data_dir/summary")"; - name_val "Service Tag" "$(get_var servicetag "$data_dir/summary")"; - fi - - name_val "Platform" "${platform}" - local zonename="$(get_var zonename "$data_dir/summary")"; - if [ -n "${zonename}" ]; then - name_val "Zonename" "$zonename" - fi - - name_val Release "$(get_var release "$data_dir/summary")" - name_val Kernel "$(get_var kernel "$data_dir/summary")" - - name_val "Architecture" "CPU = $(get_var CPU_ARCH "$data_dir/summary"), OS = $(get_var OS_ARCH "$data_dir/summary")" - - local threading="$(get_var threading "$data_dir/summary")" - local compiler="$(get_var compiler "$data_dir/summary")" - [ -n "$threading" ] && name_val Threading "$threading" - [ -n "$compiler" ] && name_val Compiler "$compiler" - - local getenforce="$(get_var getenforce "$data_dir/summary")" - [ -n "$getenforce" ] && name_val "SELinux" "${getenforce}"; - - name_val Virtualized "$(get_var virt "$data_dir/summary")" - - section Processor if [ -e "$data_dir/proc_cpuinfo_copy" ]; then parse_proc_cpuinfo "$data_dir/proc_cpuinfo_copy" elif [ "${platform}" = "FreeBSD" ]; then @@ -1959,8 +1885,13 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; elif [ "${platform}" = "SunOS" ]; then parse_psrinfo_cpus "$data_dir/psrinfo_minus_v" fi +} - section Memory +section_Memory () { + local platform="$1" + local data_dir="$2" + + section "Memory" if [ "${platform}" = "Linux" ]; then parse_free_minus_b "$data_dir/memory" elif [ "${platform}" = "FreeBSD" ]; then @@ -1970,24 +1901,67 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; elif [ "${platform}" = "OpenBSD" ]; then parse_memory_sysctl_openbsd "$data_dir/sysctl" "$data_dir/swapctl" elif [ "${platform}" = "SunOS" ]; then - name_val Memory "$(cat "$data_dir/memory")" + name_val "Memory" "$(cat "$data_dir/memory")" fi - local rss=$( get_var rss "$data_dir/summary" ) - name_val UsedRSS "$(shorten ${rss} 1)" + local rss=$( get_var "rss" "$data_dir/summary" ) + name_val "UsedRSS" "$(shorten ${rss} 1)" if [ "${platform}" = "Linux" ]; then - name_val Swappiness "$(get_var swappiness "$data_dir/summary")" - name_val DirtyPolicy "$(get_var dirtypolicy "$data_dir/summary")" - local dirty_status="$(get_var dirtystatus "$data_dir/summary")" + name_val "Swappiness" "$(get_var "swappiness" "$data_dir/summary")" + name_val "DirtyPolicy" "$(get_var "dirtypolicy" "$data_dir/summary")" + local dirty_status="$(get_var "dirtystatus" "$data_dir/summary")" if [ -n "$dirty_status" ]; then - name_val DirtyStatus "$dirty_status" + name_val "DirtyStatus" "$dirty_status" fi fi if [ -s "$data_dir/dmidecode" ]; then parse_dmidecode_mem_devices "$data_dir/dmidecode" fi +} + +report_system_summary () { local PTFUNCNAME=report_system_summary; + local data_dir="$1" + + section "Percona_Toolkit_System_Summary_Report" + + + [ -e "$data_dir/summary" ] \ + || die "The data directory doesn't have a summary file, exiting." + + local platform="$(get_var "platform" "$data_dir/summary")" + name_val "Date" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" + name_val "Hostname" "$(get_var hostname "$data_dir/summary")" + name_val "Uptime" "$(cat "$data_dir/uptime")" + + if [ "$(get_var "vendor" "$data_dir/summary")" ]; then + name_val "System" "$(get_var "system" "$data_dir/summary")"; + name_val "Service Tag" "$(get_var "servicetag" "$data_dir/summary")"; + fi + + name_val "Platform" "${platform}" + local zonename="$(get_var zonename "$data_dir/summary")"; + [ -n "${zonename}" ] && name_val "Zonename" "$zonename" + + name_val "Release" "$(get_var "release" "$data_dir/summary")" + name_val "Kernel" "$(get_var "kernel" "$data_dir/summary")" + + name_val "Architecture" "CPU = $(get_var "CPU_ARCH" "$data_dir/summary"), OS = $(get_var "OS_ARCH" "$data_dir/summary")" + + local threading="$(get_var threading "$data_dir/summary")" + local compiler="$(get_var compiler "$data_dir/summary")" + [ -n "$threading" ] && name_val "Threading" "$threading" + [ -n "$compiler" ] && name_val "Compiler" "$compiler" + + local getenforce="$(get_var getenforce "$data_dir/summary")" + [ -n "$getenforce" ] && name_val "SELinux" "${getenforce}"; + + name_val "Virtualized" "$(get_var "virt" "$data_dir/summary")" + + section_Processor "$platform" "$data_dir" + + section_Memory "$platform" "$data_dir" if [ -s "$data_dir/mounted_fs" ]; then @@ -1996,8 +1970,8 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; fi if [ "${platform}" = "Linux" ]; then - section "Disk_Schedulers_And_Queue_Size" + section "Disk_Schedulers_And_Queue_Size" local disks="$( get_var disks "$data_dir/summary" )" for disk in ${disks}; do name_val "${disk}" "$( get_var "internal::${disk}" "$data_dir/summary" )" @@ -2016,8 +1990,8 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; fi section "RAID_Controller" - local controller="$(get_var raid_controller "$data_dir/summary")" - name_val Controller "$controller" + local controller="$(get_var "raid_controller" "$data_dir/summary")" + name_val "Controller" "$controller" local key="$(get_var "internal::raid_opt" "$data_dir/summary")" case "$key" in 0) @@ -2041,13 +2015,13 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; ;; esac - if echo "${PT_SUMMARY_SKIP}" | grep -v NETWORK >/dev/null; then + 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 - if grep net.ipv4.tcp_fin_timeout "$data_dir/sysctl" > /dev/null 2>&1; then + if grep "net.ipv4.tcp_fin_timeout" "$data_dir/sysctl" > /dev/null 2>&1; then name_val "FIN Timeout" "$(awk '/net.ipv4.tcp_fin_timeout/{print $NF}' "$data_dir/sysctl")" name_val "Port Range" "$(awk '/net.ipv4.ip_local_port_range/{print $NF}' "$data_dir/sysctl")" fi @@ -2055,19 +2029,23 @@ 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 [ "${platform}" = "Linux" ] && [ -e "$data_dir/netstat" ]; then - section Network_Connections + if [ "${platform}" = "Linux" -a -e "$data_dir/netstat" ]; then + section "Network_Connections" parse_netstat "$data_dir/netstat" fi fi - processes_section "$data_dir/processes" "$data_dir/notable_procs" "$data_dir/vmstat" "$platform" + [ "$OPT_SUMMARIZE_PROCESSES" ] && processes_section \ + "$data_dir/processes" \ + "$data_dir/notable_procs" \ + "$data_dir/vmstat" \ + "$platform" - section The_End + section "The_End" } # ########################################################################### @@ -2081,7 +2059,7 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; main () { local PTFUNCNAME=main; trap sigtrap HUP INT TERM - local RAN_WITH="--sleep=$OPT_SLEEP --save-data=$OPT_SAVE_DATA" + local RAN_WITH="--sleep=$OPT_SLEEP --save-samples=$OPT_SAVE_SAMPLES --read-samples=$OPT_READ_SAMPLES" _d "Starting $0 $RAN_WITH" @@ -2095,11 +2073,13 @@ main () { local PTFUNCNAME=main; # Set up temporary files. mk_tmpdir - local data_dir="$(setup_data_dir)" + local data_dir="$(setup_data_dir "${OPT_SAVE_SAMPLES:-""}")" - _d "Temp dir is [$TMPDIR], saving data in [$data_dir]" - - collect_system_data "$data_dir" + if [ -n "$OPT_READ_SAMPLES" -a -d "$OPT_READ_SAMPLES" ]; then + data_dir="$OPT_READ_SAMPLES" + else + collect_system_data "$data_dir" + fi report_system_summary "$data_dir" @@ -2121,8 +2101,7 @@ if [ "${0##*/}" = "$TOOL" ] \ # Set up temporary dir. mk_tmpdir # Parse command line options. - REPORT_UNRECOGNIZED_OPTIONS="" - parse_options $0 "$ARGS" + parse_options $0 "$@" usage_or_errors $0 po_status=$? rm_tmpdir @@ -2130,7 +2109,7 @@ if [ "${0##*/}" = "$TOOL" ] \ if [ $po_status -ne 0 ]; then exit $po_status fi - main "$ARGS" + main "$@" fi @@ -2204,12 +2183,36 @@ first option on the command line. Print help and exit. -=item --save-data +=item --save-samples type: string Save the data files used to generate the summary in this directory. +=item --read-samples + +type: string + +Create a report from the files found in this directory. + +=item --summarize-mounts + +default: yes; negatable: yes + +Whenever the tool summarizes mounted filesystems and disk fullness. + +=item --summarize-network + +default: yes; negatable: yes + +Whenever the tool prints information on network controllers & config. + +=item --summarize-processes + +default: yes; negatable: yes + +Whenever the tool summarizes the top processes and vmstat information. + =item --sleep type: int; default: 5 @@ -2222,15 +2225,6 @@ Print tool's version and exit. =back -=head1 ENVIRONMENT - -The PT_SUMMARY_SKIP environment variable specifies a comma-separated list -of things to skip: - - MOUNT: Don't print out mounted filesystems and disk fullness. - NETWORK: Don't print out information on network controllers & config. - PROCESS: Don't print out top processes and vmstat information. - =head1 SYSTEM REQUIREMENTS This tool requires the Bourne shell (F). diff --git a/lib/bash/alt_cmds.sh b/lib/bash/alt_cmds.sh index 723d75b8..0541e566 100644 --- a/lib/bash/alt_cmds.sh +++ b/lib/bash/alt_cmds.sh @@ -43,10 +43,34 @@ _lsof() { fi } + +# We don't get things like "which: command not found", so for the pathological +# case where /usr/bin/which isn't installed, we check that "which which" and +# if which really isn't there then just return the command passed in and hope +# they are somewhere + +# TODO: +# we just need to redirect STDERR when we execute +# "which" and check it. Some shells are really weird this way. We +# can't check "which"'s exit status because it will be nonzero if +# the sought-for command doesn't exist. +# _which() { # which on CentOS is aliased to a cmd that prints extra stuff. # Also, if the cmd isn't found, a msg is printed to stderr. - [ -x /usr/bin/which ] && /usr/bin/which "$1" 2>/dev/null | awk '{print $1}' + if [ -x /usr/bin/which ]; then + /usr/bin/which "$1" 2>/dev/null | awk '{print $1}' + elif which which 1>/dev/null 2>&1; then + # Well, this is bizarre. /usr/bin/which either doesn't exist or + # isn't executable, but the shell can use which just fine. + # So we bite the bullet, hope that it doesn't do anything + # insane, and use it. + which "$1" 2>/dev/null | awk '{print $1}' + else + # We don't have which. Just return the command that was + # originally passed in. + echo "$1" + fi } # ########################################################################### diff --git a/lib/bash/collect_mysql_info.sh b/lib/bash/collect_mysql_info.sh index f3ff567b..a494c71f 100644 --- a/lib/bash/collect_mysql_info.sh +++ b/lib/bash/collect_mysql_info.sh @@ -31,7 +31,25 @@ CMD_MYSQLDUMP="${CMD_MYSQLDUMP:-""}" # Simply looks for instances of mysqld in the outof of ps. collect_mysqld_instances () { local file="$1" - ps auxww 2>/dev/null | grep mysqld > "$file" + local variables_file="$2" + + local pids="$(_pidof mysqld)" + + if [ -n "$pids" ]; then + + for pid in $pids; do + local nice="$( get_nice_of_pid $pid )" + local oom="$( get_oom_of_pid $pid )" + echo "internal::nice_of_$pid $nice" >> "$variables_file" + echo "internal::oom_of_$pid $oom" >> "$variables_file" + done + + pids="$(echo $pids | sed -e 's/ /,/g')" + ps ww -p "$pids" 2>/dev/null > "$file" + else + echo "mysqld doesn't appear to be running" > "$file" + fi + } # Tries to find the my.cnf file by examining 'ps' output. @@ -53,7 +71,7 @@ find_my_cnf_file() { fi if [ ! -n "${cnf_file}" ]; then - _d "Cannot autodetect config file, trying common locations" + # "Cannot autodetect config file, trying common locations" cnf_file="/etc/my.cnf"; if [ ! -e "${cnf_file}" ]; then cnf_file="/etc/mysql/my.cnf"; @@ -136,6 +154,7 @@ collect_internal_vars () { local trigger_count=$($CMD_MYSQL $EXT_ARGV -ss -e "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS" 2>/dev/null) local has_symbols="$(has_symbols "${CMD_MYSQL}")" + echo "pt-summary-internal-mysql_executable $CMD_MYSQL" >> "$file" echo "pt-summary-internal-now $now" >> "$file" echo "pt-summary-internal-user $user" >> "$file" echo "pt-summary-internal-FNV_64 $FNV_64" >> "$file" @@ -148,12 +167,12 @@ collect_internal_vars () { get_mysqldump_for () { local file="$1" local args="$2" - local dbtodump="${3:---all-databases}" + local dbtodump="${3:-"--all-databases"}" $CMD_MYSQLDUMP $EXT_ARGV --no-data --skip-comments \ --skip-add-locks --skip-add-drop-table --compact \ --skip-lock-all-tables --skip-lock-tables --skip-set-charset \ - ${args} "${dbtodump}" > "$file" + ${args} --databases $( local IFS=,; echo ${dbtodump}) >> "$file" } # Returns a string with arguments to pass to mysqldump. @@ -164,7 +183,7 @@ get_mysqldump_args () { # If mysqldump supports triggers, then add options for routines. if $CMD_MYSQLDUMP --help --verbose 2>&1 | grep triggers >/dev/null; then - _d "mysqldump supports triggers" + # "mysqldump supports triggers" trg_arg="--routines" fi @@ -175,7 +194,6 @@ get_mysqldump_args () { local triggers="--skip-triggers" local trg=$(get_var "pt-summary-internal-trigger_count" "$file" ) if [ -n "${trg}" ] && [ "${trg}" -gt 0 ]; then - _d "We have triggers to dump" triggers="--triggers" fi trg_arg="${trg_arg} ${triggers}"; @@ -187,8 +205,6 @@ collect_mysql_info () { local dir="$1" local prefix="${2:-percona-toolkit}" - collect_mysqld_instances "$dir/${prefix}-mysqld-instances" - collect_mysql_variables "$dir/${prefix}-mysql-variables" collect_mysql_status "$dir/${prefix}-mysql-status" collect_mysql_databases "$dir/${prefix}-mysql-databases" @@ -198,9 +214,11 @@ collect_mysql_info () { collect_mysql_processlist "$dir/${prefix}-mysql-processlist" collect_mysql_users "$dir/${prefix}-mysql-users" + collect_mysqld_instances "$dir/${prefix}-mysqld-instances" "$dir/${prefix}-mysql-variables" + local binlog="$(get_var log_bin "$dir/${prefix}-mysql-variables")" if [ "${binlog}" ]; then - _d "Got a binlog, going to get MASTER LOGS and MASTER STATUS" + # "Got a binlog, going to get MASTER LOGS and MASTER STATUS" collect_master_logs_status "$dir/${prefix}-mysql-master-logs" "$dir/${prefix}-mysql-master-status" fi @@ -216,10 +234,10 @@ collect_mysql_info () { echo "pt-summary-internal-Config_File $cnf_file" >> "$dir/${prefix}-mysql-variables" collect_internal_vars "$dir/${prefix}-mysql-variables" - if [ -n "${OPT_DUMP_SCHEMAS}" ]; then - _d "--dump-schemas passed in, dumping early" + if [ -n "${OPT_DATABASES}" ]; then + # "--dump-schemas passed in, dumping early" local trg_arg="$( get_mysqldump_args "$dir/${prefix}-mysql-variables" )" - get_mysqldump_for "$dir/${prefix}-mysqldump" "${trg_arg}" "${OPT_DUMP_SCHEMAS}" + get_mysqldump_for "$dir/${prefix}-mysqldump" "${trg_arg}" "${OPT_DATABASES}" fi # TODO: gather this data in the same format as normal: TS line, stats diff --git a/lib/bash/collect_system_info.sh b/lib/bash/collect_system_info.sh index 8cd6bdab..8647bf0c 100644 --- a/lib/bash/collect_system_info.sh +++ b/lib/bash/collect_system_info.sh @@ -25,8 +25,6 @@ # THIS LIB REQUIRES log_warn_die.sh, summary_common.sh, and alt_cmds.sh! # XXX -PT_SUMMARY_SKIP="${PT_SUMMARY_SKIP:-""}" - set -u # While extremely unwieldly, this allows us to fake the commands when testing. @@ -53,8 +51,9 @@ CMD_IP="$( _which ip 2>/dev/null )" CMD_NETSTAT="$( _which netstat 2>/dev/null )" CMD_PSRINFO="$( _which psrinfo 2>/dev/null )" CMD_SWAPCTL="$( _which swapctl 2>/dev/null )" +CMD_LSB_RELEASE="$( _which lsb_release 2>/dev/null )" -collect_system_data () { local FUNCNAME=collect_system_data; +collect_system_data () { local PTFUNCNAME=collect_system_data; local data_dir="$1" if [ -r /var/log/dmesg -a -s /var/log/dmesg ]; then @@ -66,112 +65,106 @@ collect_system_data () { local FUNCNAME=collect_system_data; # ######################################################################## $CMD_SYSCTL -a > "$data_dir/sysctl" 2>/dev/null - if [ -n "${CMD_LSPCI}" ]; then + if [ "${CMD_LSPCI}" ]; then $CMD_LSPCI > "$data_dir/lspci_file" 2>/dev/null fi local platform="$(uname -s)" echo "platform $platform" >> "$data_dir/summary" echo "hostname $(uname -n)" >> "$data_dir/summary" - echo "uptime $(uptime | awk '{print substr($0, index($0, "up") + 3)}')" >> "$data_dir/summary" + uptime >> "$data_dir/uptime" processor_info "$data_dir" - find_release_and_kernel "$data_dir/summary" "$platform" - cpu_and_os_arch "$data_dir/summary" "$platform" - find_virtualization "$data_dir/summary" "$platform" "$data_dir/dmesg_file" "$data_dir/lspci_file" - dmidecode_system_info "$data_dir/summary" + find_release_and_kernel "$platform" >> "$data_dir/summary" + cpu_and_os_arch "$platform" >> "$data_dir/summary" + find_virtualization "$platform" "$data_dir/dmesg_file" "$data_dir/lspci_file" >> "$data_dir/summary" + dmidecode_system_info >> "$data_dir/summary" - if [ "${platform}" = "SunOS" ] && [ -n "${CMD_ZONENAME}" ]; then + if [ "${platform}" = "SunOS" -a "${CMD_ZONENAME}" ]; then echo "zonename $($CMD_ZONENAME)" >> "$data_dir/summary" fi # Threading library - if [ "${platform}" = "Linux" ]; then - echo "threading $(getconf GNU_LIBPTHREAD_VERSION)" >> "$data_dir/summary" - fi if [ -x /lib/libc.so.6 ]; then echo "compiler $(/lib/libc.so.6 | grep 'Compiled by' | cut -c13-)" >> "$data_dir/summary" fi - if [ "${platform}" = "Linux" ]; then - local getenforce="" - if [ -n "$CMD_GETENFORCE" ]; then - getenforce="$($CMD_GETENFORCE 2>&1)"; - fi - echo "getenforce ${getenforce:-No SELinux detected}" >> "$data_dir/summary" - fi - local rss=$(ps -eo rss 2>/dev/null | awk '/[0-9]/{total += $1 * 1024} END {print total}') echo "rss ${rss}" >> "$data_dir/summary" - if [ "${platform}" = "Linux" ]; then - echo "swappiness $(awk '/vm.swappiness/{print $3}' "$data_dir/sysctl")">> "$data_dir/summary" - echo "dirtypolicy $(awk '/vm.dirty_ratio/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_ratio/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary" - if $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl") > /dev/null 2>&1; then - echo "dirtystatus $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_bytes/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary" - fi - fi + [ "$CMD_DMIDECODE" ] && $CMD_DMIDECODE > "$data_dir/dmidecode" 2>/dev/null - if [ -n "$CMD_DMIDECODE" ]; then - $CMD_DMIDECODE > "$data_dir/dmidecode" 2>/dev/null - fi - - find_memory_stats "$data_dir/memory" "$platform" - mounted_fs_info "$data_dir/mounted_fs" "$platform" "$PT_SUMMARY_SKIP" - raid_controller "$data_dir/summary" "$data_dir/dmesg_file" "$data_dir/lspci_file" + find_memory_stats "$platform" > "$data_dir/memory" + [ "$OPT_SUMMARIZE_MOUNTS" ] && mounted_fs_info "$platform" > "$data_dir/mounted_fs" + raid_controller "$data_dir/dmesg_file" "$data_dir/lspci_file" >> "$data_dir/summary" local controller="$(get_var raid_controller "$data_dir/summary")" propietary_raid_controller "$data_dir/raid-controller" "$data_dir/summary" "$data_dir" "$controller" - if [ "${platform}" = "Linux" ]; then - linux_exclusive_collection "$data_dir" - fi + [ "${platform}" = "Linux" ] && linux_exclusive_collection "$data_dir" - if [ -n "$CMD_IP" ] && echo "${PT_SUMMARY_SKIP}" | grep -v NETWORK >/dev/null; then - $CMD_IP -s link > "$data_dir/ip" - fi + [ "$CMD_IP" -a "$OPT_SUMMARIZE_NETWORK" ] && $CMD_IP -s link > "$data_dir/ip" - if [ -n "$CMD_SWAPCTL" ]; then - $CMD_SWAPCTL -s > "$data_dir/swapctl" - fi + [ "$CMD_SWAPCTL" ] && $CMD_SWAPCTL -s > "$data_dir/swapctl" - top_processes "$data_dir/processes" "$PT_SUMMARY_SKIP" - notable_processes_info "$data_dir/notable_procs" "$PT_SUMMARY_SKIP" + if [ "$OPT_SUMMARIZE_PROCESSES" ]; then + top_processes > "$data_dir/processes" + notable_processes_info > "$data_dir/notable_procs" - if [ -n "$CMD_VMSTAT" ]; then - touch "$data_dir/vmstat" - ( - $CMD_VMSTAT 1 $OPT_SLEEP > "$data_dir/vmstat" - ) & + if [ "$CMD_VMSTAT" ]; then + # Here we make an exception from our usual rule of not leaving + # empty files, since the reporting code uses its existence + # as an indicator to do the vmstat portion of the code, + # and it's entirely possible to have reached that spot without + # having the forked process output anything. + touch "$data_dir/vmstat" + ( + $CMD_VMSTAT 1 $OPT_SLEEP > "$data_dir/vmstat" + ) & + fi fi } -linux_exclusive_collection () { local FUNCNAME=linux_exclusive_collection; +linux_exclusive_collection () { local PTFUNCNAME=linux_exclusive_collection; local data_dir="$1" + echo "threading $(getconf GNU_LIBPTHREAD_VERSION)" >> "$data_dir/summary" + + local getenforce="" + [ "$CMD_GETENFORCE" ] && $CMD_GETENFORCE 2>&1 + echo "getenforce ${getenforce:-"No SELinux detected"}" >> "$data_dir/summary" + + echo "swappiness $(awk '/vm.swappiness/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary" + + local dirty_ratio="$(awk '/vm.dirty_ratio/{print $3}' "$data_dir/sysctl")" + local dirty_bg_ratio="$(awk '/vm.dirty_background_ratio/{print $3}' "$data_dir/sysctl")" + if [ "$dirty_ratio" -a "$dirty_bg_ratio" ]; then + echo "dirtypolicy $dirty_ratio, $dirty_bg_ratio" >> "$data_dir/summary" + fi + + local dirty_bytes="$(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl")" + if [ "$dirty_bytes" ]; then + echo "dirtystatus $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_bytes/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary" + fi + schedulers_and_queue_size "$data_dir/summary" "$data_dir/partitioning" for file in dentry-state file-nr inode-nr; do echo "${file} $(cat /proc/sys/fs/${file} 2>&1)" >> "$data_dir/summary" done - if [ -n "$CMD_LVS" ] && test -x "$CMD_LVS"; then - $CMD_LVS 1>"$data_dir/lvs" 2>&1 - fi + [ "$CMD_LVS" -a -x "$CMD_LVS" ] && $CMD_LVS 1>"$data_dir/lvs" 2>&1 - if [ -n "$CMD_VGS" ] && test -x "$CMD_VGS"; then + [ "$CMD_VGS" -a -x "$CMD_VGS" ] && \ $CMD_VGS -o vg_name,vg_size,vg_free 2>/dev/null > "$data_dir/vgs" - fi - if [ -n "$CMD_NETSTAT" ] && echo "${PT_SUMMARY_SKIP}" | grep -v NETWORK >/dev/null; then + [ "$CMD_NETSTAT" -a "$OPT_SUMMARIZE_NETWORK" ] && \ $CMD_NETSTAT -antp > "$data_dir/netstat" 2>/dev/null - fi } # Try to find all sorts of different files that say what the release is. -find_release_and_kernel () { local FUNCNAME=find_release_and_kernel; - local file="$1" - local platform="$2" +find_release_and_kernel () { local PTFUNCNAME=find_release_and_kernel; + local platform="$1" local kernel="" local release="" @@ -183,8 +176,8 @@ find_release_and_kernel () { local FUNCNAME=find_release_and_kernel; release=$(cat /etc/redhat-release); elif [ -e /etc/system-release ]; then release=$(cat /etc/system-release); - elif _which lsb_release >/dev/null 2>&1; then - release="$(lsb_release -ds) ($(lsb_release -cs))" + elif [ "$CMD_LSB_RELEASE" ]; then + release="$($CMD_LSB_RELEASE -ds) ($($CMD_LSB_RELEASE -cs))" elif [ -e /etc/lsb-release ]; then release=$(grep DISTRIB_DESCRIPTION /etc/lsb-release |awk -F'=' '{print $2}' |sed 's#"##g'); elif [ -e /etc/debian_version ]; then @@ -202,8 +195,8 @@ find_release_and_kernel () { local FUNCNAME=find_release_and_kernel; release=$(cat /etc/*release | head -n1); fi fi - elif [ "${platform}" = "FreeBSD" ] \ - || [ "${platform}" = "NetBSD" ] \ + elif [ "${platform}" = "FreeBSD" ] \ + || [ "${platform}" = "NetBSD" ] \ || [ "${platform}" = "OpenBSD" ]; then release="$(uname -r)" kernel="$($CMD_SYSCTL -n kern.osrevision)" @@ -214,13 +207,12 @@ find_release_and_kernel () { local FUNCNAME=find_release_and_kernel; fi kernel="$(uname -v)" fi - echo "kernel $kernel" >> "$file" - echo "release $release" >> "$file" + echo "kernel $kernel" + echo "release $release" } -cpu_and_os_arch () { local FUNCNAME=cpu_and_os_arch; - local file="$1" - local platform="$2" +cpu_and_os_arch () { local PTFUNCNAME=cpu_and_os_arch; + local platform="$1" local CPU_ARCH='32-bit' local OS_ARCH='32-bit' @@ -247,19 +239,18 @@ cpu_and_os_arch () { local FUNCNAME=cpu_and_os_arch; OS_ARCH='64-bit' fi - echo "CPU_ARCH $CPU_ARCH" >> "$file" - echo "OS_ARCH $OS_ARCH" >> "$file" + echo "CPU_ARCH $CPU_ARCH" + echo "OS_ARCH $OS_ARCH" } # We look in dmesg for virtualization information first, because it's often # available to non-root users and usually has telltale signs. It's most # reliable to look at /var/log/dmesg if possible. There are a number of # other ways to find out if a system is virtualized. -find_virtualization () { local FUNCNAME=find_virtualization; - local vars_file="$1" - local platform="$2" - local dmesg_file="$3" - local lspci_file="$4" +find_virtualization () { local PTFUNCNAME=find_virtualization; + local platform="$1" + local dmesg_file="$2" + local lspci_file="$3" local tempfile="$TMPDIR/find_virtualziation.tmp" @@ -268,25 +259,25 @@ find_virtualization () { local FUNCNAME=find_virtualization; virt="$(find_virtualization_dmesg "$dmesg_file")" fi if [ -z "${virt}" ] && [ -s "$lspci_file" ]; then - if grep -qi virtualbox "$lspci_file" ; then - virt=VirtualBox - elif grep -qi vmware "$lspci_file" ; then - virt=VMWare + if grep -qi "virtualbox" "$lspci_file" ; then + virt="VirtualBox" + elif grep -qi "vmware" "$lspci_file" ; then + virt="VMWare" fi elif [ "${platform}" = "FreeBSD" ]; then if ps -o stat | grep J ; then virt="FreeBSD Jail" fi elif [ "${platform}" = "SunOS" ]; then - if [ -n "$CMD_PRTDIAG" ] && $CMD_PRTDIAG > "$tempfile" 2>/dev/null; then + if [ "$CMD_PRTDIAG" ] && $CMD_PRTDIAG > "$tempfile" 2>/dev/null; then virt="$(find_virtualization_generic "$tempfile" )" - elif [ -n "$CMD_SMBIOS" ] && $CMD_SMBIOS > "$tempfile" 2>/dev/null; then + elif [ "$CMD_SMBIOS" ] && $CMD_SMBIOS > "$tempfile" 2>/dev/null; then virt="$(find_virtualization_generic "$tempfile" )" fi elif [ -e /proc/user_beancounters ]; then virt="OpenVZ/Virtuozzo" fi - echo "virt ${virt:-"No virtualization detected"}" >> "$vars_file" + echo "virt ${virt:-"No virtualization detected"}" } # ############################################################################## @@ -294,10 +285,10 @@ find_virtualization () { local FUNCNAME=find_virtualization; # ############################################################################## find_virtualization_generic() { local PTFUNCNAME=find_virtualization_generic; local file="$1" - if grep -i -e virtualbox "$file" >/dev/null; then - echo VirtualBox - elif grep -i -e vmware "$file" >/dev/null; then - echo VMWare + if grep -i -e "virtualbox" "$file" >/dev/null; then + echo "VirtualBox" + elif grep -i -e "vmware" "$file" >/dev/null; then + echo "VMWare" fi } @@ -306,15 +297,15 @@ find_virtualization_generic() { local PTFUNCNAME=find_virtualization_generic; # ############################################################################## find_virtualization_dmesg () { local PTFUNCNAME=find_virtualization_dmesg; local file="$1" - if grep -qi -e vmware -e vmxnet -e 'paravirtualized kernel on vmi' "${file}"; then + if grep -qi -e "vmware" -e "vmxnet" -e 'paravirtualized kernel on vmi' "${file}"; then echo "VMWare"; elif grep -qi -e 'paravirtualized kernel on xen' -e 'Xen virtual console' "${file}"; then echo "Xen"; - elif grep -qi qemu "${file}"; then + elif grep -qi "qemu" "${file}"; then echo "QEmu"; elif grep -qi 'paravirtualized kernel on KVM' "${file}"; then echo "KVM"; - elif grep -q VBOX "${file}"; then + elif grep -q "VBOX" "${file}"; then echo "VirtualBox"; elif grep -qi 'hd.: Virtual .., ATA.*drive' "${file}"; then echo "Microsoft VirtualPC"; @@ -322,11 +313,10 @@ find_virtualization_dmesg () { local PTFUNCNAME=find_virtualization_dmesg; } # TODO: Maybe worth it to just dump dmidecode once and parse that? -dmidecode_system_info () { local FUNCNAME=dmidecode_system_info; - local file="$1" - if [ -n "${CMD_DMIDECODE}" ]; then +dmidecode_system_info () { local PTFUNCNAME=dmidecode_system_info; + if [ "${CMD_DMIDECODE}" ]; then local vendor="$($CMD_DMIDECODE -s system-manufacturer 2>/dev/null | sed 's/ *$//g')" - echo "vendor ${vendor}" >> "$file" + echo "vendor ${vendor}" if [ "${vendor}" ]; then local product="$($CMD_DMIDECODE -s system-product-name 2>/dev/null | sed 's/ *$//g')" local version="$($CMD_DMIDECODE -s system-version 2>/dev/null | sed 's/ *$//g')" @@ -334,41 +324,33 @@ dmidecode_system_info () { local FUNCNAME=dmidecode_system_info; local servicetag="$($CMD_DMIDECODE -s system-serial-number 2>/dev/null | sed 's/ *$//g')" local system="${vendor}; ${product}; v${version} (${chassis})" - echo "system ${system}" >> "$file" - echo "servicetag ${servicetag:-Not found}" >> "$file" + echo "system ${system}" + echo "servicetag ${servicetag:-Not found}" fi fi } find_memory_stats () { local PTFUNCNAME=find_memory_stats; - local file="$1" - local platform="$2" + local platform="$1" + if [ "${platform}" = "Linux" ]; then - _d "In Linux, so saving the output of free -b" \ - "and /proc/meminfo into $file" - free -b > "$file" - cat /proc/meminfo >> "$file" + free -b + cat /proc/meminfo elif [ "${platform}" = "SunOS" ]; then - _d "In SunOS, calling prtconf" - $CMD_PRTCONF | awk -F: '/Memory/{print $2}' > "$file" + $CMD_PRTCONF | awk -F: '/Memory/{print $2}' fi } mounted_fs_info () { local PTFUNCNAME=mounted_fs_info; - local file="$1" - local platform="$2" - local skip="${3:-$PT_SUMMARY_SKIP}" + local platform="$1" - if echo "${skip}" | grep -v MOUNT >/dev/null; then - if [ "${platform}" != "SunOS" ]; then - local cmd="df -h" - if [ "${platform}" = "Linux" ]; then - cmd="df -h -P" - fi - _d "calling $cmd" - $cmd | sort > "$TMPDIR/mounted_fs_info.tmp" - mount | sort | join "$TMPDIR/mounted_fs_info.tmp" - > "$file" + if [ "${platform}" != "SunOS" ]; then + local cmd="df -h" + if [ "${platform}" = "Linux" ]; then + cmd="df -h -P" fi + $cmd | sort > "$TMPDIR/mounted_fs_info.tmp" + mount | sort | join "$TMPDIR/mounted_fs_info.tmp" - fi } @@ -378,9 +360,8 @@ mounted_fs_info () { local PTFUNCNAME=mounted_fs_info; # /var/log/dmesg if possible. # ######################################################################## raid_controller () { local PTFUNCNAME=raid_controller; - local file="$1" - local dmesg_file="$2" - local lspci_file="$3" + local dmesg_file="$1" + local lspci_file="$2" local tempfile="$TMPDIR/raid_controller.tmp" @@ -392,7 +373,7 @@ raid_controller () { local PTFUNCNAME=raid_controller; controller="$(find_raid_controller_dmesg "$dmesg_file")" fi - echo "raid_controller ${controller:-"No RAID controller detected"}" >> "$file" + echo "raid_controller ${controller:-"No RAID controller detected"}" } # ############################################################################## @@ -434,7 +415,7 @@ find_raid_controller_lspci () { local PTFUNCNAME=find_raid_controller_lspci; fi } -schedulers_and_queue_size () { local FUNCNAME=schedulers_and_queue_size; +schedulers_and_queue_size () { local PTFUNCNAME=schedulers_and_queue_size; local file="$1" local disk_partitioning_file="$2" @@ -449,64 +430,55 @@ schedulers_and_queue_size () { local FUNCNAME=schedulers_and_queue_size; done } -top_processes () { local FUNCNAME=top_processes; - local top_processes_file="$1" - local skip="${2:-"$PT_SUMMARY_SKIP"}" - - if echo "${skip}" | grep -v PROCESS >/dev/null; then - if [ -n "$CMD_PRSTAT" ]; then - $CMD_PRSTAT | head > "$top_processes_file" - elif [ -n "$CMD_TOP" ]; then - local cmd="$CMD_TOP -bn 1" - if [ "${platform}" = "FreeBSD" ] \ - || [ "${platform}" = "NetBSD" ] \ - || [ "${platform}" = "OpenBSD" ]; then - cmd="$CMD_TOP -b -d 1" - fi - $cmd | sed -e 's# *$##g' -e '/./{H;$!d;}' -e 'x;/PID/!d;' | grep . | head > "$top_processes_file" +top_processes () { local PTFUNCNAME=top_processes; + if [ "$CMD_PRSTAT" ]; then + $CMD_PRSTAT | head + elif [ "$CMD_TOP" ]; then + local cmd="$CMD_TOP -bn 1" + if [ "${platform}" = "FreeBSD" ] \ + || [ "${platform}" = "NetBSD" ] \ + || [ "${platform}" = "OpenBSD" ]; then + cmd="$CMD_TOP -b -d 1" fi + $cmd \ + | sed -e 's# *$##g' -e '/./{H;$!d;}' -e 'x;/PID/!d;' \ + | grep . \ + | head fi } notable_processes_info () { local PTFUNCNAME=notable_processes_info; - local notable_processes_file="$1" - local skip="${2:-"$PT_SUMMARY_SKIP"}" + local format="%5s %+2d %s\n" + local sshd_pid=$(_pidof "/usr/sbin/sshd") - if echo "${skip}" | grep -v PROCESS >/dev/null; then - local format="%5s %+2d %s\n" - local sshd_pid=$(_pidof "/usr/sbin/sshd") + echo " PID OOM COMMAND" - echo " PID OOM COMMAND" > "$notable_processes_file" - - # First, let's find the oom value of sshd - if [ "$sshd_pid" ]; then - printf "$format" $sshd_pid $(get_oom_of_pid $sshd_pid) "sshd" >> "$notable_processes_file" - else - printf "%5s %3s %s\n" "?" "?" "sshd doesn't appear to be running" >> "$notable_processes_file" - fi - - # Disabling PTDEBUG for the remainder of this function, otherwise we get several - # hundred linebs of mostly useless debug output - local PTDEBUG="" - # Let's find out if any process has an oom of -17 - ps -eo pid,ucomm | tail -n +2 | while read pid proc; do - # Skip sshd, since we manually checked this before - [ "$sshd_pid" ] && [ "$sshd_pid" = "$pid" ] && continue - local oom="$(get_oom_of_pid $pid)" - if [ "$oom" ] && [ "$oom" != "?" ] && [ "$oom" = "-17" ]; then - printf "$format" $pid $oom $proc >> "$notable_processes_file" - fi - done + # First, let's find the oom value of sshd + if [ "$sshd_pid" ]; then + printf "$format" "$sshd_pid" "$(get_oom_of_pid $sshd_pid)" "sshd" + else + printf "%5s %3s %s\n" "?" "?" "sshd doesn't appear to be running" fi + + # Disabling PTDEBUG for the remainder of this function, otherwise we get several + # hundred lines of mostly useless debug output + local PTDEBUG="" + # Let's find out if any process has an oom of -17 + ps -eo pid,ucomm | grep '^[0-9]' | while read pid proc; do + # Skip sshd, since we manually checked this before + [ "$sshd_pid" ] && [ "$sshd_pid" = "$pid" ] && continue + local oom="$(get_oom_of_pid $pid)" + if [ "$oom" ] && [ "$oom" != "?" ] && [ "$oom" = "-17" ]; then + printf "$format" "$pid" "$oom" "$proc" + fi + done } -processor_info () { local FUNCNAME=processor_info; +processor_info () { local PTFUNCNAME=processor_info; local data_dir="$1" if [ -f /proc/cpuinfo ]; then - _d "Got /proc/cpuinfo, copying that" cat /proc/cpuinfo > "$data_dir/proc_cpuinfo_copy" 2>/dev/null elif [ "${platform}" = "SunOS" ]; then - _d "On SunOS, using psrinfo" $CMD_PSRINFO -v > "$data_dir/psrinfo_minus_v" fi } @@ -517,15 +489,12 @@ processor_info () { local FUNCNAME=processor_info; # in a weird location, such as /usr/StorMan/arcconf, should have their # location added to $PATH at the beginning of main(). # ######################################################################## -propietary_raid_controller () { local FUNCNAME=propietary_raid_controller; +propietary_raid_controller () { local PTFUNCNAME=propietary_raid_controller; local file="$1" local variable_file="$2" local data_dir="$3" local controller="$4" - rm -f "$file" - touch "$file" - notfound="" if [ "${controller}" = "AACRAID" ]; then if [ -z "$CMD_ARCCONF" ]; then diff --git a/lib/bash/report_mysql_info.sh b/lib/bash/report_mysql_info.sh index 11f67a5a..17fe4760 100644 --- a/lib/bash/report_mysql_info.sh +++ b/lib/bash/report_mysql_info.sh @@ -102,6 +102,8 @@ get_plugin_status () { _NO_FALSE_NEGATIVES="" parse_mysqld_instances () { local file="$1" + local variables_file="$2" + local socket=${socket:-""} local port=${port:-""} local datadir="${datadir:-""}" @@ -126,14 +128,14 @@ parse_mysqld_instances () { datadir="$(echo "${word}" | cut -d= -f2)" fi done - local nice=$(get_nice_of_pid $pid ) - local oom=$(get_oom_of_pid $pid ) + local nice="$(get_var "internal::nice_of_$pid" "$variables_file")" + local oom="$(get_var "internal::oom_of_$pid" "$variables_file")" # Only used during testing if [ -n "${_NO_FALSE_NEGATIVES}" ]; then nice="?" oom="?" fi - printf " %5s %-26s %-4s %-3s %s\n" "${port}" "${datadir}" "${nice}" "${oom}" "${socket}" + printf " %5s %-26s %-4s %-3s %s\n" "${port}" "${datadir}" "${nice:-"?"}" "${oom:-"?"}" "${socket}" done } @@ -849,7 +851,7 @@ section_percona_server_features () { "$(feat_on "$file" innodb_adaptive_checkpoint ne none)" name_val "HandlerSocket NoSQL" \ "$(feat_on "$file" handlersocket_port)" - name_val "Fast Maatkit Hashes" \ + name_val "Fast Hash UDFs" \ "$(get_var "pt-summary-internal-FNV_64" "$file")" } @@ -1055,9 +1057,10 @@ report_mysql_summary () { section Percona_Toolkit_MySQL_Summary_Report name_val "System time" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" section Instances - parse_mysqld_instances "$dir/${prefix}-mysqld-instances" + parse_mysqld_instances "$dir/${prefix}-mysqld-instances" "$dir/${prefix}-mysql-variables" section MySQL_Executable + name_val "Path to executable" "$( get_var pt-summary-internal-mysql_executable "$dir/${prefix}-mysql-variables" )" name_val "Has symbols" "$( get_var "pt-summary-internal-symbols" "$dir/${prefix}-mysql-variables" )" # ######################################################################## @@ -1174,8 +1177,10 @@ report_mysql_summary () { # 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" - # But dump no matter what if they passed in something through --dump-schemas - if [ -n "${OPT_DUMP_SCHEMAS}" ]; then + # But dump no matter what if they passed in something through --dump-schemas, + # OR if --read-samples was set + if [ -n "${OPT_DATABASES}" ] || [ -n "${OPT_READ_SAMPLES}" ] \ + || [ -e "$dir/${prefix}-mysqldump" -a -s "$dir/${prefix}-mysqldump" ]; then reply="y" elif [ -t 0 -a -t 1 ]; then echo -n "Would you like to mysqldump -d the schema and analyze it? y/n " @@ -1183,10 +1188,9 @@ report_mysql_summary () { reply=${reply:-n} fi if echo "${reply:-n}" | grep -i '^y' > /dev/null ; then - if [ -z "${OPT_DUMP_SCHEMAS}" ]; then - # If --dump-schemas wasn't used, ask what they want - - # Find out which databases to dump + if [ -z "${OPT_DATABASES}" ] && [ -z "$OPT_READ_SAMPLES" ] \ + && [ ! -e "$dir/${prefix}-mysqldump" ]; then + # If --dump-schemas wasn't used, ask what they want to dump echo "There are ${num_dbs} databases. Would you like to dump all, or just one?" echo -n "Type the name of the database, or press Enter to dump all of them. " local dbtodump="" @@ -1198,7 +1202,6 @@ report_mysql_summary () { # Test the result by checking the file, not by the exit status, because we # might get partway through and then die, and the info is worth analyzing # anyway. - if [ -e "$dir/${prefix}-mysqldump" -a -s "$dir/${prefix}-mysqldump" ] \ && grep 'CREATE TABLE' "$dir/${prefix}-mysqldump" >/dev/null 2>&1; then format_overall_db_stats "$dir/${prefix}-mysqldump" diff --git a/lib/bash/report_system_info.sh b/lib/bash/report_system_info.sh index a2ef2c5f..b2b3a265 100644 --- a/lib/bash/report_system_info.sh +++ b/lib/bash/report_system_info.sh @@ -43,8 +43,8 @@ parse_proc_cpuinfo () { local PTFUNCNAME=parse_proc_cpuinfo; local cores="$(grep 'cpu cores' "${file}" | head -n 1 | cut -d: -f2)"; # Older kernel won't have 'physical id' or 'cpu cores'. - if [ "${physical}" = "0" ]; then physical="${virtual}"; fi - if [ -z "${cores}" ]; then cores=0; fi + [ "${physical}" = "0" ] && physical="${virtual}" + [ -z "${cores}" ] && cores=0 # Test for HTT; cannot trust the 'ht' flag. If physical * cores < virtual, # then hyperthreading is in use. @@ -73,7 +73,7 @@ parse_proc_cpuinfo () { local PTFUNCNAME=parse_proc_cpuinfo; # ############################################################################## parse_sysctl_cpu_freebsd() { local PTFUNCNAME=parse_sysctl_cpu_freebsd; local file="$1" - test ! -e "$file" && return; + [ -e "$file" ] || return; local virtual="$(awk '/hw.ncpu/{print $2}' "$file")" name_val "Processors" "virtual = ${virtual}" name_val "Speeds" "$(awk '/hw.clockrate/{print $2}' "$file")" @@ -87,7 +87,7 @@ parse_sysctl_cpu_netbsd() { local PTFUNCNAME=parse_sysctl_cpu_netbsd; local file="$1" # return early if they didn't pass in a file - test ! -e "$file" && return + [ -e "$file" ] || return local virtual="$(awk '/hw.ncpu /{print $NF}' "$file")" name_val "Processors" "virtual = ${virtual}" @@ -101,7 +101,7 @@ parse_sysctl_cpu_netbsd() { local PTFUNCNAME=parse_sysctl_cpu_netbsd; parse_sysctl_cpu_openbsd() { local PTFUNCNAME=parse_sysctl_cpu_openbsd; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return name_val "Processors" "$(awk -F= '/hw.ncpu=/{print $2}' "$file")" name_val "Speeds" "$(awk -F= '/hw.cpuspeed/{print $2}' "$file")" @@ -114,9 +114,9 @@ parse_sysctl_cpu_openbsd() { local PTFUNCNAME=parse_sysctl_cpu_openbsd; parse_psrinfo_cpus() { local PTFUNCNAME=parse_psrinfo_cpus; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return - name_val Processors "$(grep -c 'Status of .* processor' "$file")" + name_val "Processors" "$(grep -c 'Status of .* processor' "$file")" awk '/operates at/ { start = index($0, " at ") + 4; end = length($0) - start - 4 @@ -131,19 +131,19 @@ parse_psrinfo_cpus() { local PTFUNCNAME=parse_psrinfo_cpus; parse_free_minus_b () { local PTFUNCNAME=parse_free_minus_b; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local physical=$(awk '/Mem:/{print $3}' "${file}") local swap_alloc=$(awk '/Swap:/{print $2}' "${file}") local swap_used=$(awk '/Swap:/{print $3}' "${file}") local virtual=$(shorten $(($physical + $swap_used)) 1) - name_val Total $(shorten $(awk '/Mem:/{print $2}' "${file}") 1) - name_val Free $(shorten $(awk '/Mem:/{print $4}' "${file}") 1) - name_val Used "physical = $(shorten ${physical} 1), swap allocated = $(shorten ${swap_alloc} 1), swap used = $(shorten ${swap_used} 1), virtual = ${virtual}" - name_val Buffers $(shorten $(awk '/Mem:/{print $6}' "${file}") 1) - name_val Caches $(shorten $(awk '/Mem:/{print $7}' "${file}") 1) - name_val Dirty "$(awk '/Dirty:/ {print $2, $3}' "${file}")" + name_val "Total" $(shorten $(awk '/Mem:/{print $2}' "${file}") 1) + name_val "Free" $(shorten $(awk '/Mem:/{print $4}' "${file}") 1) + name_val "Used" "physical = $(shorten ${physical} 1), swap allocated = $(shorten ${swap_alloc} 1), swap used = $(shorten ${swap_used} 1), virtual = ${virtual}" + name_val "Buffers" $(shorten $(awk '/Mem:/{print $6}' "${file}") 1) + name_val "Caches" $(shorten $(awk '/Mem:/{print $7}' "${file}") 1) + name_val "Dirty" "$(awk '/Dirty:/ {print $2, $3}' "${file}")" } # ############################################################################## @@ -152,7 +152,7 @@ parse_free_minus_b () { local PTFUNCNAME=parse_free_minus_b; parse_memory_sysctl_freebsd() { local PTFUNCNAME=parse_memory_sysctl_freebsd; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local physical=$(awk '/hw.realmem:/{print $2}' "${file}") local mem_hw=$(awk '/hw.physmem:/{print $2}' "${file}") @@ -169,9 +169,9 @@ parse_memory_sysctl_freebsd() { local PTFUNCNAME=parse_memory_sysctl_freebsd; print mem_hw - mem_inactive - mem_cache - mem_free; } ' "$file"); - name_val Total $(shorten ${mem_hw} 1) - name_val Virtual $(shorten ${physical} 1) - name_val Used $(shorten ${mem_used} 1) + name_val "Total" $(shorten ${mem_hw} 1) + name_val "Virtual" $(shorten ${physical} 1) + name_val "Used" $(shorten ${mem_used} 1) } # ############################################################################## @@ -181,12 +181,12 @@ parse_memory_sysctl_netbsd() { local PTFUNCNAME=parse_memory_sysctl_netbsd; local file="$1" local swapctl_file="$2" - test ! -e "$file" -o ! -e "$swapctl_file" && return + [ -e "$file" -a -e "$swapctl_file" ] || return local swap_mem="$(echo "$(awk '{print $2;}' "$swapctl_file")*512" | bc -l)" - name_val Total $(shorten "$(awk '/hw.physmem /{print $NF}' "$file")" 1) - name_val User $(shorten "$(awk '/hw.usermem /{print $NF}' "$file")" 1) - name_val Swap $(shorten ${swap_mem} 1) + name_val "Total" $(shorten "$(awk '/hw.physmem /{print $NF}' "$file")" 1) + name_val "User" $(shorten "$(awk '/hw.usermem /{print $NF}' "$file")" 1) + name_val "Swap" $(shorten ${swap_mem} 1) } # ############################################################################## @@ -196,12 +196,12 @@ parse_memory_sysctl_openbsd() { local PTFUNCNAME=parse_memory_sysctl_openbsd; local file="$1" local swapctl_file="$2" - test ! -e "$file" -o ! -e "$swapctl_file" && return + [ -e "$file" -a -e "$swapctl_file" ] || return local swap_mem="$(echo "$(awk '{print $2;}' "$swapctl_file")*512" | bc -l)" - name_val Total $(shorten "$(awk -F= '/hw.physmem/{print $2}' "$file")" 1) - name_val User $(shorten "$(awk -F= '/hw.usermem/{print $2}' "$file")" 1) - name_val Swap $(shorten ${swap_mem} 1) + name_val "Total" $(shorten "$(awk -F= '/hw.physmem/{print $2}' "$file")" 1) + name_val "User" $(shorten "$(awk -F= '/hw.usermem/{print $2}' "$file")" 1) + name_val "Swap" $(shorten ${swap_mem} 1) } # ############################################################################## @@ -210,7 +210,7 @@ parse_memory_sysctl_openbsd() { local PTFUNCNAME=parse_memory_sysctl_openbsd; parse_dmidecode_mem_devices () { local PTFUNCNAME=parse_dmidecode_mem_devices; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo " Locator Size Speed Form Factor Type Type Detail" echo " ========= ======== ================= ============= ============= ===========" @@ -242,7 +242,7 @@ parse_dmidecode_mem_devices () { local PTFUNCNAME=parse_dmidecode_mem_devices; parse_ip_s_link () { local PTFUNCNAME=parse_ip_s_link; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo " interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors" echo " ========= ========= ========== ========== ========== ========== ==========" @@ -273,7 +273,7 @@ parse_ip_s_link () { local PTFUNCNAME=parse_ip_s_link; parse_netstat () { local PTFUNCNAME=parse_netstat; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo " Connections from remote IP addresses" awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ { @@ -327,7 +327,7 @@ parse_filesystems () { local PTFUNCNAME=parse_filesystems; local file="$1" local platform="$2" - test ! -e "$file" && return + [ -e "$file" ] || return local spec="$(awk " BEGIN { @@ -384,7 +384,7 @@ parse_filesystems () { local PTFUNCNAME=parse_filesystems; parse_fdisk () { local PTFUNCNAME=parse_fdisk; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return awk ' BEGIN { @@ -420,10 +420,10 @@ parse_fdisk () { local PTFUNCNAME=parse_fdisk; parse_ethernet_controller_lspci () { local PTFUNCNAME=parse_ethernet_controller_lspci; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return grep -i ethernet "${file}" | cut -d: -f3 | while read line; do - name_val Controller "${line}" + name_val "Controller" "${line}" done } @@ -433,7 +433,7 @@ parse_ethernet_controller_lspci () { local PTFUNCNAME=parse_ethernet_controller_ # ############################################################################## parse_hpacucli () { local PTFUNCNAME=parse_hpacucli; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return grep 'logicaldrive\|physicaldrive' "${file}" } @@ -443,13 +443,13 @@ parse_hpacucli () { local PTFUNCNAME=parse_hpacucli; parse_arcconf () { local PTFUNCNAME=parse_arcconf; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local model="$(awk -F: '/Controller Model/{print $2}' "${file}")" local chan="$(awk -F: '/Channel description/{print $2}' "${file}")" local cache="$(awk -F: '/Installed memory/{print $2}' "${file}")" local status="$(awk -F: '/Controller Status/{print $2}' "${file}")" - name_val Specs "$(echo "$model" | sed -e 's/ //'),${chan},${cache} cache,${status}" + name_val "Specs" "$(echo "$model" | sed -e 's/ //'),${chan},${cache} cache,${status}" local battery="" if grep -q "ZMM" "$file"; then @@ -463,7 +463,7 @@ parse_arcconf () { local PTFUNCNAME=parse_arcconf; /Time remaining/ {t=sprintf("%dd%dh%dm", $7, $9, $11)} END {printf("%d%%, %s remaining, %s", c, t, s)}')" fi - name_val Battery "${battery}" + name_val "Battery" "${battery}" # ########################################################################### # Logical devices @@ -565,7 +565,7 @@ parse_fusionmpt_lsiutil () { local PTFUNCNAME=parse_fusionmpt_lsiutil; parse_lsi_megaraid_adapter_info () { local PTFUNCNAME=parse_lsi_megaraid_adapter_info; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local name="$(awk -F: '/Product Name/{print substr($2, 2)}' "${file}")"; local int=$(awk '/Host Interface/{print $4}' "${file}"); @@ -578,8 +578,8 @@ parse_lsi_megaraid_adapter_info () { local PTFUNCNAME=parse_lsi_megaraid_adapter local crd=$(awk '/Critical Disks/{print $4}' "${file}"); local fad=$(awk '/Failed Disks/{print $4}' "${file}"); - name_val Model "${name}, ${int} interface, ${prt} ports" - name_val Cache "${mem} Memory, BBU ${bbu}" + name_val "Model" "${name}, ${int} interface, ${prt} ports" + name_val "Cache" "${mem} Memory, BBU ${bbu}" } # ############################################################################## @@ -589,12 +589,12 @@ parse_lsi_megaraid_adapter_info () { local PTFUNCNAME=parse_lsi_megaraid_adapter parse_lsi_megaraid_bbu_status () { local PTFUNCNAME=parse_lsi_megaraid_bbu_status; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return local charge=$(awk '/Relative State/{print $5}' "${file}"); local temp=$(awk '/^Temperature/{print $2}' "${file}"); local soh=$(awk '/isSOHGood:/{print $2}' "${file}"); - name_val BBU "${charge}% Charged, Temperature ${temp}C, isSOHGood=${soh}" + name_val "BBU" "${charge}% Charged, Temperature ${temp}C, isSOHGood=${soh}" } # ############################################################################## @@ -609,7 +609,7 @@ format_lvs () { local PTFUNCNAME=format_lvs; if [ -e "$lvs_file" -a -e "$vgs_file" ]; then local header="$(head -n1 "$lvs_file")$(head -n1 "$vgs_file" | sed -e 's/^ *VG//')" - echo $header + echo "$header" tail -n+2 "$lvs_file" | while read lvs_line; do local current_vg="$(echo $lvs_line | awk '{print $2}')" while read vgs_line; do @@ -639,7 +639,7 @@ format_lvs () { local PTFUNCNAME=format_lvs; parse_lsi_megaraid_devices () { local PTFUNCNAME=parse_lsi_megaraid_devices; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return echo echo " PhysiclDev Type State Errors Vendor Model Size" @@ -671,7 +671,7 @@ parse_lsi_megaraid_devices () { local PTFUNCNAME=parse_lsi_megaraid_devices; parse_lsi_megaraid_virtual_devices () { local PTFUNCNAME=parse_lsi_megaraid_virtual_devices; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return # Somewhere on the Internet, I found the following guide to understanding the # RAID level, but I don't know the source anymore. @@ -753,7 +753,7 @@ parse_lsi_megaraid_virtual_devices () { local PTFUNCNAME=parse_lsi_megaraid_virt format_vmstat () { local PTFUNCNAME=format_vmstat; local file="$1" - test ! -e "$file" && return + [ -e "$file" ] || return awk " BEGIN { @@ -790,72 +790,28 @@ processes_section () { local PTFUNCNAME=processes_section; local vmstat_file="$3" local platform="$4" - if echo "${PT_SUMMARY_SKIP}" | grep -v PROCESS >/dev/null; then - section Top_Processes - cat "$top_process_file" - section Notable_Processes - cat "$notable_procs_file" - if [ -e "$vmstat_file" ]; then - 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" - else - # TODO: simplify/format for other platforms - cat "$vmstat_file" - fi + section "Top_Processes" + cat "$top_process_file" + section "Notable_Processes" + cat "$notable_procs_file" + if [ -e "$vmstat_file" ]; then + 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" + else + # TODO: simplify/format for other platforms + cat "$vmstat_file" fi fi } -# The sum of all of the above -report_system_summary () { local PTFUNCNAME=report_system_summary; - local data_dir="$1" +section_Processor () { + local platform="$1" + local data_dir="$2" - section Percona_Toolkit_System_Summary_Report + section "Processor" - # ######################################################################## - # General date, time, load, etc - # ######################################################################## - - test ! -e "$data_dir/summary" \ - && die "The data directory doesn't have a summary file, exiting." - - local platform="$(get_var platform "$data_dir/summary")" - name_val "Date" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" - name_val "Hostname" "$(get_var hostname "$data_dir/summary")" - name_val "Uptime" "$(get_var uptime "$data_dir/summary")" - - if [ -n "$(get_var vendor "$data_dir/summary")" ]; then - name_val "System" "$(get_var system "$data_dir/summary")"; - name_val "Service Tag" "$(get_var servicetag "$data_dir/summary")"; - fi - - name_val "Platform" "${platform}" - local zonename="$(get_var zonename "$data_dir/summary")"; - if [ -n "${zonename}" ]; then - name_val "Zonename" "$zonename" - fi - - name_val Release "$(get_var release "$data_dir/summary")" - name_val Kernel "$(get_var kernel "$data_dir/summary")" - - name_val "Architecture" "CPU = $(get_var CPU_ARCH "$data_dir/summary"), OS = $(get_var OS_ARCH "$data_dir/summary")" - - local threading="$(get_var threading "$data_dir/summary")" - local compiler="$(get_var compiler "$data_dir/summary")" - [ -n "$threading" ] && name_val Threading "$threading" - [ -n "$compiler" ] && name_val Compiler "$compiler" - - local getenforce="$(get_var getenforce "$data_dir/summary")" - [ -n "$getenforce" ] && name_val "SELinux" "${getenforce}"; - - name_val Virtualized "$(get_var virt "$data_dir/summary")" - - # ######################################################################## - # Processor/CPU, Memory, Swappiness, dmidecode - # ######################################################################## - section Processor if [ -e "$data_dir/proc_cpuinfo_copy" ]; then parse_proc_cpuinfo "$data_dir/proc_cpuinfo_copy" elif [ "${platform}" = "FreeBSD" ]; then @@ -868,8 +824,13 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; parse_psrinfo_cpus "$data_dir/psrinfo_minus_v" # TODO: prtconf -v actually prints the CPU model name etc. fi +} - section Memory +section_Memory () { + local platform="$1" + local data_dir="$2" + + section "Memory" if [ "${platform}" = "Linux" ]; then parse_free_minus_b "$data_dir/memory" elif [ "${platform}" = "FreeBSD" ]; then @@ -879,24 +840,74 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; elif [ "${platform}" = "OpenBSD" ]; then parse_memory_sysctl_openbsd "$data_dir/sysctl" "$data_dir/swapctl" elif [ "${platform}" = "SunOS" ]; then - name_val Memory "$(cat "$data_dir/memory")" + name_val "Memory" "$(cat "$data_dir/memory")" fi - local rss=$( get_var rss "$data_dir/summary" ) - name_val UsedRSS "$(shorten ${rss} 1)" + local rss=$( get_var "rss" "$data_dir/summary" ) + name_val "UsedRSS" "$(shorten ${rss} 1)" if [ "${platform}" = "Linux" ]; then - name_val Swappiness "$(get_var swappiness "$data_dir/summary")" - name_val DirtyPolicy "$(get_var dirtypolicy "$data_dir/summary")" - local dirty_status="$(get_var dirtystatus "$data_dir/summary")" + name_val "Swappiness" "$(get_var "swappiness" "$data_dir/summary")" + name_val "DirtyPolicy" "$(get_var "dirtypolicy" "$data_dir/summary")" + local dirty_status="$(get_var "dirtystatus" "$data_dir/summary")" if [ -n "$dirty_status" ]; then - name_val DirtyStatus "$dirty_status" + name_val "DirtyStatus" "$dirty_status" fi fi if [ -s "$data_dir/dmidecode" ]; then parse_dmidecode_mem_devices "$data_dir/dmidecode" fi +} + +# The sum of all of the above +report_system_summary () { local PTFUNCNAME=report_system_summary; + local data_dir="$1" + + section "Percona_Toolkit_System_Summary_Report" + + # ######################################################################## + # General date, time, load, etc + # ######################################################################## + + [ -e "$data_dir/summary" ] \ + || die "The data directory doesn't have a summary file, exiting." + + local platform="$(get_var "platform" "$data_dir/summary")" + name_val "Date" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" + name_val "Hostname" "$(get_var hostname "$data_dir/summary")" + name_val "Uptime" "$(cat "$data_dir/uptime")" + + if [ "$(get_var "vendor" "$data_dir/summary")" ]; then + name_val "System" "$(get_var "system" "$data_dir/summary")"; + name_val "Service Tag" "$(get_var "servicetag" "$data_dir/summary")"; + fi + + name_val "Platform" "${platform}" + local zonename="$(get_var zonename "$data_dir/summary")"; + [ -n "${zonename}" ] && name_val "Zonename" "$zonename" + + name_val "Release" "$(get_var "release" "$data_dir/summary")" + name_val "Kernel" "$(get_var "kernel" "$data_dir/summary")" + + name_val "Architecture" "CPU = $(get_var "CPU_ARCH" "$data_dir/summary"), OS = $(get_var "OS_ARCH" "$data_dir/summary")" + + local threading="$(get_var threading "$data_dir/summary")" + local compiler="$(get_var compiler "$data_dir/summary")" + [ -n "$threading" ] && name_val "Threading" "$threading" + [ -n "$compiler" ] && name_val "Compiler" "$compiler" + + local getenforce="$(get_var getenforce "$data_dir/summary")" + [ -n "$getenforce" ] && name_val "SELinux" "${getenforce}"; + + name_val "Virtualized" "$(get_var "virt" "$data_dir/summary")" + + # ######################################################################## + # Processor/CPU, Memory, Swappiness, dmidecode + # ######################################################################## + section_Processor "$platform" "$data_dir" + + section_Memory "$platform" "$data_dir" # ######################################################################## # Disks, RAID, Filesystems @@ -909,8 +920,8 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; fi if [ "${platform}" = "Linux" ]; then - section "Disk_Schedulers_And_Queue_Size" + section "Disk_Schedulers_And_Queue_Size" local disks="$( get_var disks "$data_dir/summary" )" for disk in ${disks}; do name_val "${disk}" "$( get_var "internal::${disk}" "$data_dir/summary" )" @@ -929,8 +940,8 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; fi section "RAID_Controller" - local controller="$(get_var raid_controller "$data_dir/summary")" - name_val Controller "$controller" + local controller="$(get_var "raid_controller" "$data_dir/summary")" + name_val "Controller" "$controller" local key="$(get_var "internal::raid_opt" "$data_dir/summary")" case "$key" in 0) @@ -957,16 +968,16 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; ;; esac - if echo "${PT_SUMMARY_SKIP}" | grep -v NETWORK >/dev/null; then + if [ "${OPT_SUMMARIZE_NETWORK}" ]; then # ##################################################################### # 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 - if grep net.ipv4.tcp_fin_timeout "$data_dir/sysctl" > /dev/null 2>&1; then + if grep "net.ipv4.tcp_fin_timeout" "$data_dir/sysctl" > /dev/null 2>&1; then name_val "FIN Timeout" "$(awk '/net.ipv4.tcp_fin_timeout/{print $NF}' "$data_dir/sysctl")" name_val "Port Range" "$(awk '/net.ipv4.ip_local_port_range/{print $NF}' "$data_dir/sysctl")" fi @@ -977,12 +988,12 @@ 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 [ "${platform}" = "Linux" ] && [ -e "$data_dir/netstat" ]; then - section Network_Connections + if [ "${platform}" = "Linux" -a -e "$data_dir/netstat" ]; then + section "Network_Connections" parse_netstat "$data_dir/netstat" fi fi @@ -990,12 +1001,16 @@ report_system_summary () { local PTFUNCNAME=report_system_summary; # ######################################################################## # Processes, load, etc # ######################################################################## - processes_section "$data_dir/processes" "$data_dir/notable_procs" "$data_dir/vmstat" "$platform" + [ "$OPT_SUMMARIZE_PROCESSES" ] && processes_section \ + "$data_dir/processes" \ + "$data_dir/notable_procs" \ + "$data_dir/vmstat" \ + "$platform" # ######################################################################## # All done. Signal the end so it's explicit. # ######################################################################## - section The_End + section "The_End" } # ########################################################################### diff --git a/lib/bash/summary_common.sh b/lib/bash/summary_common.sh index 3b893040..41991a9b 100644 --- a/lib/bash/summary_common.sh +++ b/lib/bash/summary_common.sh @@ -32,7 +32,7 @@ CMD_OBJDUMP="$( _which objdump 2>/dev/null )" # Returns the nice for the pid, or "?" if it can't find any. get_nice_of_pid () { local pid="$1" - local niceness=$(ps -p $pid -o nice | tail -n+2 | awk '{print $1; exit;}') + local niceness="$(ps -p $pid -o nice | awk '$1 !~ /[^0-9]/ {print $1; exit}')" if [ -n "${niceness}" ]; then echo $niceness @@ -78,7 +78,7 @@ get_oom_of_pid () { local pid="$1" local oom_adj="" - if [ -n "${pid}" ] && [ -e /proc/cpuinfo ]; then + if [ -n "${pid}" -a -e /proc/cpuinfo ]; then if [ -s "/proc/$pid/oom_score_adj" ]; then oom_adj=$(cat "/proc/$pid/oom_score_adj" 2>/dev/null) _d "For $pid, the oom value is $oom_adj, retreived from oom_score_adj" @@ -123,6 +123,7 @@ has_symbols () { } setup_data_dir () { + local OPT_SAVE_DATA="$1" local data_dir="" if [ -z "$OPT_SAVE_DATA" ]; then # User didn't specify a --save-data dir, so use a sub-dir in our tmpdir. @@ -144,13 +145,7 @@ setup_data_dir () { get_var () { local varname="$1" local file="$2" - local v="$(awk "\$1 ~ /^${varname}$/ { if (length(\$2)) { print substr(\$0, index(\$0,\$2)) } }" "${file}")" - if [ -n "$v" ]; then - echo "$v" - return 0 - else - return 1 - fi + echo "$(awk "\$1 ~ /^${varname}$/ { if (length(\$2)) { print substr(\$0, index(\$0,\$2)) } }" "${file}")" } # ########################################################################### diff --git a/t/lib/bash/collect_mysql_info.sh b/t/lib/bash/collect_mysql_info.sh index ebde1a37..c18425e3 100644 --- a/t/lib/bash/collect_mysql_info.sh +++ b/t/lib/bash/collect_mysql_info.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -plan 15 +plan 20 TMPDIR="$TEST_TMPDIR" PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin" @@ -28,10 +28,10 @@ wait file_count=$(ls "$p" | wc -l) -is $file_count 12 "Creates the correct number of files (without --dump-schemas)" +is $file_count 12 "Creates the correct number of files (without --databases)" -grep -v grep "$p/percona-toolkit-mysqld-instances" | awk '{print $2}' > "$TMPDIR/collect_mysqld_instances1.test" -ps auxww 2>/dev/null | grep mysqld | grep -v grep | awk '{print $2}' > "$TMPDIR/collect_mysqld_instances2.test" +awk '{print $1}' "$p/percona-toolkit-mysqld-instances" > "$TMPDIR/collect_mysqld_instances1.test" +ps ww -p "$(_pidof mysqld | sed -e "s/ /,/g")" | awk '{print $1}' > "$TMPDIR/collect_mysqld_instances2.test" no_diff \ "$TMPDIR/collect_mysqld_instances1.test" \ @@ -40,7 +40,7 @@ no_diff \ collect_mysqld_instances "$TMPDIR/collect_mysqld_instances3.test" -grep -v grep "$TMPDIR/collect_mysqld_instances3.test" | awk '{print $2}' > "$TMPDIR/collect_mysqld_instances4.test" +awk '{print $1}' "$TMPDIR/collect_mysqld_instances3.test"> "$TMPDIR/collect_mysqld_instances4.test" no_diff \ "$TMPDIR/collect_mysqld_instances4.test" \ @@ -127,3 +127,71 @@ if [ -n "$(get_var log_bin "$p/percona-toolkit-mysql-variables")" ]; then else skip 1 2 "no binlog" fi + +# get_mysqldump_for + +test_get_mysqldump_for () { + local dir="$1" + # Let's fake mysqldump + + printf '#!/usr/bin/env bash\necho $@\n' > "$TMPDIR/mysqldump_fake.sh" + chmod +x "$TMPDIR/mysqldump_fake.sh" + local orig_mysqldump="$CMD_MYSQLDUMP" + local CMD_MYSQLDUMP="$TMPDIR/mysqldump_fake.sh" + + cat < "$TMPDIR/expected" +--defaults-file=/tmp/12345/my.sandbox.cnf --no-data --skip-comments --skip-add-locks --skip-add-drop-table --compact --skip-lock-all-tables --skip-lock-tables --skip-set-charset --databases --all-databases +EOF + get_mysqldump_for "$dir/mysqldump_test_1" '' + no_diff \ + "$dir/mysqldump_test_1" \ + "$TMPDIR/expected" \ + "get_mysqldump_for picks a name default" + + get_mysqldump_for "$dir/mysqldump_test_2" '' '--all-databases' + no_diff \ + "$dir/mysqldump_test_2" \ + "$TMPDIR/expected" \ + "..which is the same as if we explicitly set --all-databases" + + cat < "$TMPDIR/expected" +--defaults-file=/tmp/12345/my.sandbox.cnf --no-data --skip-comments --skip-add-locks --skip-add-drop-table --compact --skip-lock-all-tables --skip-lock-tables --skip-set-charset --databases a +EOF + get_mysqldump_for "$dir/mysqldump_test_3" '' 'a' + no_diff \ + "$dir/mysqldump_test_3" \ + "$TMPDIR/expected" \ + "get_mysqldump_for: Explicitly setting a database works" + + cat < "$TMPDIR/expected" +--defaults-file=/tmp/12345/my.sandbox.cnf --no-data --skip-comments --skip-add-locks --skip-add-drop-table --compact --skip-lock-all-tables --skip-lock-tables --skip-set-charset --databases a b +EOF + get_mysqldump_for "$dir/mysqldump_test_4" '' 'a,b' + no_diff \ + "$dir/mysqldump_test_4" \ + "$TMPDIR/expected" \ + "get_mysqldump_for: Two databases separated by a comma are interpreted correctly" + + if [ -n "$orig_mysqldump" ]; then + local CMD_MYSQLDUMP="$orig_mysqldump" + $CMD_MYSQL $EXT_ARGV -ss -e 'CREATE DATABASE collect_mysql_databases_test1;' 1>/dev/null 2>&1 + $CMD_MYSQL $EXT_ARGV -ss -e 'CREATE DATABASE collect_mysql_databases_test2;' 1>/dev/null 2>&1 + + get_mysqldump_for "$dir/mysqldump_test_5" '' "collect_mysql_databases_test1,collect_mysql_databases_test2" + + like \ + "$(cat $dir/mysqldump_test_5)" \ + 'use `collect_mysql_databases_test1`.*use `collect_mysql_databases_test2`|use `collect_mysql_databases_test2`.*use `collect_mysql_databases_test1`' \ + "get_mysqldump_for dumps the dbs we request" + + $CMD_MYSQL $EXT_ARGV -ss -e 'DROP DATABASE collect_mysql_databases_test1;' + $CMD_MYSQL $EXT_ARGV -ss -e 'DROP DATABASE collect_mysql_databases_test2;' + + else + skip 1 1 "No mysqldump" + fi + +} + +mkdir "$TMPDIR/mysqldump" +test_get_mysqldump_for "$TMPDIR/mysqldump" diff --git a/t/lib/bash/collect_system_info.sh b/t/lib/bash/collect_system_info.sh index 8d687f26..3be24fa1 100644 --- a/t/lib/bash/collect_system_info.sh +++ b/t/lib/bash/collect_system_info.sh @@ -10,6 +10,7 @@ TOOL="pt-summary" . "$LIB_DIR/alt_cmds.sh" . "$LIB_DIR/parse_options.sh" . "$LIB_DIR/summary_common.sh" +. "$LIB_DIR/parse_options.sh" . "$LIB_DIR/collect_system_info.sh" # Prefix (with path) for the collect files. @@ -18,7 +19,8 @@ samples="$PERCONA_TOOLKIT_BRANCH/t/pt-summary/samples" mkdir "$p" -OPT_SLEEP="1" +parse_options "$BIN_DIR/pt-summary" --sleep 1 + collect_system_data "$p" cat < "$TMPDIR/expected" @@ -106,7 +108,7 @@ no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmesg-007.txt" # raid_controller rm "$TMPDIR/raid_controller_outfile.tmp" 2>/dev/null -raid_controller "$TMPDIR/raid_controller_outfile.tmp" "" "" +raid_controller "" "" > "$TMPDIR/raid_controller_outfile.tmp" is \ "$(get_var raid_controller "$TMPDIR/raid_controller_outfile.tmp")" \ @@ -114,14 +116,14 @@ is \ "raid_controller has a sane default" rm "$TMPDIR/raid_controller_outfile.tmp" 2>/dev/null -raid_controller "$TMPDIR/raid_controller_outfile.tmp" "" "$samples/lspci-001.txt" +raid_controller "" "$samples/lspci-001.txt" > "$TMPDIR/raid_controller_outfile.tmp" is \ "$(get_var raid_controller "$TMPDIR/raid_controller_outfile.tmp")" \ "Fusion-MPT SAS" \ "raid_controller gets the correct result from an lspci file" rm "$TMPDIR/raid_controller_outfile.tmp" 2>/dev/null -raid_controller "$TMPDIR/raid_controller_outfile.tmp" "$samples/dmesg-004.txt" "" +raid_controller "$samples/dmesg-004.txt" "" > "$TMPDIR/raid_controller_outfile.tmp" is \ "$(get_var raid_controller "$TMPDIR/raid_controller_outfile.tmp")" \ "AACRAID" \ @@ -157,6 +159,7 @@ test_linux_exclusive_collection () { local PT_SUMMARY_SKIP="" mkdir "$dir/1" + cp "$dir/sysctl" "$dir/1/" linux_exclusive_collection "$dir/1" is \ @@ -171,6 +174,7 @@ test_linux_exclusive_collection () { done mkdir "$dir/2" + cp "$dir/sysctl" "$dir/2/" linux_exclusive_collection "$dir/2" is \ @@ -192,6 +196,7 @@ platform="$(get_var platform "$p/summary")" if [ "$platform" = "Linux" ]; then mkdir "$TMPDIR/linux_data" + cp "$p/sysctl" "$TMPDIR/linux_data/sysctl" test_linux_exclusive_collection "$TMPDIR/linux_data" else skip 1 5 "Tests exclusive for Linux" @@ -249,7 +254,7 @@ forked_pid="$!" if [ -e /proc/$forked_pid/oom_adj ] \ && echo "-17" > /proc/$forked_pid/oom_adj 2>/dev/null; then - notable_processes_info "$TMPDIR/notable_procs" + notable_processes_info > "$TMPDIR/notable_procs" like \ "$(cat "$TMPDIR/notable_procs")" \ "${forked_pid}\\s+-17" \ @@ -274,7 +279,7 @@ test_dmidecode_system_info () { cmd_ok '! test -s "$dir/outfile"' "If dmidecode isn't found, produces nothing" fake_command dmidecode '[$@]' - dmidecode_system_info "$dir/outfile" + dmidecode_system_info > "$dir/outfile" cat <> "$dir/expected" vendor [-s system-manufacturer] diff --git a/t/lib/bash/report_mysql_info.sh b/t/lib/bash/report_mysql_info.sh index be74f054..0844eef7 100644 --- a/t/lib/bash/report_mysql_info.sh +++ b/t/lib/bash/report_mysql_info.sh @@ -273,7 +273,8 @@ cat < $TMPDIR/expected 12345 /tmp/12345/data ? ? /tmp/12345/mysql_sandbox12345.sock 12346 /tmp/12346/data ? ? /tmp/12346/mysql_sandbox12346.sock EOF -parse_mysqld_instances "$samples/ps-mysqld-001.txt" > "$TMPDIR/got" +touch "$TMPDIR/empty" +parse_mysqld_instances "$samples/ps-mysqld-001.txt" "$TMPDIR/empty" > "$TMPDIR/got" no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-001.txt" cat < "$TMPDIR/expected" @@ -281,7 +282,7 @@ cat < "$TMPDIR/expected" ===== ========================== ==== === ====== /var/lib/mysql ? ? /var/lib/mysql/mysql.sock EOF -parse_mysqld_instances "$samples/ps-mysqld-002.txt" > "$TMPDIR/got" +parse_mysqld_instances "$samples/ps-mysqld-002.txt" "$TMPDIR/empty" > "$TMPDIR/got" no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-002.txt" #parse_mysqld_instances @@ -290,7 +291,7 @@ cat < $TMPDIR/expected ===== ========================== ==== === ====== 3306 /mnt/data-store/mysql/data ? ? /tmp/mysql.sock EOF -parse_mysqld_instances "$samples/ps-mysqld-003.txt" > "$TMPDIR/got" +parse_mysqld_instances "$samples/ps-mysqld-003.txt" "$TMPDIR/empty" > "$TMPDIR/got" no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-003.txt" cat < "$TMPDIR/expected" @@ -303,7 +304,7 @@ cat < "$TMPDIR/in" mysql 767 0.0 0.9 3492 1100 v0 I 3:01PM 0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid mysql 818 0.0 17.4 45292 20584 v0 I 3:01PM 0:02.28 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --user=mysql --log-error=/var/db/mysql/freebsd.hsd1.va.comcast.net..err --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid EOF -parse_mysqld_instances "$TMPDIR/in" > "$TMPDIR/got" +parse_mysqld_instances "$TMPDIR/in" "$TMPDIR/empty" > "$TMPDIR/got" no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_mysqld_instances" # ########################################################################### @@ -427,7 +428,7 @@ Uptime 90000 1 1 Uptime_since_flush_status 90000 1 EOF -join $samples/mysql-status-00{1,2}.txt > "$TMPDIR/in" +join "$samples/mysql-status-001.txt" "$samples/mysql-status-002.txt" > "$TMPDIR/in" format_status_variables "$TMPDIR/in" > "$TMPDIR/got" no_diff "$TMPDIR/got" "$TMPDIR/expected" "format_status_variables" @@ -435,7 +436,7 @@ no_diff "$TMPDIR/got" "$TMPDIR/expected" "format_status_variables" # format_overall_db_stats # ########################################################################### -cat < $TMPDIR/expected +cat < "$TMPDIR/expected" Database Tables Views SPs Trigs Funcs FKs Partn mysql 17 @@ -463,9 +464,8 @@ cat < $TMPDIR/expected sakila 1 15 1 3 19 26 3 4 1 45 4 1 7 2 EOF -format_overall_db_stats $samples/mysql-schema-001.txt > $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected - +format_overall_db_stats "$samples/mysql-schema-001.txt" > "$TMPDIR/got" +no_diff "$TMPDIR/got" "$TMPDIR/expected" cat < $TMPDIR/expected @@ -489,8 +489,11 @@ cat < $TMPDIR/expected {chosen} 1 1 EOF -format_overall_db_stats $samples/mysql-schema-002.txt > $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected +format_overall_db_stats "$samples/mysql-schema-002.txt" > "$TMPDIR/got" +no_diff \ + "$TMPDIR/got" \ + "$TMPDIR/expected" \ + "format_overall_db_stats: single DB without CREATE DATABASE nor USE db defaults to {chosen}" # ########################################################################### # format_innodb_status @@ -700,7 +703,8 @@ format_innodb_filters_test # ########################################################################### OPT_SLEEP=1 -OPT_DUMP_SCHEMAS="mysql" +OPT_DATABASES="" +OPT_READ_SAMPLES="" NAME_VAL_LEN=25 _NO_FALSE_NEGATIVES=1 report_mysql_summary "$samples/tempdir" "percona-toolkit" | tail -n+3 > "$TMPDIR/got" diff --git a/t/lib/bash/report_system_info.sh b/t/lib/bash/report_system_info.sh index ebdbd7e3..fbfd19dd 100644 --- a/t/lib/bash/report_system_info.sh +++ b/t/lib/bash/report_system_info.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash -plan 40 +plan 42 . "$LIB_DIR/alt_cmds.sh" . "$LIB_DIR/log_warn_die.sh" +. "$LIB_DIR/parse_options.sh" . "$LIB_DIR/summary_common.sh" . "$LIB_DIR/report_formatting.sh" . "$LIB_DIR/report_system_info.sh" @@ -1154,7 +1155,7 @@ parse_arcconf "$samples/arcconf-003_900285.txt" > "$TMPDIR/got" no_diff "$TMPDIR/got" "$TMPDIR/expected" "Bug 900285" # report_system_summary -PT_SUMMARY_SKIP="" +parse_options "$BIN_DIR/pt-summary" cat < "$TMPDIR/expected" Hostname | @@ -1430,5 +1431,11 @@ No volume groups found # The End #################################################### EOF -report_system_summary "$samples/Linux/001" | tail -n +3 > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "report_system_summary works with samples from Linux" +report_system_summary "$samples/Linux/001" | tail -n +3 > "$TMPDIR/got" +no_diff "$TMPDIR/got" "$TMPDIR/expected" "report_system_summary works with samples from Linux (Ubuntu)" + +report_system_summary "$samples/Linux/002" | tail -n +3 > "$TMPDIR/got" +no_diff "$TMPDIR/got" "$samples/Linux/output_002.txt" "report_system_summary works with samples from Linux (CentOS 5.7, as root)" + +report_system_summary "$samples/Linux/003" | tail -n +3 > "$TMPDIR/got" +no_diff "$TMPDIR/got" "$samples/Linux/output_003.txt" "report_system_summary works with samples from Linux (CentOS 5.7, as non-root)" diff --git a/t/pt-mysql-summary/samples/expected_output_temp002.txt b/t/pt-mysql-summary/samples/expected_output_temp002.txt index 8bd1cf74..67878d4a 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp002.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp002.txt @@ -3,6 +3,7 @@ ===== ========================== ==== === ====== 3306 /var/lib/mysql ? ? /var/run/mysqld/mysqld.sock # MySQL Executable ########################################### + Path to executable | Has symbols | Yes # Report On Port 3306 ######################################## User | hugmeir@localhost @@ -124,7 +125,7 @@ Uptime 90000 1 1 Response Time Hist. | Not Supported Smooth Flushing | Not Supported HandlerSocket NoSQL | Not Supported - Fast Maatkit Hashes | Unknown + Fast Hash UDFs | Unknown # Plugins #################################################### InnoDB compression | ACTIVE # Query cache ################################################ @@ -133,6 +134,44 @@ Uptime 90000 1 1 Usage | 0% HitToInsertRatio | 0% # Schema ##################################################### + + Database Tables Views SPs Trigs Funcs FKs Partn + bluh 1 + meh 1 + mysql 22 + percona 1 + performance_schema + + Database MyISAM InnoDB + bluh 1 + meh 1 + mysql 22 + percona 1 + performance_schema + + Database BTREE + bluh + meh + mysql 31 + percona 2 + performance_schema + + i t b b c t s e l d t s b v f + n e i l h i e n o a i m i a l + t x n o a m t u n t n a g r o + t a b r e m g e y l i c a + r s b t i l n h t + y t l i n i t a + a o m t n r + m b e t + p + Database === === === === === === === === === === === === === === === + bluh 1 1 1 1 + meh 1 + mysql 19 2 4 63 8 6 77 5 4 3 3 8 1 + percona 3 2 4 1 1 1 + performance_schema + # Noteworthy Technologies #################################### SSL | No Explicit LOCK TABLES | No diff --git a/t/pt-mysql-summary/samples/expected_result_report_summary.txt b/t/pt-mysql-summary/samples/expected_result_report_summary.txt index 590abd56..965ddc90 100644 --- a/t/pt-mysql-summary/samples/expected_result_report_summary.txt +++ b/t/pt-mysql-summary/samples/expected_result_report_summary.txt @@ -3,6 +3,7 @@ ===== ========================== ==== === ====== 3306 /var/lib/mysql ? ? /var/run/mysqld/mysqld.sock # MySQL Executable ########################################### + Path to executable | Has symbols | No # Report On Port 3306 ######################################## User | @@ -108,7 +109,7 @@ Uptime 90000 1 1 Response Time Hist. | Not Supported Smooth Flushing | Not Supported HandlerSocket NoSQL | Not Supported - Fast Maatkit Hashes | Unknown + Fast Hash UDFs | Unknown # Plugins #################################################### InnoDB compression | Not found # Query cache ################################################ diff --git a/t/pt-mysql-summary/samples/temp002/percona-toolkit-mysqldump b/t/pt-mysql-summary/samples/temp002/percona-toolkit-mysqldump new file mode 100644 index 00000000..7161fe6e --- /dev/null +++ b/t/pt-mysql-summary/samples/temp002/percona-toolkit-mysqldump @@ -0,0 +1,396 @@ + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bluh` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `bluh`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `test` ( + `id` int(11) DEFAULT NULL, + `t_test` text, + `bi_test` binary(1) DEFAULT NULL, + `blo_test` blob +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `meh` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `meh`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `future``me` ( + `bluh` char(1) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysql` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `mysql`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `columns_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', + PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `db` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + PRIMARY KEY (`Host`,`Db`,`User`), + KEY `User` (`User`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `event` ( + `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', + `body` longblob NOT NULL, + `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `execute_at` datetime DEFAULT NULL, + `interval_value` int(11) DEFAULT NULL, + `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `last_executed` datetime DEFAULT NULL, + `starts` datetime DEFAULT NULL, + `ends` datetime DEFAULT NULL, + `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', + `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', + `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `originator` int(10) unsigned NOT NULL, + `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', + `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `body_utf8` longblob, + PRIMARY KEY (`db`,`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `func` ( + `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `ret` tinyint(1) NOT NULL DEFAULT '0', + `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '', + `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `help_category` ( + `help_category_id` smallint(5) unsigned NOT NULL, + `name` char(64) NOT NULL, + `parent_category_id` smallint(5) unsigned DEFAULT NULL, + `url` char(128) NOT NULL, + PRIMARY KEY (`help_category_id`), + UNIQUE KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help categories'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `help_keyword` ( + `help_keyword_id` int(10) unsigned NOT NULL, + `name` char(64) NOT NULL, + PRIMARY KEY (`help_keyword_id`), + UNIQUE KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help keywords'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `help_relation` ( + `help_topic_id` int(10) unsigned NOT NULL, + `help_keyword_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`help_keyword_id`,`help_topic_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='keyword-topic relation'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `help_topic` ( + `help_topic_id` int(10) unsigned NOT NULL, + `name` char(64) NOT NULL, + `help_category_id` smallint(5) unsigned NOT NULL, + `description` text NOT NULL, + `example` text NOT NULL, + `url` char(128) NOT NULL, + PRIMARY KEY (`help_topic_id`), + UNIQUE KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help topics'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `host` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + PRIMARY KEY (`Host`,`Db`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ndb_binlog_index` ( + `Position` bigint(20) unsigned NOT NULL, + `File` varchar(255) NOT NULL, + `epoch` bigint(20) unsigned NOT NULL, + `inserts` bigint(20) unsigned NOT NULL, + `updates` bigint(20) unsigned NOT NULL, + `deletes` bigint(20) unsigned NOT NULL, + `schemaops` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`epoch`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `plugin` ( + `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '', + PRIMARY KEY (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `proc` ( + `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `name` char(64) NOT NULL DEFAULT '', + `type` enum('FUNCTION','PROCEDURE') NOT NULL, + `specific_name` char(64) NOT NULL DEFAULT '', + `language` enum('SQL') NOT NULL DEFAULT 'SQL', + `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL', + `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO', + `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER', + `param_list` blob NOT NULL, + `returns` longblob NOT NULL, + `body` longblob NOT NULL, + `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', + `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `body_utf8` longblob, + PRIMARY KEY (`db`,`name`,`type`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `procs_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '', + `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, + `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', + `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), + KEY `Grantor` (`Grantor`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `proxies_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `With_grant` tinyint(1) NOT NULL DEFAULT '0', + `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), + KEY `Grantor` (`Grantor`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `servers` ( + `Server_name` char(64) NOT NULL DEFAULT '', + `Host` char(64) NOT NULL DEFAULT '', + `Db` char(64) NOT NULL DEFAULT '', + `Username` char(64) NOT NULL DEFAULT '', + `Password` char(64) NOT NULL DEFAULT '', + `Port` int(4) NOT NULL DEFAULT '0', + `Socket` char(64) NOT NULL DEFAULT '', + `Wrapper` char(64) NOT NULL DEFAULT '', + `Owner` char(64) NOT NULL DEFAULT '', + PRIMARY KEY (`Server_name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tables_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', + `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', + PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), + KEY `Grantor` (`Grantor`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `time_zone` ( + `Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N', + PRIMARY KEY (`Time_zone_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zones'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `time_zone_leap_second` ( + `Transition_time` bigint(20) NOT NULL, + `Correction` int(11) NOT NULL, + PRIMARY KEY (`Transition_time`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Leap seconds information for time zones'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `time_zone_name` ( + `Name` char(64) NOT NULL, + `Time_zone_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`Name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone names'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `time_zone_transition` ( + `Time_zone_id` int(10) unsigned NOT NULL, + `Transition_time` bigint(20) NOT NULL, + `Transition_type_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`Time_zone_id`,`Transition_time`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transitions'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `time_zone_transition_type` ( + `Time_zone_id` int(10) unsigned NOT NULL, + `Transition_type_id` int(10) unsigned NOT NULL, + `Offset` int(11) NOT NULL DEFAULT '0', + `Is_DST` tinyint(3) unsigned NOT NULL DEFAULT '0', + `Abbreviation` char(8) NOT NULL DEFAULT '', + PRIMARY KEY (`Time_zone_id`,`Transition_type_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transition types'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '', + `ssl_cipher` blob NOT NULL, + `x509_issuer` blob NOT NULL, + `x509_subject` blob NOT NULL, + `max_questions` int(11) unsigned NOT NULL DEFAULT '0', + `max_updates` int(11) unsigned NOT NULL DEFAULT '0', + `max_connections` int(11) unsigned NOT NULL DEFAULT '0', + `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`Host`,`User`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'; +/*!40101 SET character_set_client = @saved_cs_client */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `percona` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `percona`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `checksums` ( + `db` char(64) NOT NULL, + `tbl` char(64) NOT NULL, + `chunk` int(11) NOT NULL, + `chunk_time` float DEFAULT NULL, + `chunk_index` varchar(200) DEFAULT NULL, + `lower_boundary` text, + `upper_boundary` text, + `this_crc` char(40) NOT NULL, + `this_cnt` int(11) NOT NULL, + `master_crc` char(40) DEFAULT NULL, + `master_cnt` int(11) DEFAULT NULL, + `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`db`,`tbl`,`chunk`), + KEY `ts_db_tbl` (`ts`,`db`,`tbl`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `performance_schema` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `performance_schema`; diff --git a/t/pt-summary/samples/BSD/freebsd_001/uptime b/t/pt-summary/samples/BSD/freebsd_001/uptime new file mode 100644 index 00000000..be680a0f --- /dev/null +++ b/t/pt-summary/samples/BSD/freebsd_001/uptime @@ -0,0 +1 @@ +57 mins, 1 user, load averages: 0.16, 0.03, 0.07 diff --git a/t/pt-summary/samples/BSD/netbsd_001/uptime b/t/pt-summary/samples/BSD/netbsd_001/uptime new file mode 100644 index 00000000..bfc10040 --- /dev/null +++ b/t/pt-summary/samples/BSD/netbsd_001/uptime @@ -0,0 +1 @@ +43 mins, 2 users, load averages: 0.00, 0.00, 0.00 diff --git a/t/pt-summary/samples/BSD/openbsd_001/uptime b/t/pt-summary/samples/BSD/openbsd_001/uptime new file mode 100644 index 00000000..53aee537 --- /dev/null +++ b/t/pt-summary/samples/BSD/openbsd_001/uptime @@ -0,0 +1 @@ +1:14, 1 user, load averages: 0.44, 0.20, 0.16 diff --git a/t/pt-summary/samples/Linux/001/uptime b/t/pt-summary/samples/Linux/001/uptime new file mode 100644 index 00000000..e66d3312 --- /dev/null +++ b/t/pt-summary/samples/Linux/001/uptime @@ -0,0 +1 @@ +1 day, 15:14, 5 users, load average: 0.00, 0.06, 0.07 diff --git a/t/pt-summary/samples/Linux/002/dmesg_file b/t/pt-summary/samples/Linux/002/dmesg_file new file mode 100644 index 00000000..2c99d1ae --- /dev/null +++ b/t/pt-summary/samples/Linux/002/dmesg_file @@ -0,0 +1,283 @@ +Linux version 2.6.18-274.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Fri Jul 22 04:49:12 EDT 2011 +BIOS-provided physical RAM map: + BIOS-e820: 0000000000010000 - 000000000009f400 (usable) + BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved) + BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved) + BIOS-e820: 0000000000100000 - 000000003fffd000 (usable) + BIOS-e820: 000000003fffd000 - 0000000040000000 (reserved) + BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved) +127MB HIGHMEM available. +896MB LOWMEM available. +found SMP MP-table at 000fdaf0 +Memory for crash kernel (0x0 to 0x0) notwithin permissible range +disabling kdump +Using x86 segment limits to approximate NX protection +On node 0 totalpages: 262141 + DMA zone: 4096 pages, LIFO batch:0 + Normal zone: 225280 pages, LIFO batch:31 + HighMem zone: 32765 pages, LIFO batch:7 +DMI 2.4 present. +DMI: Bochs Bochs, BIOS Bochs 01/01/2007 +Using APIC driver default +ACPI: RSDP (v000 BOCHS ) @ 0x000fdaa0 +ACPI: RSDT (v001 BOCHS BXPCRSDT 0x00000001 BXPC 0x00000001) @ 0x3fffd6a0 +ACPI: FADT (v001 BOCHS BXPCFACP 0x00000001 BXPC 0x00000001) @ 0x3ffffe70 +ACPI: SSDT (v001 BOCHS BXPCSSDT 0x00000001 BXPC 0x00000001) @ 0x3fffd800 +ACPI: MADT (v001 BOCHS BXPCAPIC 0x00000001 BXPC 0x00000001) @ 0x3fffd720 +ACPI: HPET (v001 BOCHS BXPCHPET 0x00000001 BXPC 0x00000001) @ 0x3fffd6e0 +ACPI: DSDT (v001 BXPC BXDSDT 0x00000001 INTL 0x20100528) @ 0x00000000 +ACPI: PM-Timer IO Port: 0xb008 +ACPI: Local APIC address 0xfee00000 +ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled) +Processor #0 6:3 APIC version 17 +ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0]) +IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-23 +ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl) +ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level) +ACPI: IRQ0 used by override. +ACPI: IRQ2 used by override. +ACPI: IRQ5 used by override. +ACPI: IRQ9 used by override. +ACPI: IRQ10 used by override. +ACPI: IRQ11 used by override. +Enabling APIC mode: Flat. Using 1 I/O APICs +ACPI: HPET id: 0x8086a201 base: 0xfed00000 +Using ACPI (MADT) for SMP configuration information +Allocating PCI resources starting at 50000000 (gap: 40000000:bffc0000) +Detected 1662.701 MHz processor. +Built 1 zonelists. Total pages: 262141 +Kernel command line: ro root=/dev/VolGroup00/LogVol00 +mapped APIC to ffffd000 (fee00000) +mapped IOAPIC to ffffc000 (fec00000) +Enabling fast FPU save and restore... done. +Enabling unmasked SIMD FPU exception support... done. +Initializing CPU#0 +CPU 0 irqstacks, hard=c076f000 soft=c074f000 +PID hash table entries: 4096 (order: 12, 16384 bytes) +Console: colour VGA+ 80x25 +Dentry cache hash table entries: 131072 (order: 7, 524288 bytes) +Inode-cache hash table entries: 65536 (order: 6, 262144 bytes) +Memory: 1030768k/1048564k available (2196k kernel code, 16912k reserved, 914k data, 232k init, 131060k highmem) +Checking if this processor honours the WP bit even in supervisor mode... Ok. +hpet0: at MMIO 0xfed00000 (virtual 0xf8800000), IRQs 2, 8, 0 +hpet0: 3 64-bit timers, 100000000 Hz +Using HPET for base-timer +Calibrating delay loop (skipped), value calculated using timer frequency.. 3325.40 BogoMIPS (lpj=1662701) +Security Framework v1.0.0 initialized +SELinux: Initializing. +SELinux: Starting in permissive mode +selinux_register_security: Registering secondary module capability +Capability LSM initialized as secondary +Mount-cache hash table entries: 512 +CPU: After generic identify, caps: 0781abf9 00000000 00000000 00000000 80800001 00000000 00000000 +CPU: After vendor identify, caps: 0781abf9 00000000 00000000 00000000 80800001 00000000 00000000 +CPU: L1 I cache: 32K, L1 D cache: 32K +CPU: L2 cache: 4096K +CPU: After all inits, caps: 0781a3f9 00000000 00000000 00000040 80800001 00000000 00000000 +Checking 'hlt' instruction... OK. +SMP alternatives: switching to UP code +Freeing SMP alternatives: 14k freed +ACPI: Core revision 20060707 +CPU0: Intel QEMU Virtual CPU version 0.14.1 stepping 03 +Total of 1 processors activated (3325.40 BogoMIPS). +ENABLING IO-APIC IRQs +..TIMER: vector=0x31 apic1=0 pin1=2 apic2=-1 pin2=-1 +Using local APIC timer interrupts. +WARNING calibrate_APIC_clock: the APIC timer calibration may be wrong. +Brought up 1 CPUs +sizeof(vma)=84 bytes +sizeof(page)=32 bytes +sizeof(inode)=340 bytes +sizeof(dentry)=136 bytes +sizeof(ext3inode)=492 bytes +sizeof(buffer_head)=52 bytes +sizeof(skbuff)=176 bytes +checking if image is initramfs... it is +Freeing initrd memory: 3301k freed +NET: Registered protocol family 16 +ACPI: bus type pci registered +PCI: PCI BIOS revision 2.10 entry at 0xfc901, last bus=0 +PCI: Using configuration type 1 +Setting up standard PCI resources +ACPI: Interpreter enabled +ACPI: Using IOAPIC for interrupt routing +ACPI: No dock devices found. +ACPI: PCI Root Bridge [PCI0] (0000:00) +PCI quirk: region b000-b03f claimed by PIIX4 ACPI +PCI quirk: region b100-b10f claimed by PIIX4 SMB +ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT] +ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11) +ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11) +ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11) +ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11) +ACPI: PCI Interrupt Link [LNKS] (IRQs 9) *0, disabled. +Linux Plug and Play Support v0.97 (c) Adam Belay +pnp: PnP ACPI init +pnp: PnP ACPI: found 6 devices +usbcore: registered new driver usbfs +usbcore: registered new driver hub +PCI: Using ACPI for IRQ routing +PCI: If a device doesn't work, try "pci=routeirq". If it helps, post a report +NetLabel: Initializing +NetLabel: domain hash size = 128 +NetLabel: protocols = UNLABELED CIPSOv4 +NetLabel: unlabeled traffic allowed by default +NET: Registered protocol family 2 +IP route cache hash table entries: 32768 (order: 5, 131072 bytes) +TCP established hash table entries: 131072 (order: 8, 1048576 bytes) +TCP bind hash table entries: 65536 (order: 7, 524288 bytes) +TCP: Hash tables configured (established 131072 bind 65536) +TCP reno registered +apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16ac) +apm: overridden by ACPI. +audit: initializing netlink socket (disabled) +type=2000 audit(1332831374.186:1): initialized +highmem bounce pool size: 64 pages +Total HugeTLB memory allocated, 0 +VFS: Disk quotas dquot_6.5.1 +Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) +SELinux: Registering netfilter hooks +Initializing Cryptographic API +alg: No test for crc32c (crc32c-generic) +ksign: Installing public key data +Loading keyring +- Added public key 19937CBFB67F4F76 +- User ID: CentOS (Kernel Module GPG key) +io scheduler noop registered +io scheduler anticipatory registered +io scheduler deadline registered +io scheduler cfq registered (default) +Limiting direct PCI/PCI transfers. +PCI: PIIX3: Enabling Passive Release on 0000:00:01.0 +Activating ISA DMA hang workarounds. +Boot video device is 0000:00:02.0 +pci_hotplug: PCI Hot Plug PCI Core version: 0.5 +Real Time Clock Driver v1.12ac +hpet_resources: 0xfed00000 is busy +Non-volatile memory driver v1.2 +Linux agpgart interface v0.101 (c) Dave Jones +Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled +serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A +brd: module loaded +Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 +ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx +PIIX3: IDE controller at PCI slot 0000:00:01.1 +PIIX3: chipset revision 0 +PIIX3: not 100% native mode: will probe irqs later +PCI: Setting latency timer of device 0000:00:01.1 to 64 + ide0: BM-DMA at 0xc000-0xc007, BIOS settings: hda:pio, hdb:pio + ide1: BM-DMA at 0xc008-0xc00f, BIOS settings: hdc:pio, hdd:pio +Probing IDE interface ide0... +hda: QEMU HARDDISK, ATA DISK drive +ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 +Probing IDE interface ide1... +hdc: QEMU DVD-ROM, ATAPI CD/DVD-ROM drive +ide1 at 0x170-0x177,0x376 on irq 15 +hda: max request size: 512KiB +hda: 16777216 sectors (8589 MB) w/256KiB Cache, CHS=16383/255/63, (U)DMA +hda: cache flushes supported + hda: hda1 hda2 +ide-floppy driver 0.99.newide +usbcore: registered new driver hiddev +usbcore: registered new driver usbhid +drivers/usb/input/hid-core.c: v2.6:USB HID core driver +PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12 +serio: i8042 KBD port at 0x60,0x64 irq 1 +serio: i8042 AUX port at 0x60,0x64 irq 12 +mice: PS/2 mouse device common for all mice +md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27 +md: bitmap version 4.39 +TCP bic registered +Initializing IPsec netlink socket +NET: Registered protocol family 1 +NET: Registered protocol family 17 +Using IPI No-Shortcut mode +Time: tsc clocksource has been installed. +ACPI: (supports S3 S4 S5) +Initalizing network drop monitor service +Freeing unused kernel memory: 232k freed +Write protecting the kernel read-only data: 415k +input: AT Translated Set 2 keyboard as /class/input/input0 +input: ImExPS/2 Generic Explorer Mouse as /class/input/input1 +ohci_hcd: 2005 April 22 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI) +USB Universal Host Controller Interface driver v3.0 +ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11 +ACPI: PCI Interrupt 0000:00:01.2[D] -> Link [LNKD] -> GSI 11 (level, high) -> IRQ 11 +PCI: Setting latency timer of device 0000:00:01.2 to 64 +uhci_hcd 0000:00:01.2: UHCI Host Controller +uhci_hcd 0000:00:01.2: new USB bus registered, assigned bus number 1 +uhci_hcd 0000:00:01.2: irq 11, io base 0x0000c020 +usb usb1: configuration #1 chosen from 1 choice +hub 1-0:1.0: USB hub found +hub 1-0:1.0: 2 ports detected +SCSI subsystem initialized +libata version 3.00 loaded. +device-mapper: uevent: version 1.0.3 +device-mapper: ioctl: 4.11.6-ioctl (2011-02-18) initialised: dm-devel@redhat.com +device-mapper: dm-raid45: initialized v0.2594l +EXT3-fs: INFO: recovery required on readonly filesystem. +EXT3-fs: write access will be enabled during recovery. +kjournald starting. Commit interval 5 seconds +EXT3-fs: recovery complete. +EXT3-fs: mounted filesystem with ordered data mode. +type=1404 audit(1332831448.312:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295 +security: 3 users, 6 roles, 2005 types, 267 bools, 1 sens, 1024 cats +security: 61 classes, 80385 rules +SELinux: Completing initialization. +SELinux: Setting up existing superblocks. +SELinux: initialized (dev dm-0, type ext3), uses xattr +SELinux: initialized (dev usbfs, type usbfs), uses genfs_contexts +SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs +SELinux: initialized (dev debugfs, type debugfs), uses genfs_contexts +SELinux: initialized (dev selinuxfs, type selinuxfs), uses genfs_contexts +SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs +SELinux: initialized (dev hugetlbfs, type hugetlbfs), uses genfs_contexts +SELinux: initialized (dev devpts, type devpts), uses transition SIDs +SELinux: initialized (dev eventpollfs, type eventpollfs), uses task SIDs +SELinux: initialized (dev inotifyfs, type inotifyfs), uses genfs_contexts +SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs +SELinux: initialized (dev futexfs, type futexfs), uses genfs_contexts +SELinux: initialized (dev anon_inodefs, type anon_inodefs), uses genfs_contexts +SELinux: initialized (dev pipefs, type pipefs), uses task SIDs +SELinux: initialized (dev sockfs, type sockfs), uses task SIDs +SELinux: initialized (dev cpuset, type cpuset), uses genfs_contexts +SELinux: initialized (dev proc, type proc), uses genfs_contexts +SELinux: initialized (dev bdev, type bdev), uses genfs_contexts +SELinux: initialized (dev rootfs, type rootfs), uses genfs_contexts +SELinux: initialized (dev sysfs, type sysfs), uses genfs_contexts +type=1403 audit(1332831475.505:3): policy loaded auid=4294967295 ses=4294967295 +hdc: ATAPI 4X CD-ROM drive, 512kB Cache, (U)DMA +Uniform CD-ROM driver Revision: 3.20 +8139cp: 10/100 PCI Ethernet driver v1.2 (Mar 22, 2004) +ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 10 +ACPI: PCI Interrupt 0000:00:03.0[A] -> Link [LNKC] -> GSI 10 (level, high) -> IRQ 10 +eth0: RTL-8139C+ at 0xf8906000, 52:54:00:c2:70:1b, IRQ 10 +PCI: Setting latency timer of device 0000:00:03.0 to 64 +8139too Fast Ethernet driver 0.9.27 +ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10 +ACPI: PCI Interrupt 0000:00:05.0[A] -> Link [LNKA] -> GSI 10 (level, high) -> IRQ 10 +input: PC Speaker as /class/input/input2 +piix4_smbus 0000:00:01.3: Found 0000:00:01.3 device +ACPI: PCI Interrupt 0000:00:04.0[A] -> Link [LNKD] -> GSI 11 (level, high) -> IRQ 11 +PCI: Setting latency timer of device 0000:00:04.0 to 64 +FDC 0 is a S82078B +lp: driver loaded but no devices found +ACPI: Power Button (FF) [PWRF] +ACPI: Mapper loaded +dell-wmi: No known WMI GUID found +md: Autodetecting RAID arrays. +md: autorun ... +md: ... autorun DONE. +device-mapper: multipath: version 1.0.6 loaded +loop: loaded (max 8 devices) +EXT3 FS on dm-0, internal journal +kjournald starting. Commit interval 5 seconds +EXT3 FS on hda1, internal journal +EXT3-fs: mounted filesystem with ordered data mode. +SELinux: initialized (dev hda1, type ext3), uses xattr +SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs +Adding 2097144k swap on /dev/VolGroup00/LogVol01. Priority:-1 extents:1 across:2097144k +SELinux: initialized (dev binfmt_misc, type binfmt_misc), uses genfs_contexts diff --git a/t/pt-summary/samples/Linux/002/memory b/t/pt-summary/samples/Linux/002/memory new file mode 100644 index 00000000..56336698 --- /dev/null +++ b/t/pt-summary/samples/Linux/002/memory @@ -0,0 +1,34 @@ + total used free shared buffers cached +Mem: 1059586048 237105152 822480896 0 51216384 128176128 +-/+ buffers/cache: 57712640 1001873408 +Swap: 2147475456 0 2147475456 +MemTotal: 1034752 kB +MemFree: 803204 kB +Buffers: 50016 kB +Cached: 125172 kB +SwapCached: 0 kB +Active: 85712 kB +Inactive: 120804 kB +HighTotal: 131060 kB +HighFree: 240 kB +LowTotal: 903692 kB +LowFree: 802964 kB +SwapTotal: 2097144 kB +SwapFree: 2097144 kB +Dirty: 152 kB +Writeback: 0 kB +AnonPages: 31348 kB +Mapped: 8772 kB +Slab: 15048 kB +PageTables: 1308 kB +NFS_Unstable: 0 kB +Bounce: 0 kB +CommitLimit: 2614520 kB +Committed_AS: 139488 kB +VmallocTotal: 114680 kB +VmallocUsed: 6304 kB +VmallocChunk: 108216 kB +HugePages_Total: 0 +HugePages_Free: 0 +HugePages_Rsvd: 0 +Hugepagesize: 4096 kB diff --git a/t/pt-summary/samples/Linux/002/mounted_fs b/t/pt-summary/samples/Linux/002/mounted_fs new file mode 100644 index 00000000..b2f7a3f8 --- /dev/null +++ b/t/pt-summary/samples/Linux/002/mounted_fs @@ -0,0 +1,3 @@ +/dev/hda1 99M 13M 82M 13% /boot on /boot type ext3 (rw) +/dev/mapper/VolGroup00-LogVol00 5.7G 1.1G 4.4G 20% / on / type ext3 (rw) +tmpfs 506M 0 506M 0% /dev/shm on /dev/shm type tmpfs (rw) diff --git a/t/pt-summary/samples/Linux/002/netstat b/t/pt-summary/samples/Linux/002/netstat new file mode 100644 index 00000000..45375c6e --- /dev/null +++ b/t/pt-summary/samples/Linux/002/netstat @@ -0,0 +1,6 @@ +Active Internet connections (servers and established) +Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name +tcp 0 0 0.0.0.0:966 0.0.0.0:* LISTEN 2056/rpc.statd +tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2016/portmap +tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2358/sendmail: acce +tcp 0 0 :::22 :::* LISTEN 2333/sshd diff --git a/t/pt-summary/samples/Linux/002/notable_procs b/t/pt-summary/samples/Linux/002/notable_procs new file mode 100644 index 00000000..41bd9b97 --- /dev/null +++ b/t/pt-summary/samples/Linux/002/notable_procs @@ -0,0 +1,2 @@ + PID OOM COMMAND + 2333 +0 sshd diff --git a/t/pt-summary/samples/Linux/002/partitioning b/t/pt-summary/samples/Linux/002/partitioning new file mode 100644 index 00000000..44d9493a --- /dev/null +++ b/t/pt-summary/samples/Linux/002/partitioning @@ -0,0 +1,9 @@ + + +Disk /dev/hda: 8589 MB, 8589934592 bytes +255 heads, 63 sectors/track, 1044 cylinders +Units = cylinders of 16065 * 512 = 8225280 bytes + + Device Boot Start End Blocks Id System +/dev/hda1 * 1 13 104391 83 Linux +/dev/hda2 14 1044 8281507+ 8e Linux LVM diff --git a/t/pt-summary/samples/Linux/002/proc_cpuinfo_copy b/t/pt-summary/samples/Linux/002/proc_cpuinfo_copy new file mode 100644 index 00000000..1ab08a88 --- /dev/null +++ b/t/pt-summary/samples/Linux/002/proc_cpuinfo_copy @@ -0,0 +1,19 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 3 +model name : QEMU Virtual CPU version 0.14.1 +stepping : 3 +cpu MHz : 1662.701 +cache size : 4096 KB +fdiv_bug : no +hlt_bug : no +f00f_bug : no +coma_bug : no +fpu : yes +fpu_exception : yes +cpuid level : 4 +wp : yes +flags : fpu pse tsc msr pae mce cx8 apic pge cmov pat mmx fxsr sse sse2 up pni popcnt +bogomips : 3325.40 + diff --git a/t/pt-summary/samples/Linux/002/processes b/t/pt-summary/samples/Linux/002/processes new file mode 100644 index 00000000..c593614c --- /dev/null +++ b/t/pt-summary/samples/Linux/002/processes @@ -0,0 +1,10 @@ + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 3443 root 17 0 2288 956 728 R 25.5 0.1 0:01.30 top + 2252 root 15 0 2060 684 604 S 1.3 0.1 0:09.03 hald-addon-stor + 2230 haldaemo 15 0 5836 3928 1700 S 0.7 0.4 0:32.54 hald + 1 root 15 0 2160 668 576 S 0.0 0.1 0:39.36 init + 2 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/0 + 3 root 34 19 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0 + 4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 + 5 root 10 -5 0 0 0 S 0.0 0.0 0:01.77 events/0 + 6 root 10 -5 0 0 0 S 0.0 0.0 0:00.26 khelper diff --git a/t/pt-summary/samples/Linux/002/raid-controller b/t/pt-summary/samples/Linux/002/raid-controller new file mode 100644 index 00000000..e69de29b diff --git a/t/pt-summary/samples/Linux/002/summary b/t/pt-summary/samples/Linux/002/summary new file mode 100644 index 00000000..519c0add --- /dev/null +++ b/t/pt-summary/samples/Linux/002/summary @@ -0,0 +1,23 @@ +platform Linux +hostname localhost.localdomain +kernel 2.6.18-274.el5 +release CentOS release 5.7 (Final) +CPU_ARCH 32-bit +OS_ARCH 32-bit +virt QEmu +compiler GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-51). +rss 66236416 +raid_controller No RAID controller detected +threading NPTL 2.5 +getenforce No SELinux detected +swappiness +disks dm-0 +dm-1 +hda +hdc +md0 +internal::hda [cfq] 128 +internal::hdc [cfq] 128 +dentry-state 9392 7451 45 0 0 0 +file-nr 640 0 102187 +inode-nr 5431 148 diff --git a/t/pt-summary/samples/Linux/002/sysctl b/t/pt-summary/samples/Linux/002/sysctl new file mode 100644 index 00000000..e69de29b diff --git a/t/pt-summary/samples/Linux/002/uptime b/t/pt-summary/samples/Linux/002/uptime new file mode 100644 index 00000000..598c2435 --- /dev/null +++ b/t/pt-summary/samples/Linux/002/uptime @@ -0,0 +1 @@ + 03:34:31 up 38 min, 1 user, load average: 1.60, 1.03, 1.37 diff --git a/t/pt-summary/samples/Linux/002/vmstat b/t/pt-summary/samples/Linux/002/vmstat new file mode 100644 index 00000000..1a5358cb --- /dev/null +++ b/t/pt-summary/samples/Linux/002/vmstat @@ -0,0 +1,7 @@ +procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ + r b swpd free buff cache si so bi bo in cs us sy id wa st + 2 0 0 802956 50016 125208 0 0 81 17 1006 56 48 24 27 1 0 + 1 0 0 802956 50016 125212 0 0 0 0 1031 52 70 30 0 0 0 + 1 0 0 802956 50016 125212 0 0 0 104 804 48 67 33 0 0 0 + 1 0 0 802956 50016 125212 0 0 0 0 958 35 80 20 0 0 0 + 1 0 0 802956 50016 125212 0 0 0 0 886 43 62 38 0 0 0 diff --git a/t/pt-summary/samples/Linux/003/dmesg_file b/t/pt-summary/samples/Linux/003/dmesg_file new file mode 100644 index 00000000..2c99d1ae --- /dev/null +++ b/t/pt-summary/samples/Linux/003/dmesg_file @@ -0,0 +1,283 @@ +Linux version 2.6.18-274.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Fri Jul 22 04:49:12 EDT 2011 +BIOS-provided physical RAM map: + BIOS-e820: 0000000000010000 - 000000000009f400 (usable) + BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved) + BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved) + BIOS-e820: 0000000000100000 - 000000003fffd000 (usable) + BIOS-e820: 000000003fffd000 - 0000000040000000 (reserved) + BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved) +127MB HIGHMEM available. +896MB LOWMEM available. +found SMP MP-table at 000fdaf0 +Memory for crash kernel (0x0 to 0x0) notwithin permissible range +disabling kdump +Using x86 segment limits to approximate NX protection +On node 0 totalpages: 262141 + DMA zone: 4096 pages, LIFO batch:0 + Normal zone: 225280 pages, LIFO batch:31 + HighMem zone: 32765 pages, LIFO batch:7 +DMI 2.4 present. +DMI: Bochs Bochs, BIOS Bochs 01/01/2007 +Using APIC driver default +ACPI: RSDP (v000 BOCHS ) @ 0x000fdaa0 +ACPI: RSDT (v001 BOCHS BXPCRSDT 0x00000001 BXPC 0x00000001) @ 0x3fffd6a0 +ACPI: FADT (v001 BOCHS BXPCFACP 0x00000001 BXPC 0x00000001) @ 0x3ffffe70 +ACPI: SSDT (v001 BOCHS BXPCSSDT 0x00000001 BXPC 0x00000001) @ 0x3fffd800 +ACPI: MADT (v001 BOCHS BXPCAPIC 0x00000001 BXPC 0x00000001) @ 0x3fffd720 +ACPI: HPET (v001 BOCHS BXPCHPET 0x00000001 BXPC 0x00000001) @ 0x3fffd6e0 +ACPI: DSDT (v001 BXPC BXDSDT 0x00000001 INTL 0x20100528) @ 0x00000000 +ACPI: PM-Timer IO Port: 0xb008 +ACPI: Local APIC address 0xfee00000 +ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled) +Processor #0 6:3 APIC version 17 +ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0]) +IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-23 +ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl) +ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level) +ACPI: IRQ0 used by override. +ACPI: IRQ2 used by override. +ACPI: IRQ5 used by override. +ACPI: IRQ9 used by override. +ACPI: IRQ10 used by override. +ACPI: IRQ11 used by override. +Enabling APIC mode: Flat. Using 1 I/O APICs +ACPI: HPET id: 0x8086a201 base: 0xfed00000 +Using ACPI (MADT) for SMP configuration information +Allocating PCI resources starting at 50000000 (gap: 40000000:bffc0000) +Detected 1662.701 MHz processor. +Built 1 zonelists. Total pages: 262141 +Kernel command line: ro root=/dev/VolGroup00/LogVol00 +mapped APIC to ffffd000 (fee00000) +mapped IOAPIC to ffffc000 (fec00000) +Enabling fast FPU save and restore... done. +Enabling unmasked SIMD FPU exception support... done. +Initializing CPU#0 +CPU 0 irqstacks, hard=c076f000 soft=c074f000 +PID hash table entries: 4096 (order: 12, 16384 bytes) +Console: colour VGA+ 80x25 +Dentry cache hash table entries: 131072 (order: 7, 524288 bytes) +Inode-cache hash table entries: 65536 (order: 6, 262144 bytes) +Memory: 1030768k/1048564k available (2196k kernel code, 16912k reserved, 914k data, 232k init, 131060k highmem) +Checking if this processor honours the WP bit even in supervisor mode... Ok. +hpet0: at MMIO 0xfed00000 (virtual 0xf8800000), IRQs 2, 8, 0 +hpet0: 3 64-bit timers, 100000000 Hz +Using HPET for base-timer +Calibrating delay loop (skipped), value calculated using timer frequency.. 3325.40 BogoMIPS (lpj=1662701) +Security Framework v1.0.0 initialized +SELinux: Initializing. +SELinux: Starting in permissive mode +selinux_register_security: Registering secondary module capability +Capability LSM initialized as secondary +Mount-cache hash table entries: 512 +CPU: After generic identify, caps: 0781abf9 00000000 00000000 00000000 80800001 00000000 00000000 +CPU: After vendor identify, caps: 0781abf9 00000000 00000000 00000000 80800001 00000000 00000000 +CPU: L1 I cache: 32K, L1 D cache: 32K +CPU: L2 cache: 4096K +CPU: After all inits, caps: 0781a3f9 00000000 00000000 00000040 80800001 00000000 00000000 +Checking 'hlt' instruction... OK. +SMP alternatives: switching to UP code +Freeing SMP alternatives: 14k freed +ACPI: Core revision 20060707 +CPU0: Intel QEMU Virtual CPU version 0.14.1 stepping 03 +Total of 1 processors activated (3325.40 BogoMIPS). +ENABLING IO-APIC IRQs +..TIMER: vector=0x31 apic1=0 pin1=2 apic2=-1 pin2=-1 +Using local APIC timer interrupts. +WARNING calibrate_APIC_clock: the APIC timer calibration may be wrong. +Brought up 1 CPUs +sizeof(vma)=84 bytes +sizeof(page)=32 bytes +sizeof(inode)=340 bytes +sizeof(dentry)=136 bytes +sizeof(ext3inode)=492 bytes +sizeof(buffer_head)=52 bytes +sizeof(skbuff)=176 bytes +checking if image is initramfs... it is +Freeing initrd memory: 3301k freed +NET: Registered protocol family 16 +ACPI: bus type pci registered +PCI: PCI BIOS revision 2.10 entry at 0xfc901, last bus=0 +PCI: Using configuration type 1 +Setting up standard PCI resources +ACPI: Interpreter enabled +ACPI: Using IOAPIC for interrupt routing +ACPI: No dock devices found. +ACPI: PCI Root Bridge [PCI0] (0000:00) +PCI quirk: region b000-b03f claimed by PIIX4 ACPI +PCI quirk: region b100-b10f claimed by PIIX4 SMB +ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT] +ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11) +ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11) +ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11) +ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11) +ACPI: PCI Interrupt Link [LNKS] (IRQs 9) *0, disabled. +Linux Plug and Play Support v0.97 (c) Adam Belay +pnp: PnP ACPI init +pnp: PnP ACPI: found 6 devices +usbcore: registered new driver usbfs +usbcore: registered new driver hub +PCI: Using ACPI for IRQ routing +PCI: If a device doesn't work, try "pci=routeirq". If it helps, post a report +NetLabel: Initializing +NetLabel: domain hash size = 128 +NetLabel: protocols = UNLABELED CIPSOv4 +NetLabel: unlabeled traffic allowed by default +NET: Registered protocol family 2 +IP route cache hash table entries: 32768 (order: 5, 131072 bytes) +TCP established hash table entries: 131072 (order: 8, 1048576 bytes) +TCP bind hash table entries: 65536 (order: 7, 524288 bytes) +TCP: Hash tables configured (established 131072 bind 65536) +TCP reno registered +apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16ac) +apm: overridden by ACPI. +audit: initializing netlink socket (disabled) +type=2000 audit(1332831374.186:1): initialized +highmem bounce pool size: 64 pages +Total HugeTLB memory allocated, 0 +VFS: Disk quotas dquot_6.5.1 +Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) +SELinux: Registering netfilter hooks +Initializing Cryptographic API +alg: No test for crc32c (crc32c-generic) +ksign: Installing public key data +Loading keyring +- Added public key 19937CBFB67F4F76 +- User ID: CentOS (Kernel Module GPG key) +io scheduler noop registered +io scheduler anticipatory registered +io scheduler deadline registered +io scheduler cfq registered (default) +Limiting direct PCI/PCI transfers. +PCI: PIIX3: Enabling Passive Release on 0000:00:01.0 +Activating ISA DMA hang workarounds. +Boot video device is 0000:00:02.0 +pci_hotplug: PCI Hot Plug PCI Core version: 0.5 +Real Time Clock Driver v1.12ac +hpet_resources: 0xfed00000 is busy +Non-volatile memory driver v1.2 +Linux agpgart interface v0.101 (c) Dave Jones +Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled +serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A +brd: module loaded +Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 +ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx +PIIX3: IDE controller at PCI slot 0000:00:01.1 +PIIX3: chipset revision 0 +PIIX3: not 100% native mode: will probe irqs later +PCI: Setting latency timer of device 0000:00:01.1 to 64 + ide0: BM-DMA at 0xc000-0xc007, BIOS settings: hda:pio, hdb:pio + ide1: BM-DMA at 0xc008-0xc00f, BIOS settings: hdc:pio, hdd:pio +Probing IDE interface ide0... +hda: QEMU HARDDISK, ATA DISK drive +ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 +Probing IDE interface ide1... +hdc: QEMU DVD-ROM, ATAPI CD/DVD-ROM drive +ide1 at 0x170-0x177,0x376 on irq 15 +hda: max request size: 512KiB +hda: 16777216 sectors (8589 MB) w/256KiB Cache, CHS=16383/255/63, (U)DMA +hda: cache flushes supported + hda: hda1 hda2 +ide-floppy driver 0.99.newide +usbcore: registered new driver hiddev +usbcore: registered new driver usbhid +drivers/usb/input/hid-core.c: v2.6:USB HID core driver +PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12 +serio: i8042 KBD port at 0x60,0x64 irq 1 +serio: i8042 AUX port at 0x60,0x64 irq 12 +mice: PS/2 mouse device common for all mice +md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27 +md: bitmap version 4.39 +TCP bic registered +Initializing IPsec netlink socket +NET: Registered protocol family 1 +NET: Registered protocol family 17 +Using IPI No-Shortcut mode +Time: tsc clocksource has been installed. +ACPI: (supports S3 S4 S5) +Initalizing network drop monitor service +Freeing unused kernel memory: 232k freed +Write protecting the kernel read-only data: 415k +input: AT Translated Set 2 keyboard as /class/input/input0 +input: ImExPS/2 Generic Explorer Mouse as /class/input/input1 +ohci_hcd: 2005 April 22 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI) +USB Universal Host Controller Interface driver v3.0 +ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11 +ACPI: PCI Interrupt 0000:00:01.2[D] -> Link [LNKD] -> GSI 11 (level, high) -> IRQ 11 +PCI: Setting latency timer of device 0000:00:01.2 to 64 +uhci_hcd 0000:00:01.2: UHCI Host Controller +uhci_hcd 0000:00:01.2: new USB bus registered, assigned bus number 1 +uhci_hcd 0000:00:01.2: irq 11, io base 0x0000c020 +usb usb1: configuration #1 chosen from 1 choice +hub 1-0:1.0: USB hub found +hub 1-0:1.0: 2 ports detected +SCSI subsystem initialized +libata version 3.00 loaded. +device-mapper: uevent: version 1.0.3 +device-mapper: ioctl: 4.11.6-ioctl (2011-02-18) initialised: dm-devel@redhat.com +device-mapper: dm-raid45: initialized v0.2594l +EXT3-fs: INFO: recovery required on readonly filesystem. +EXT3-fs: write access will be enabled during recovery. +kjournald starting. Commit interval 5 seconds +EXT3-fs: recovery complete. +EXT3-fs: mounted filesystem with ordered data mode. +type=1404 audit(1332831448.312:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295 +security: 3 users, 6 roles, 2005 types, 267 bools, 1 sens, 1024 cats +security: 61 classes, 80385 rules +SELinux: Completing initialization. +SELinux: Setting up existing superblocks. +SELinux: initialized (dev dm-0, type ext3), uses xattr +SELinux: initialized (dev usbfs, type usbfs), uses genfs_contexts +SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs +SELinux: initialized (dev debugfs, type debugfs), uses genfs_contexts +SELinux: initialized (dev selinuxfs, type selinuxfs), uses genfs_contexts +SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs +SELinux: initialized (dev hugetlbfs, type hugetlbfs), uses genfs_contexts +SELinux: initialized (dev devpts, type devpts), uses transition SIDs +SELinux: initialized (dev eventpollfs, type eventpollfs), uses task SIDs +SELinux: initialized (dev inotifyfs, type inotifyfs), uses genfs_contexts +SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs +SELinux: initialized (dev futexfs, type futexfs), uses genfs_contexts +SELinux: initialized (dev anon_inodefs, type anon_inodefs), uses genfs_contexts +SELinux: initialized (dev pipefs, type pipefs), uses task SIDs +SELinux: initialized (dev sockfs, type sockfs), uses task SIDs +SELinux: initialized (dev cpuset, type cpuset), uses genfs_contexts +SELinux: initialized (dev proc, type proc), uses genfs_contexts +SELinux: initialized (dev bdev, type bdev), uses genfs_contexts +SELinux: initialized (dev rootfs, type rootfs), uses genfs_contexts +SELinux: initialized (dev sysfs, type sysfs), uses genfs_contexts +type=1403 audit(1332831475.505:3): policy loaded auid=4294967295 ses=4294967295 +hdc: ATAPI 4X CD-ROM drive, 512kB Cache, (U)DMA +Uniform CD-ROM driver Revision: 3.20 +8139cp: 10/100 PCI Ethernet driver v1.2 (Mar 22, 2004) +ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 10 +ACPI: PCI Interrupt 0000:00:03.0[A] -> Link [LNKC] -> GSI 10 (level, high) -> IRQ 10 +eth0: RTL-8139C+ at 0xf8906000, 52:54:00:c2:70:1b, IRQ 10 +PCI: Setting latency timer of device 0000:00:03.0 to 64 +8139too Fast Ethernet driver 0.9.27 +ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10 +ACPI: PCI Interrupt 0000:00:05.0[A] -> Link [LNKA] -> GSI 10 (level, high) -> IRQ 10 +input: PC Speaker as /class/input/input2 +piix4_smbus 0000:00:01.3: Found 0000:00:01.3 device +ACPI: PCI Interrupt 0000:00:04.0[A] -> Link [LNKD] -> GSI 11 (level, high) -> IRQ 11 +PCI: Setting latency timer of device 0000:00:04.0 to 64 +FDC 0 is a S82078B +lp: driver loaded but no devices found +ACPI: Power Button (FF) [PWRF] +ACPI: Mapper loaded +dell-wmi: No known WMI GUID found +md: Autodetecting RAID arrays. +md: autorun ... +md: ... autorun DONE. +device-mapper: multipath: version 1.0.6 loaded +loop: loaded (max 8 devices) +EXT3 FS on dm-0, internal journal +kjournald starting. Commit interval 5 seconds +EXT3 FS on hda1, internal journal +EXT3-fs: mounted filesystem with ordered data mode. +SELinux: initialized (dev hda1, type ext3), uses xattr +SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs +Adding 2097144k swap on /dev/VolGroup00/LogVol01. Priority:-1 extents:1 across:2097144k +SELinux: initialized (dev binfmt_misc, type binfmt_misc), uses genfs_contexts diff --git a/t/pt-summary/samples/Linux/003/memory b/t/pt-summary/samples/Linux/003/memory new file mode 100644 index 00000000..3c5302d5 --- /dev/null +++ b/t/pt-summary/samples/Linux/003/memory @@ -0,0 +1,34 @@ + total used free shared buffers cached +Mem: 1059586048 236732416 822853632 0 51183616 127881216 +-/+ buffers/cache: 57667584 1001918464 +Swap: 2147475456 0 2147475456 +MemTotal: 1034752 kB +MemFree: 803568 kB +Buffers: 49984 kB +Cached: 124884 kB +SwapCached: 0 kB +Active: 85200 kB +Inactive: 121000 kB +HighTotal: 131060 kB +HighFree: 240 kB +LowTotal: 903692 kB +LowFree: 803328 kB +SwapTotal: 2097144 kB +SwapFree: 2097144 kB +Dirty: 80 kB +Writeback: 0 kB +AnonPages: 31340 kB +Mapped: 8792 kB +Slab: 14944 kB +PageTables: 1324 kB +NFS_Unstable: 0 kB +Bounce: 0 kB +CommitLimit: 2614520 kB +Committed_AS: 139488 kB +VmallocTotal: 114680 kB +VmallocUsed: 6304 kB +VmallocChunk: 108216 kB +HugePages_Total: 0 +HugePages_Free: 0 +HugePages_Rsvd: 0 +Hugepagesize: 4096 kB diff --git a/t/pt-summary/samples/Linux/003/mounted_fs b/t/pt-summary/samples/Linux/003/mounted_fs new file mode 100644 index 00000000..b2f7a3f8 --- /dev/null +++ b/t/pt-summary/samples/Linux/003/mounted_fs @@ -0,0 +1,3 @@ +/dev/hda1 99M 13M 82M 13% /boot on /boot type ext3 (rw) +/dev/mapper/VolGroup00-LogVol00 5.7G 1.1G 4.4G 20% / on / type ext3 (rw) +tmpfs 506M 0 506M 0% /dev/shm on /dev/shm type tmpfs (rw) diff --git a/t/pt-summary/samples/Linux/003/netstat b/t/pt-summary/samples/Linux/003/netstat new file mode 100644 index 00000000..688b7dd1 --- /dev/null +++ b/t/pt-summary/samples/Linux/003/netstat @@ -0,0 +1,6 @@ +Active Internet connections (servers and established) +Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name +tcp 0 0 0.0.0.0:966 0.0.0.0:* LISTEN - +tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN - +tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN - +tcp 0 0 :::22 :::* LISTEN - diff --git a/t/pt-summary/samples/Linux/003/notable_procs b/t/pt-summary/samples/Linux/003/notable_procs new file mode 100644 index 00000000..41bd9b97 --- /dev/null +++ b/t/pt-summary/samples/Linux/003/notable_procs @@ -0,0 +1,2 @@ + PID OOM COMMAND + 2333 +0 sshd diff --git a/t/pt-summary/samples/Linux/003/partitioning b/t/pt-summary/samples/Linux/003/partitioning new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/t/pt-summary/samples/Linux/003/partitioning @@ -0,0 +1 @@ + diff --git a/t/pt-summary/samples/Linux/003/proc_cpuinfo_copy b/t/pt-summary/samples/Linux/003/proc_cpuinfo_copy new file mode 100644 index 00000000..1ab08a88 --- /dev/null +++ b/t/pt-summary/samples/Linux/003/proc_cpuinfo_copy @@ -0,0 +1,19 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 3 +model name : QEMU Virtual CPU version 0.14.1 +stepping : 3 +cpu MHz : 1662.701 +cache size : 4096 KB +fdiv_bug : no +hlt_bug : no +f00f_bug : no +coma_bug : no +fpu : yes +fpu_exception : yes +cpuid level : 4 +wp : yes +flags : fpu pse tsc msr pae mce cx8 apic pge cmov pat mmx fxsr sse sse2 up pni popcnt +bogomips : 3325.40 + diff --git a/t/pt-summary/samples/Linux/003/processes b/t/pt-summary/samples/Linux/003/processes new file mode 100644 index 00000000..043ca24e --- /dev/null +++ b/t/pt-summary/samples/Linux/003/processes @@ -0,0 +1,10 @@ + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 3000 hugmeir 17 0 2288 952 728 R 24.6 0.1 0:01.57 top + 2309 root 17 0 29432 1392 1068 S 2.2 0.1 0:01.20 automount + 381 root 10 -5 0 0 0 S 0.9 0.0 0:02.98 kjournald + 2199 root 25 0 12824 1320 596 S 0.4 0.1 0:10.88 pcscd + 1 root 15 0 2160 668 576 S 0.0 0.1 0:39.32 init + 2 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/0 + 3 root 34 19 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0 + 4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 + 5 root 10 -5 0 0 0 S 0.0 0.0 0:01.63 events/0 diff --git a/t/pt-summary/samples/Linux/003/raid-controller b/t/pt-summary/samples/Linux/003/raid-controller new file mode 100644 index 00000000..e69de29b diff --git a/t/pt-summary/samples/Linux/003/summary b/t/pt-summary/samples/Linux/003/summary new file mode 100644 index 00000000..61c47cc8 --- /dev/null +++ b/t/pt-summary/samples/Linux/003/summary @@ -0,0 +1,23 @@ +platform Linux +hostname localhost.localdomain +kernel 2.6.18-274.el5 +release CentOS release 5.7 (Final) +CPU_ARCH 32-bit +OS_ARCH 32-bit +virt QEmu +compiler GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-51). +rss 66248704 +raid_controller No RAID controller detected +threading NPTL 2.5 +getenforce No SELinux detected +swappiness +disks dm-0 +dm-1 +hda +hdc +md0 +internal::hda [cfq] 128 +internal::hdc [cfq] 128 +dentry-state 9175 7239 45 0 0 0 +file-nr 640 0 102187 +inode-nr 5259 148 diff --git a/t/pt-summary/samples/Linux/003/sysctl b/t/pt-summary/samples/Linux/003/sysctl new file mode 100644 index 00000000..e69de29b diff --git a/t/pt-summary/samples/Linux/003/uptime b/t/pt-summary/samples/Linux/003/uptime new file mode 100644 index 00000000..2f693ef7 --- /dev/null +++ b/t/pt-summary/samples/Linux/003/uptime @@ -0,0 +1 @@ + 03:31:47 up 35 min, 1 user, load average: 1.10, 0.62, 1.31 diff --git a/t/pt-summary/samples/Linux/003/vmstat b/t/pt-summary/samples/Linux/003/vmstat new file mode 100644 index 00000000..4b22d64c --- /dev/null +++ b/t/pt-summary/samples/Linux/003/vmstat @@ -0,0 +1,7 @@ +procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ + r b swpd free buff cache si so bi bo in cs us sy id wa st + 1 0 0 803444 49984 124916 0 0 87 17 1006 57 47 23 28 1 0 + 1 0 0 803444 49984 124940 0 0 0 104 992 59 75 25 0 0 0 + 1 0 0 803444 49984 124940 0 0 0 0 839 35 73 27 0 0 0 + 1 0 0 803444 49984 124940 0 0 0 0 903 35 78 22 0 0 0 + 2 0 0 803444 49984 124940 0 0 0 0 722 22 78 22 0 0 0 diff --git a/t/pt-summary/samples/Linux/output_002.txt b/t/pt-summary/samples/Linux/output_002.txt new file mode 100644 index 00000000..4ac05140 --- /dev/null +++ b/t/pt-summary/samples/Linux/output_002.txt @@ -0,0 +1,76 @@ + Hostname | localhost.localdomain + Uptime | 03:34:31 up 38 min, 1 user, load average: 1.60, 1.03, 1.37 + Platform | Linux + Release | CentOS release 5.7 (Final) + Kernel | 2.6.18-274.el5 +Architecture | CPU = 32-bit, OS = 32-bit + Threading | NPTL 2.5 + Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-51). + SELinux | No SELinux detected + Virtualized | QEmu +# Processor ################################################## + Processors | physical = 1, cores = 0, virtual = 1, hyperthreading = no + Speeds | 1x1662.701 + Models | 1xQEMU Virtual CPU version 0.14.1 + Caches | 1x4096 KB +# Memory ##################################################### + Total | 1.0M + Free | 784.4M + Used | physical = 226.1M, swap allocated = 2.0G, swap used = 0.0, virtual = 226.1M + Buffers | 48.8M + Caches | 122.2M + Dirty | 152 kB + UsedRSS | 63.2M + Swappiness | + DirtyPolicy | +# Mounted Filesystems ######################################## + Filesystem Size Used Type Opts Mountpoint + /dev/hda1 99M 13% ext3 rw /boot + /dev/mapper/VolGroup00-LogVol00 5.7G 20% ext3 rw / + tmpfs 506M 0% tmpfs rw /dev/shm +# Disk Schedulers And Queue Size ############################# + dm-0 | +# Disk Partioning ############################################ +Device Type Start End Size +============ ==== ========== ========== ================== +/dev/hda Disk 8589934592 +/dev/hda1 Part 1 13 98703360 +/dev/hda2 Part 14 1044 8472038400 +# Kernel Inode State ######################################### +dentry-state | 9392 7451 45 0 0 0 + file-nr | 640 0 102187 + inode-nr | 5431 148 +# LVM Volumes ################################################ +Cannot execute 'lvs' +# RAID Controller ############################################ + Controller | No RAID controller detected +# Network Config ############################################# +# Network Connections ######################################## + Connections from remote IP addresses + Connections to local IP addresses + Connections to top 10 local ports + States of connections + LISTEN 4 +# Top Processes ############################################## + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 3443 root 17 0 2288 956 728 R 25.5 0.1 0:01.30 top + 2252 root 15 0 2060 684 604 S 1.3 0.1 0:09.03 hald-addon-stor + 2230 haldaemo 15 0 5836 3928 1700 S 0.7 0.4 0:32.54 hald + 1 root 15 0 2160 668 576 S 0.0 0.1 0:39.36 init + 2 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/0 + 3 root 34 19 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0 + 4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 + 5 root 10 -5 0 0 0 S 0.0 0.0 0:01.77 events/0 + 6 root 10 -5 0 0 0 S 0.0 0.0 0:00.26 khelper +# Notable Processes ########################################## + PID OOM COMMAND + 2333 +0 sshd +# Simplified and fuzzy rounded vmstat (wait please) ########## + procs ---swap-- -----io---- ---system---- --------cpu-------- + r b si so bi bo ir cs us sy il wa st + 2 0 0 0 80 15 1000 60 48 24 27 1 0 + 1 0 0 0 0 0 1000 50 70 30 0 0 0 + 1 0 0 0 0 100 800 50 67 33 0 0 0 + 1 0 0 0 0 0 1000 35 80 20 0 0 0 + 1 0 0 0 0 0 900 45 62 38 0 0 0 +# The End #################################################### diff --git a/t/pt-summary/samples/Linux/output_003.txt b/t/pt-summary/samples/Linux/output_003.txt new file mode 100644 index 00000000..42e4cb26 --- /dev/null +++ b/t/pt-summary/samples/Linux/output_003.txt @@ -0,0 +1,73 @@ + Hostname | localhost.localdomain + Uptime | 03:31:47 up 35 min, 1 user, load average: 1.10, 0.62, 1.31 + Platform | Linux + Release | CentOS release 5.7 (Final) + Kernel | 2.6.18-274.el5 +Architecture | CPU = 32-bit, OS = 32-bit + Threading | NPTL 2.5 + Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-51). + SELinux | No SELinux detected + Virtualized | QEmu +# Processor ################################################## + Processors | physical = 1, cores = 0, virtual = 1, hyperthreading = no + Speeds | 1x1662.701 + Models | 1xQEMU Virtual CPU version 0.14.1 + Caches | 1x4096 KB +# Memory ##################################################### + Total | 1.0M + Free | 784.7M + Used | physical = 225.8M, swap allocated = 2.0G, swap used = 0.0, virtual = 225.8M + Buffers | 48.8M + Caches | 122.0M + Dirty | 80 kB + UsedRSS | 63.2M + Swappiness | + DirtyPolicy | +# Mounted Filesystems ######################################## + Filesystem Size Used Type Opts Mountpoint + /dev/hda1 99M 13% ext3 rw /boot + /dev/mapper/VolGroup00-LogVol00 5.7G 20% ext3 rw / + tmpfs 506M 0% tmpfs rw /dev/shm +# Disk Schedulers And Queue Size ############################# + dm-0 | +# Disk Partioning ############################################ +Device Type Start End Size +============ ==== ========== ========== ================== +# Kernel Inode State ######################################### +dentry-state | 9175 7239 45 0 0 0 + file-nr | 640 0 102187 + inode-nr | 5259 148 +# LVM Volumes ################################################ +Cannot execute 'lvs' +# RAID Controller ############################################ + Controller | No RAID controller detected +# Network Config ############################################# +# Network Connections ######################################## + Connections from remote IP addresses + Connections to local IP addresses + Connections to top 10 local ports + States of connections + LISTEN 4 +# Top Processes ############################################## + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 3000 hugmeir 17 0 2288 952 728 R 24.6 0.1 0:01.57 top + 2309 root 17 0 29432 1392 1068 S 2.2 0.1 0:01.20 automount + 381 root 10 -5 0 0 0 S 0.9 0.0 0:02.98 kjournald + 2199 root 25 0 12824 1320 596 S 0.4 0.1 0:10.88 pcscd + 1 root 15 0 2160 668 576 S 0.0 0.1 0:39.32 init + 2 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/0 + 3 root 34 19 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0 + 4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 + 5 root 10 -5 0 0 0 S 0.0 0.0 0:01.63 events/0 +# Notable Processes ########################################## + PID OOM COMMAND + 2333 +0 sshd +# Simplified and fuzzy rounded vmstat (wait please) ########## + procs ---swap-- -----io---- ---system---- --------cpu-------- + r b si so bi bo ir cs us sy il wa st + 1 0 0 0 90 15 1000 60 47 23 28 1 0 + 1 0 0 0 0 100 1000 60 75 25 0 0 0 + 1 0 0 0 0 0 800 35 73 27 0 0 0 + 1 0 0 0 0 0 900 35 78 22 0 0 0 + 2 0 0 0 0 0 700 20 78 22 0 0 0 +# The End ####################################################