kernel:Tools & Files(1) システム情報取得

  • システム情報取得
    • システム全体
/var/log/messages 一般的なシステム情報を記録するログファイル
top CPU使用率、Process統計値、Memory使用状況などシステムの全体的な情報を表示する
/proc/stat kernelやシステムの統計情報ファイル
  • "/var/log/messages"
[root@tkcent1 ~]# tail -f /var/log/messages
Nov 25 11:04:58 tkcent1 smartd[3021]: Home page is http://smartmontools.sourceforge.net/  
  • "top"
top - 11:07:36 up 3 min,  1 user,  load average: 0.38, 0.92, 0.45
Tasks:  75 total,   1 running,  74 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.3%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1025676k total,   255240k used,   770436k free,    10484k buffers
Swap:  2031608k total,        0k used,  2031608k free,   160880k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                     
 2515 root      20   0     0    0    0 S  0.3  0.0   0:00.06 vmhgfs                                                                                                       
 2584 root      20   0 10604  844  672 S  0.3  0.1   0:00.35 vmware-guestd                                                                                                
 2823 root      20   0 60236 2028  684 S  0.3  0.2   0:00.01 sendmail                                                                                                     
 2984 root      20   0 10180  640  548 S  0.3  0.1   0:00.15 hald-addon-stor                                                                                              
 3099 takao     20   0 71692 1512  916 S  0.3  0.1   0:00.05 sshd                                                                                                         
 3220 root      20   0 12584 1024  796 R  0.3  0.1   0:00.03 top        
  • "/proc/stat"
[root@tkcent1 ~]# cat /proc/stat 
cpu  1671 0 1795 20070 1508 66 57 0
cpu0 1671 0 1795 20070 1508 66 57 0
intr 259077
ctxt 52171
btime 1195956242
processes 3229
procs_running 1
procs_blocked 0
    • CPU・Hardware関連
sysreport システム構成に関する情報を収集して表示する
mpstat /procfsの統計データのうち、CPUに関する情報を表示する
/proc/cpuinfo CPUに関する統計情報を表示する
  • "sysreport"
[root@tkcent1 ~]# sysreport

This utility will go through and collect some detailed information 
about the hardware and setup of your Red Hat Linux system.
This information will be used to diagnose problems with your system
and will be considered confidential information.  Red Hat will use
this information for diagnostic purposes ONLY. 

Please wait while we collect information about your system.

This process may take a while to complete....
No changes will be made to your system during this process.

NOTE: You can safely ignore a failed message. This only means a file
we were checking for did not exist.

If your system hangs while gathering rpm information, please abort
the script with CTRL-C and run it again after adding -norpm to the
sysreport command line

Press ENTER to continue, or CTRL-C to quit.


Getting system configuration information.

Determining Red Hat Linux version:                         [  OK  ]
Determinding your current hostname:                        [  OK  ]
Getting the date:                                          [  OK  ]
Checking your systems current uptime and load average:     [  OK  ]
Checking available memory:                                 [  OK  ]
Checking free disk space:                                  [  OK  ]
(中略)
Collecting Name Service Switch config information:         [  OK  ]
Collecting NIS client information:                         [  OK  ]
Collecting system configuration information:               [  OK  ]
Collecting information about system authentication (pam):  [  OK  ]

Getting information about the kernel.

Getting kernel version:                                    [  OK  ]
Checking module information:                               [  OK  ]
Checking module information autofs4:                       [  OK  ]
(中略)
Getting kernel command line                                [  OK  ]
Gathering information about your CPU:                      [  OK  ]
Gathering information about your Ram:                      [  OK  ]
Gathering information about your ioports:                  [  OK  ]
Gathering information about your interrupts:               [  OK  ]
Gathering information about your scsi devices:             [  OK  ]
Gathering information about your dma:                      [  OK  ]
Gathering information about your devices (/proc/devices):  [  OK  ]
Gathering information about your ide drivers:              [  OK  ]
Gathering information about your bus:                      [  OK  ]
Gathering info on udev configuration:                      [  OK  ]

Getting disk and filesystem information.

Collecting information from /etc/fstab:                    [  OK  ]
Checking mounted file systems (mount)                      [  OK  ]
Checking mounted file systems (/proc/mounts)               [  OK  ]
Collecting Software RAID information (/proc/mdstat)        [  OK  ]
Collecting Software RAID information (mdadm -D /dev/md*)   [  OK  ]
Collecting Automount information (auto.master)             [  OK  ]
Collecting Automount information (auto.misc)               [  OK  ]
Collecting Automount information (auto.net)                [  OK  ]
Collecting LVM information:                                [  OK  ]
Collecting USB devices list (lsusb):                       [  OK  ]
Collecting global devices list (lshal):                    [  OK  ]

collecting information about commonly used network services

Collecting information from /etc/host.conf:                [  OK  ]
Collecting information from /etc/hosts:                    [  OK  ]
Collecting information from /etc/hosts.allow:              [  OK  ]
Collecting information from /etc/hosts.deny:               [  OK  ]
Collecting information about ypbind configuration:         [  OK  ]
(中略)
Getting Kerberos informations (/etc/krb5.conf)             [  OK  ]
Getting information about apache                           [  OK  ]
Getting information about apache (proxy_ajp.conf)          [  OK  ]
Getting information about apache (welcome.conf)            [  OK  ]
Getting information about CUPS (/etc/cups/classes.conf)    [  OK  ]
Getting information about CUPS (/etc/cups/client.conf)     [  OK  ]
Getting information about CUPS (/etc/cups/cupsd.conf)      [  OK  ]
Getting information about CUPS (/etc/cups/pdftops.conf)    [  OK  ]
Getting information about CUPS (/etc/cups/printers.conf)   [  OK  ]
Getting information about CUPS (/etc/cups/snmp.conf)       [  OK  ]

Gathering information from system logs

Collecting information from dmesg:                         [  OK  ]
Collecting messages files (/var/log/messages)              [  OK  ]
Collecting messages files (/var/log/messages.1)            [  OK  ]
Collecting maillog files (/var/log/maillog)                [  OK  ]
Collecting maillog files (/var/log/maillog.1)              [  OK  ]
Collecting information (/var/log/rpmpkgs)                  [  OK  ]
Collecting information (/var/log/boot.log)                 [  OK  ]
Collecting information (/var/log/secure)                   [  OK  ]
Collecting log files from Apache                           [  OK  ]

Getting information about RHN


Gathering information on SELinux setup

Collecting log files from RHN                              [  OK  ]

Please enter your case number (if you have one): 

Please send /root/tkcent1.xxxxxxxx.local.2007112521349.tar.bz2 to your support
representative.

[root@tkcent1 ~]# 
  • "/proc/cpuinfo"
[root@tkcent1 ~]# cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 15
model name	: Intel(R) Core(TM)2 Duo CPU     T7500  @ 2.20GHz
stepping	: 8
cpu MHz		: 2194.374
cache size	: 4096 KB
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx lm constant_tsc up arch_perfmon pebs bts rep_good pni ds_cpl ssse3 cx16 lahf_lm
bogomips	: 4395.03
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:
    • Process関連
/proc//stat Process状態を記録したファイル
ps 実行されているProcessの一覧表示
pstree 実行中Processのツリー表示
  • "ps"および"/proc//stat"
[root@tkcent1 ~]# ps
  PID TTY          TIME CMD
 3128 pts/0    00:00:00 su
 3129 pts/0    00:00:00 bash
16884 pts/0    00:00:00 ps
[root@tkcent1 ~]# cat /proc/3128/stat
3128 (su) S 3100 3128 3100 34816 16902 4202752 455 0 2 0 1 0 0 0 20 0 1 0 7825 102563840 332 18446744073709551615 93824992231424 93824992254740 140734898832704 18446744073709551615 47851397857621 0 2147196671 0 16384 18446744071564403373 0 0 17 0 0 0 6
[root@tkcent1 ~]# pstree
init─┬─acpid
     ├─anacron
     ├─atd
     ├─auditd─┬─python
     │        └─{auditd}
     ├─automount───4*[{automount}]
     ├─avahi-daemon───avahi-daemon
     ├─crond
     ├─cupsd
     ├─dbus-daemon───{dbus-daemon}
     ├─2*[dhclient]
     ├─gpm
     ├─hald───hald-runner─┬─hald-addon-keyb
     │                    └─hald-addon-stor
     ├─hcid
     ├─klogd
     ├─mcstransd
     ├─6*[mingetty]
     ├─pcscd───{pcscd}
     ├─portmap
     ├─restorecond
     ├─rpc.idmapd
     ├─2*[sendmail]
     ├─smartd
     ├─sshd───sshd───sshd───bash───su───bash───pstree
     ├─syslogd
     ├─udevd
     ├─vmware-guestd
     ├─xfs
     └─yum-updatesd
    • メモリ関連
free メモリ使用量と空き容量の表示
/proc/meminfo 使用中/未使用のメモリ情報の表示
/proc/sys/vm/overcommit_memory 仮想メモリのオーバーコミットの許可/禁止の表示
  • "free"
[root@tkcent1 ~]# free
             total       used       free     shared    buffers     cached
Mem:       1025676    1016964       8712          0      57308     794736
 -/+ buffers/cache:     164920     860756
Swap:      2031608          4    2031604
  • "/proc/meminfo"
[root@tkcent1 ~]# cat /proc/meminfo
MemTotal:      1025676 kB
MemFree:          9032 kB
Buffers:         76580 kB
Cached:         725080 kB
SwapCached:          8 kB
Active:         389028 kB
Inactive:       478652 kB
SwapTotal:     2031608 kB
SwapFree:      2031600 kB
Dirty:            4196 kB
Writeback:           0 kB
AnonPages:       66004 kB
Mapped:           9760 kB
Slab:           127724 kB
SReclaimable:   100416 kB
SUnreclaim:      27308 kB
PageTables:       3784 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   2544444 kB
Committed_AS:   114904 kB
VmallocTotal: 34359738367 kB
VmallocUsed:      8200 kB
VmallocChunk: 34359729339 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB
  • "/proc/sys/vm/overcommit_memory"
[root@tkcent1 ~]# cat /proc/sys/vm/overcommit_memory 
0
    • I/O関連
iostat /procfsが提供する統計データのうち、I/O処理に関する情報を収集して表示する
DAVL(Disk Allocation Viewer for Linux) HDDのフラグメンテーション状態の可視化ツール(http://davl.sorceforge.jp/)
    • ネットワーク関連
ifconfig Network Inferface情報の表示/設定
host DNSによるホスト名検索
route IP経路テーブルの表示/設定
traceroute ホストからホストまでのネットワーク経路の表示
ethtool NIC状態の表示/設定
    • "ifconfig"
[root@tkcent1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:01:83:60  
          inet addr:172.16.108.132  Bcast:172.16.108.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe01:8360/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1348 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1027 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:115990 (113.2 KiB)  TX bytes:233098 (227.6 KiB)
          Base address:0x2040 Memory:e8940000-e8960000 
    • "route"
[root@tkcent1 ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.108.0    *               255.255.255.0   U     0      0        0 eth0
default         172.16.108.254  0.0.0.0         UG    0      0        0 eth0