前些天一直在寻找基于linux下的软硬件信息收集工具,虽然使用linux下的一些命令可以收集到所需的信息,但比较繁琐,无意之中发现了Percona Toolkit这个工具,官方地址为http://www.percona.com/software/percona-toolkit/,其实这是一组针对mysql的命令行工具,用来管理 MySQL 和系统任务,源于Aspersa,且看解释Aspersa has become part of Percona Toolkit, and there will be no further development or releases separate from Percona Toolkit. 但用来收集软硬件信息也还是不错的,可以通过官方地址进行下载,另外,相关命令的使用可以参考这里http://aspersa.googlecode.com/svn/html/support.html,
下面在RHEL5.6上面进行测试安装。 安装之前一定要准备这个文件,perl-TermReadKey,这个是不在红帽提供的软件包之中,所以要按照自己的系统类型进行下载(可以通过google搜索)。 另外,我的系统没有安装perl-DBD-MySQL,perl-DBI包,所以这三个要先进行安装,安装完成之后会在/usr/bin产生以pt开头的命令,
- [root@sandy ~]# rpm -ivh percona-toolkit-1.0.2-1.noarch.rpm
- warning: percona-toolkit-1.0.2-1.noarch.rpm: Header V4 DSA signature: NOKEY, key ID cd2efd2a
- error: Failed dependencies:
- perl(DBD::mysql) >= 1.0 is needed by percona-toolkit-1.0.2-1.noarch
- perl(DBI) >= 1.13 is needed by percona-toolkit-1.0.2-1.noarch
- perl(Term::ReadKey) >= 2.10 is needed by percona-toolkit-1.0.2-1.noarch
- [root@sandy ~]# rpm -ivh perl-TermReadKey-2.30-4.el5.x86_64.rpm
warning: perl-TermReadKey-2.30-4.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:perl-TermReadKey ########################################### [100%]
[root@sandy ~]# rpm -ivh percona-toolkit-1.0.2-1.noarch.rpm
warning: percona-toolkit-1.0.2-1.noarch.rpm: Header V4 DSA signature: NOKEY, key ID cd2efd2a
Preparing... ########################################### [100%]
1:percona-toolkit ########################################### [100%]
[root@sandy ~]# cd /usr/bin/
[root@sandy bin]# ls pt*
pt-archiver pt-find pt-mysql-summary pt-slave-delay pt-tcp-model
pt-collect pt-fk-error-logger pt-online-schema-change pt-slave-find pt-trend
pt-config-diff pt-heartbeat pt-pmp pt-slave-restart pt-upgrade
pt-deadlock-logger pt-index-usage pt-query-advisor pt-stalk pt-variable-advisor
pt-diskstats pt-kill pt-query-digest pt-summary pt-visual-explain
pt-duplicate-key-checker pt-log-player pt-show-grants pt-table-checksum ptx
pt-fifo-split pt-mext pt-sift pt-table-sync
[root@sandy ~]# pt-summary
# Percona Toolkit System Summary Report ######################
Date | 2012-01-06 03:12:58 UTC (local TZ: CST +0800)
Hostname | sandy
Uptime | 21:41, 5 users, load average: 0.00, 0.03, 0.04
System | VMware, Inc.; VMware Virtual Platform; vNone (Other)
Service Tag | VMware-56 4d 5a e6 0f 56 d3 f4-85 03 b8 06 0d 81 2e 10
Platform | Linux
Release | Red Hat Enterprise Linux Server release 4.6 (Tikanga)
Kernel | 2.6.18-238.el5
Architecture | CPU = 64-bit, OS = 64-bit
Threading | NPTL 2.5
Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-50).
SELinux | Disabled
Virtualized | VMWare
# Processor ##################################################
Processors | physical = 1, cores = 0, virtual = 1, hyperthreading = no
Speeds | 1x1595.926
Models | 1xIntel(R) Xeon(R) CPU E5310 @ 1.60GHz
Caches | 1x4096 KB
# Memory #####################################################
Total | 1.26G
Free | 242.62M
Used | physical = 1.02G, swap = 8.00k, virtual = 1.02G
Buffers | 126.59M
Caches | 661.48M
Dirty | 228 kB
UsedRSS | 331.1M
Swappiness | vm.swappiness = 60
DirtyPolicy | vm.dirty_ratio = 40, vm.dirty_background_ratio = 10
DirtyStatus | vm.dirty_bytes = 0, vm.dirty_background_bytes = 0
Locator Size Speed Form Factor Type Type Detail
========= ======== ================= ============= ============= ===========
RAM slot #0 1024 MB Unknown DIMM DRAM EDO
RAM slot #2 128 MB Unknown DIMM DRAM EDO
RAM slot #1 256 MB Unknown DIMM DRAM EDO
RAM slot #3 32 MB Unknown DIMM DRAM EDO
RAM slot #4 4 MB Unknown DIMM DRAM EDO
RAM slot #10 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #11 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #12 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #13 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #14 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #5 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #6 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #7 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #8 {EMPTY} Unknown DIMM DRAM Unknown
RAM slot #9 {EMPTY} Unknown DIMM DRAM Unknown
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/hdc 3.6G 100% iso9660 ro /mnt/iso
/dev/sda1 244M 7% ext3 rw /boot
/dev/sda2 23G 41% ext3 rw /
tmpfs 643M 0% tmpfs rw /dev/shm
# Disk Schedulers And Queue Size #############################
hdc | [cfq] 128
sda | [cfq] 128
# Disk Partioning ############################################
Device Type Start End Size
============ ==== ========== ========== ==================
/dev/hdc Disk 3795843072
/dev/sda Disk 26843545600
/dev/sda1 Part 1 32 254983680
/dev/sda2 Part 33 3008 24470208000
/dev/sda3 Part 3009 3263 2089221120
# Kernel Inode State #########################################
dentry-state | 26423 21010 45 0 0 0
file-nr | 3570 0 65536
inode-nr | 38866 17472
# LVM Volumes ################################################
No volume groups found
# RAID Controller ############################################
Controller | No RAID controller detected
# Network Config #############################################
Controller | Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
FIN Timeout | net.ipv4.tcp_fin_timeout = 60
Port Range | net.ipv4.ip_local_port_range = 1024 65000
# Interface Statistics #######################################
interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors
========= ========= ========== ========== ========== ========== ==========
lo 4000000 1500 0 4000000 1500 0
eth0 20000000 175000 0 5000000 20000 0
# Network Connections ########################################
Connections from remote IP addresses
10.167.45.174 2
Connections to local IP addresses
192.168.22.233 2
Connections to top 10 local ports
22 2
States of connections
ESTABLISHED 2
LISTEN 7
# Top Processes ##############################################
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17047 root 21 0 12760 992 720 R 2.0 0.1 0:00.01 top
1 root 15 0 10372 696 584 S 0.0 0.1 0:00.61 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.00 ksoftirqd/0
4 root 10 -5 0 0 0 S 0.0 0.0 0:00.15 events/0
5 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
18 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
22 root 10 -5 0 0 0 S 0.0 0.0 0:00.11 kblockd/0
23 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
# 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 20 25 400 200 0 1 97 1 0
0 0 0 0 0 0 900 150 0 0 100 0 0
0 0 0 0 0 0 1000 150 0 0 100 0 0
0 0 0 0 0 0 1000 175 0 0 100 0 0
0 0 0 0 0 175 1000 200 0 0 100 0 0
# The End ####################################################
其实percona还有很多其他软件和功能,大多是针对mysql的,详细可参考http://www.percona.com/mysql-consulting/overview/