Merged Baron's changes

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-03-30 17:28:53 -03:00
2 changed files with 590 additions and 68 deletions

View File

@@ -1754,34 +1754,11 @@ parse_lsi_megaraid_bbu_status () { local PTFUNCNAME=parse_lsi_megaraid_bbu_statu
}
format_lvs () { local PTFUNCNAME=format_lvs;
local lvs_file="$1"
local vgs_file="$2"
local lvs_errors="$3"
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"
tail -n+2 "$lvs_file" | while read lvs_line; do
local current_vg="$(echo $lvs_line | awk '{print $2}')"
while read vgs_line; do
local current_vgs_vg="$(echo $vgs_line | awk '{print $1}' )"
if [ "$current_vg" = "$current_vgs_vg" ]; then
lvs_line="${lvs_line}$(echo $vgs_line | sed -e "s/^ *$current_vg//")"
break
fi
done < "$vgs_file"
echo $lvs_line
done
local file="$1"
if [ -e "$file" ]; then
grep -v "open failed" "$file"
else
if [ -e "$lvs_file" ]; then
cat "$lvs_file"
elif [ -e "$lvs_errors" ]; then
echo "lvs didn't output anything and had the following errors:"
cat "$lvs_errors"
else
echo "Cannot execute 'lvs'";
fi
echo "Unable to collect information";
fi
}
@@ -2066,7 +2043,9 @@ report_system_summary () { local PTFUNCNAME=report_system_summary;
done
section "LVM_Volumes"
format_lvs "$data_dir/lvs" "$data_dir/vgs" "$data_dir/lvs.stderr"
format_lvs "$data_dir/lvs"
section "LVM_Volume_Groups"
format_lvs "$data_dir/vgs"
fi
section "RAID_Controller"
@@ -2180,16 +2159,14 @@ sigtrap() { local PTFUNCNAME=sigtrap;
# Execute the program if it was not included from another file. This makes it
# possible to include without executing, and thus test.
# Execute the program if it was not included from another file.
# This makes it possible to include without executing, and thus test.
if [ "${0##*/}" = "$TOOL" ] \
|| [ "${0##*/}" = "bash" -a "$_" = "$0" ]; then
# Set up temporary dir.
mk_tmpdir
# Parse command line options.
parse_options $0 "$@"
usage_or_errors $0
parse_options "$0" "$@"
usage_or_errors "$0"
po_status=$?
rm_tmpdir
@@ -2209,7 +2186,7 @@ fi
=head1 NAME
pt-summary - Summarize system information in a nice way.
pt-summary - Summarize system information nicely.
=head1 SYNOPSIS
@@ -2218,17 +2195,13 @@ Usage: pt-summary
pt-summary conveniently summarizes the status and configuration of a server.
It is not a tuning tool or diagnosis tool. It produces a report that is easy
to diff and can be pasted into emails without losing the formatting. This
tool works well on Linux systems.
tool works well on many types of Unix systems.
Download and run:
wget http://percona.com/get/pt-summary
bash ./pt-summary
Download and run in a single step:
wget -O- http://percona.com/get/summary | bash
=head1 RISKS
The following section is included to inform users about the potential risks,
@@ -2238,8 +2211,7 @@ tools) and those created by bugs.
pt-summary is a read-only tool. It should be very low-risk.
At the time of this release, we know of no bugs that could cause serious harm
to users.
At the time of this release, we know of no bugs that could harm users.
The authoritative source for updated information is always the online issue
tracking system. Issues that affect this tool will be marked as such. You can
@@ -2256,6 +2228,194 @@ then runs Unix commands on these results to format them nicely. It works
best when executed as a privileged user, but will also work without privileges,
although some output might not be possible to generate without root.
=head1 OUTPUT
Many of the outputs from this tool are deliberately rounded to show their
magnitude but not the exact detail. This is called fuzzy-rounding. The idea is
that it doesn't matter whether a particular counter is 918 or 921; such a small
variation is insignificant, and only makes the output hard to compare to other
servers. Fuzzy-rounding rounds in larger increments as the input grows. It
begins by rounding to the nearest 5, then the nearest 10, nearest 25, and then
repeats by a factor of 10 larger (50, 100, 250), and so on, as the input grows.
The following is a simple report generated from a CentOS virtual machine,
broken into sections with commentary following each section. Some long lines
are reformatted for clarity when reading this documentation as a manual page in
a terminal.
# Percona Toolkit System Summary Report ######################
Date | 2012-03-30 00:58:07 UTC (local TZ: EDT -0400)
Hostname | localhost.localdomain
Uptime | 20:58:06 up 1 day, 20 min, 1 user,
load average: 0.14, 0.18, 0.18
System | innotek GmbH; VirtualBox; v1.2 ()
Service Tag | 0
Platform | Linux
Release | CentOS release 5.5 (Final)
Kernel | 2.6.18-194.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-48).
SELinux | Enforcing
Virtualized | VirtualBox
This section shows the current date and time, and a synopsis of the server and
operating system.
# Processor ##################################################
Processors | physical = 1, cores = 0, virtual = 1, hyperthreading = no
Speeds | 1x2510.626
Models | 1xIntel(R) Core(TM) i5-2400S CPU @ 2.50GHz
Caches | 1x6144 KB
This section is derived from F</proc/cpuinfo>.
# Memory #####################################################
Total | 503.2M
Free | 29.0M
Used | physical = 474.2M, swap allocated = 1.0M,
swap used = 16.0k, virtual = 474.3M
Buffers | 33.9M
Caches | 262.6M
Dirty | 396 kB
UsedRSS | 201.9M
Swappiness | 60
DirtyPolicy | 40, 10
Locator Size Speed Form Factor Type Type Detail
======= ==== ===== =========== ==== ===========
Information about memory is gathered from C<free>. The Used statistic is the
total of the rss sizes displayed by C<ps>. The Dirty statistic for the cached
value comes from F</proc/meminfo>. On Linux, the swappiness settings are
gathered from C<sysctl>. The final portion of this section is a table of the
DIMMs, which comes from C<dmidecode>. In this example there is no output.
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/mapper/VolGroup00-LogVol00 15G 17% ext3 rw /
/dev/sda1 99M 13% ext3 rw /boot
tmpfs 252M 0% tmpfs rw /dev/shm
The mounted filesystem section is a combination of information from C<mount> and
C<df>. This section is skipped if you disable L<"--summarize-mounts">.
# Disk Schedulers And Queue Size #############################
dm-0 | UNREADABLE
dm-1 | UNREADABLE
hdc | [cfq] 128
md0 | UNREADABLE
sda | [cfq] 128
The disk scheduler information is extracted from the F</sys> filesystem in
Linux.
# Disk Partioning ############################################
Device Type Start End Size
============ ==== ========== ========== ==================
/dev/sda Disk 17179869184
/dev/sda1 Part 1 13 98703360
/dev/sda2 Part 14 2088 17059230720
Information about disk partitioning comes from C<fdisk -l>.
# Kernel Inode State #########################################
dentry-state | 10697 8559 45 0 0 0
file-nr | 960 0 50539
inode-nr | 14059 8139
These lines are from the files of the same name in the F</proc/sys/fs>
directory on Linux. Read the C<proc> man page to learn about the meaning of
these files on your system.
# LVM Volumes ################################################
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 269.00G
LogVol01 VolGroup00 -wi-ao 9.75G
This section shows the output of C<lvs>.
# RAID Controller ############################################
Controller | No RAID controller detected
The tool can detect a variety of RAID controllers by examining C<lspci> and
C<dmesg> information. If the controller software is installed on the system, in
many cases it is able to execute status commands and show a summary of the RAID
controller's status and configuration. If your system is not supported, please
file a bug report.
# Network Config #############################################
Controller | Intel Corporation 82540EM Gigabit Ethernet Controller
FIN Timeout | 60
Port Range | 61000
The network controllers attached to the system are detected from C<lspci>. The
TCP/IP protocol configuration parameters are extracted from C<sysctl>. You can skip this section by disabling the L<"--summarize-network"> option.
# Interface Statistics #######################################
interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors
========= ======== ========== ========= ======== ========== =========
lo 60000000 12500 0 60000000 12500 0
eth0 15000000 80000 0 1500000 10000 0
sit0 0 0 0 0 0 0
Interface statistics are gathered from C<ip -s link> and are fuzzy-rounded. The
columns are received and transmitted bytes, packets, and errors. You can skip
this section by disabling the L<"--summarize-network"> option.
# Network Connections ########################################
Connections from remote IP addresses
127.0.0.1 2
Connections to local IP addresses
127.0.0.1 2
Connections to top 10 local ports
38346 1
60875 1
States of connections
ESTABLISHED 5
LISTEN 8
This section shows a summary of network connections, retrieved from C<netstat>
and "fuzzy-rounded" to make them easier to compare when the numbers grow large.
There are two sub-sections showing how many connections there are per origin
and destination IP address, and a sub-section showing the count of ports in
use. The section ends with the count of the network connections' states. You
can skip this section by disabling the L<"--summarize-network"> option.
# Top Processes ##############################################
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 2072 628 540 S 0.0 0.1 0:02.55 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.03 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:00.97 events/0
6 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
7 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.13 kblockd/0
11 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
# Notable Processes ##########################################
PID OOM COMMAND
2028 +0 sshd
This section shows the first few lines of C<top> so that you can see what
processes are actively using CPU time. The notable processes include the SSH
daemon and any process whose out-of-memory-killer priority is set to 17. You
can skip this section by disabling the L<"--summarize-processes"> option.
# 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 3 15 30 125 0 0 99 0 0
0 0 0 0 0 0 1250 800 6 10 84 0 0
0 0 0 0 0 0 1000 125 0 0 100 0 0
0 0 0 0 0 0 1000 125 0 0 100 0 0
0 0 0 0 0 450 1000 125 0 1 88 11 0
# The End ####################################################
This section is a trimmed-down sample of C<vmstat 1 5>, so you can see the
general status of the system at present. The values in the table are
fuzzy-rounded, except for the CPU columns. You can skip this section by
disabling the L<"--summarize-processes"> option.
=head1 OPTIONS
=over
@@ -2275,37 +2435,37 @@ Print help and exit.
type: string
Save the data files used to generate the summary in this directory.
Save the collected data in this directory.
=item --read-samples
type: string
Create a report from the files found in this directory.
Create a report from the files in this directory.
=item --summarize-mounts
default: yes; negatable: yes
Whenever the tool summarizes mounted filesystems and disk fullness.
Report on mounted filesystems and disk usage.
=item --summarize-network
default: yes; negatable: yes
Whenever the tool prints information on network controllers & config.
Report on network controllers and configuration.
=item --summarize-processes
default: yes; negatable: yes
Whenever the tool summarizes the top processes and vmstat information.
Report on top processes and C<vmstat> output.
=item --sleep
type: int; default: 5
How much time to sleep when gathering samples from vmstat.
How long to sleep when gathering samples from vmstat.
=item --version