Tugas SysAdmin linux adalah mengetahui keadaan system yang mereka jalankan atau yang mereka operasikan. Disini saya akan coba share sedikit banyaknya yang sangat wajib diketahui oleh seorang SysAdmin. Dengan tools yang sudah ada di linux sendiri itu sudah sangat memabantu untuk mengetahui semua kejadian system. Dari performa, error, trouble shooting dan lainnya.
==
1. Top
Ini nich saya sering gunakan untuk melihat process yang lagi running. Misalnya para pengguna windows, sama halnya dengan “task manager”. Untuk menajalankannya, langsung dengan command
$top
Berikut dari command “top” :
top – 19:05:54 up 4:20, 2 users, load average: 0.06, 0.06, 0.05Tasks: 160 total, 3 running, 156 sleeping, 0 stopped, 1 zombieCpu(s): 7.4%us, 11.3%sy, 0.0%ni, 80.2%id, 0.0%wa, 1.1%hi, 0.0%si, 0.0%stMem: 2002824k total, 857756k used, 1145068k free, 14320k buffersSwap: 979924k total, 228700k used, 751224k free, 405948k cachedPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND111 root 15 -5 0 0 0 S 10 0.0 9:23.82 kacpi_notify5705 karuwak 20 0 231m 30m 16m S 6 1.5 6:50.16 exe110 root 15 -5 0 0 0 S 3 0.0 2:04.73 kacpid3220 root 20 0 637m 81m 13m S 3 4.2 24:15.17 X9289 karuwak 20 0 125m 13m 9652 S 1 0.7 0:02.78 gnome-terminal5656 karuwak 20 0 119m 37m 11m S 1 1.9 0:38.46 chrome2895 root 20 0 1784 524 480 R 1 0.0 0:07.98 acpid2914 haldaemo 20 0 6728 2564 1928 S 1 0.1 0:11.41 hald2998 root 20 0 19412 4084 1824 S 1 0.2 0:44.09 wicd30848 karuwak 20 0 3236 1364 1012 R 1 0.1 0:00.05 top2736 root 20 0 1840 608 548 S 0 0.0 0:02.30 syslogd2948 haldaemo 20 0 2336 880 812 S 0 0.0 0:07.87 hald-addon-acpi3152 root 20 0 9024 2928 2072 S 0 0.1 0:16.60 wicd-monitor3366 karuwak 20 0 219m 24m 14m S 0 1.2 0:18.86 nautilus26083 karuwak 20 0 122m 31m 14m S 0 1.6 0:14.89 chrome1 root 20 0 772 68 40 S 0 0.0 0:00.68 init2 root 15 -5 0 0 0 S 0 0.0 0:00.00 kthreadd3 root RT -5 0 0 0 S 0 0.0 0:00.12 migration/04 root 15 -5 0 0 0 S 0 0.0 0:00.52 ksoftirqd/05 root RT -5 0 0 0 S 0 0.0 0:00.24 migration/16 root 15 -5 0 0 0 S 0 0.0 0:01.67 ksoftirqd/17 root 15 -5 0 0 0 S 0 0.0 0:00.17 events/08 root 15 -5 0 0 0 S 0 0.0 0:00.20 events/19 root 15 -5 0 0 0 S 0 0.0 0:00.01 khelper14 root 15 -5 0 0 0 S 0 0.0 0:00.00 async/mgr107 root 15 -5 0 0 0 S 0 0.0 0:00.04 kblockd/0108 root 15 -5 0 0 0 S 0 0.0 0:00.04 kblockd/1112 root 15 -5 0 0 0 S 0 0.0 0:00.00 kacpi_hotplug207 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata/0208 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata/1209 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata_auxtop – 19:05:54 up 4:20, 2 users, load average: 0.06, 0.06, 0.05Tasks: 160 total, 3 running, 156 sleeping, 0 stopped, 1 zombieCpu(s): 7.4%us, 11.3%sy, 0.0%ni, 80.2%id, 0.0%wa, 1.1%hi, 0.0%si, 0.0%stMem: 2002824k total, 857756k used, 1145068k free, 14320k buffersSwap: 979924k total, 228700k used, 751224k free, 405948k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 111 root 15 -5 0 0 0 S 10 0.0 9:23.82 kacpi_notify 5705 karuwak 20 0 231m 30m 16m S 6 1.5 6:50.16 exe 110 root 15 -5 0 0 0 S 3 0.0 2:04.73 kacpid 3220 root 20 0 637m 81m 13m S 3 4.2 24:15.17 X 9289 karuwak 20 0 125m 13m 9652 S 1 0.7 0:02.78 gnome-terminal 5656 karuwak 20 0 119m 37m 11m S 1 1.9 0:38.46 chrome 2895 root 20 0 1784 524 480 R 1 0.0 0:07.98 acpid 2914 haldaemo 20 0 6728 2564 1928 S 1 0.1 0:11.41 hald 2998 root 20 0 19412 4084 1824 S 1 0.2 0:44.09 wicd 30848 karuwak 20 0 3236 1364 1012 R 1 0.1 0:00.05 top 2736 root 20 0 1840 608 548 S 0 0.0 0:02.30 syslogd 2948 haldaemo 20 0 2336 880 812 S 0 0.0 0:07.87 hald-addon-acpi 3152 root 20 0 9024 2928 2072 S 0 0.1 0:16.60 wicd-monitor 3366 karuwak 20 0 219m 24m 14m S 0 1.2 0:18.86 nautilus 26083 karuwak 20 0 122m 31m 14m S 0 1.6 0:14.89 chrome 1 root 20 0 772 68 40 S 0 0.0 0:00.68 init 2 root 15 -5 0 0 0 S 0 0.0 0:00.00 kthreadd 3 root RT -5 0 0 0 S 0 0.0 0:00.12 migration/0 4 root 15 -5 0 0 0 S 0 0.0 0:00.52 ksoftirqd/0 5 root RT -5 0 0 0 S 0 0.0 0:00.24 migration/1 6 root 15 -5 0 0 0 S 0 0.0 0:01.67 ksoftirqd/1 7 root 15 -5 0 0 0 S 0 0.0 0:00.17 events/0 8 root 15 -5 0 0 0 S 0 0.0 0:00.20 events/1 9 root 15 -5 0 0 0 S 0 0.0 0:00.01 khelper 14 root 15 -5 0 0 0 S 0 0.0 0:00.00 async/mgr 107 root 15 -5 0 0 0 S 0 0.0 0:00.04 kblockd/0 108 root 15 -5 0 0 0 S 0 0.0 0:00.04 kblockd/1 112 root 15 -5 0 0 0 S 0 0.0 0:00.00 kacpi_hotplug 207 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata/0 208 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata/1 209 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata_aux
Bukan hanya sekedar menampilkan proses saja, tapi kita dapat me kill dan informasi lainnya disystem kita. Untuk banuan command yang tersedia pada “top”, tekan aja tombol “h” (tanpa tanda petik). Berikut summery command yang tersedia :
t Displays summary information off and on. m Displays memory information off and on. A Sorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on a system. f Enters an interactive configuration screen for top. Helpful for setting up top for a specific task. o Enables you to interactively select the ordering within top. r Issues renice command. k Issues kill command. z Turn on or off color/mono
.
==
2. Vmstat
Command ini digunakan untuk melihat aktifitas system, hardware dan lainnya. Contoh penggunakan perintahnya adalah :
$vmstat
$vmstat 3
$vmstat -m
$vmstat -a
untuk lebih jelasnya bisa lihat manualnya dengan perintah :
$man vmstat
Berikut hasil dari perintah “vmstat 3″ :
karuwak@darkstar:~$ vmstat 3
procs ———–memory———- —swap– —–io—- -system– —-cpu—-
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 228520 1137752 15044 411064 1 7 177 196 4 680 9 11 75 5
2 0 228520 1141464 15044 407284 0 0 0 0 2185 1696 4 12 83 0
0 0 228520 1133776 15052 414748 0 0 0 11 2793 2246 7 15 78 0
0 0 228520 1139356 15052 409644 0 0 0 0 1854 1425 3 11 86 0
0 0 228520 1139232 15060 409740 0 0 0 5 1851 1461 3 11 86 0
0 2 228520 1121180 15224 422148 0 0 1576 24 2731 2783 12 12 62 14
0 0 228520 1122544 15276 419160 0 0 277 0 3500 2310 9 15 73 4
0 0 228520 1125504 15284 416260 0 0 44 13 3206 2416 10 13 76 1
0 0 228468 1129860 15292 412448 11 0 11 41 3169 2164 10 11 78 0
1 0 228468 1128248 15304 413804 0 0 0 51 3135 1934 8 13 79 0
0 0 228468 1128000 15304 414508 0 0 0 44 3024 1847 8 14 79 0
karuwak@darkstar:~$ w19:18:02 up 4:32, 2 users, load average: 0.19, 0.09, 0.06USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATkaruwak tty1 – 14:46 4:31m 20:38 0.00s /bin/sh /usr/bin/startxkaruwak pts/0 :0.0 17:37 0.00s 0.07s 0.00s w
karuwak@darkstar:~$ w19:19:13 up 4:33, 4 users, load average: 0.15, 0.10, 0.07USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATkaruwak tty1 – 14:46 4:32m 20:46 0.00s /bin/sh /usr/bin/startxkaruwak pts/0 :0.0 17:37 0.00s 0.07s 0.00s wkaruwak pts/1 :0.0 19:18 15.00s 0.00s 0.00s ssh -v karuwak-ssh@localhostkaruwak- pts/2 localhost 19:19 5.00s 0.01s 0.01s -bash
karuwak@darkstar:~$ w karuwak-ssh19:20:58 up 4:35, 4 users, load average: 0.14, 0.10, 0.07USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATkaruwak- pts/2 localhost 19:19 1:50 0.01s 0.01s -bash
karuwak@darkstar:~$ uptime19:23:20 up 4:37, 3 users, load average: 0.17, 0.18, 0.10
karuwak@darkstar:~$ ps -APID TTY TIME CMD1 ? 00:00:00 init2 ? 00:00:00 kthreadd3 ? 00:00:00 migration/04 ? 00:00:00 ksoftirqd/05 ? 00:00:00 migration/16 ? 00:00:01 ksoftirqd/17 ? 00:00:00 events/08 ? 00:00:00 events/19 ? 00:00:00 khelper14 ? 00:00:00 async/mgr107 ? 00:00:00 kblockd/0108 ? 00:00:00 kblockd/1110 ? 00:02:29 kacpid111 ? 00:11:15 kacpi_notify112 ? 00:00:00 kacpi_hotplug207 ? 00:00:00 ata/0208 ? 00:00:00 ata/1209 ? 00:00:00 ata_aux210 ? 00:00:00 ksuspend_usbd215 ? 00:00:00 khubd———————————–———————————–
karuwak@darkstar:~$ ps -AlF S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD4 S 0 1 0 0 80 0 – 193 ? ? 00:00:00 init1 S 0 2 0 0 75 -5 – 0 ? ? 00:00:00 kthreadd1 S 0 3 2 0 -40 – - 0 ? ? 00:00:00 migration/01 S 0 4 2 0 75 -5 – 0 ? ? 00:00:00 ksoftirqd/01 S 0 5 2 0 -40 – - 0 ? ? 00:00:00 migration/11 S 0 6 2 0 75 -5 – 0 ? ? 00:00:01 ksoftirqd/11 S 0 7 2 0 75 -5 – 0 ? ? 00:00:00 events/01 R 0 8 2 0 75 -5 – 0 ? ? 00:00:00 events/11 S 0 9 2 0 75 -5 – 0 ? ? 00:00:00 khelper1 S 0 14 2 0 75 -5 – 0 ? ? 00:00:00 async/mgr1 S 0 107 2 0 75 -5 – 0 ? ? 00:00:00 kblockd/01 S 0 108 2 0 75 -5 – 0 ? ? 00:00:00 kblockd/11 S 0 110 2 0 75 -5 – 0 ? ? 00:02:29 kacpid1 S 0 111 2 3 75 -5 – 0 ? ? 00:11:16 kacpi_notify1 S 0 112 2 0 75 -5 – 0 ? ? 00:00:00 kacpi_hotplug1 S 0 207 2 0 75 -5 – 0 ? ? 00:00:00 ata/01 S 0 208 2 0 75 -5 – 0 ? ? 00:00:00 ata/1——————————————————————————————————————
$ps ax$ps aux
$ps -U karuwak-ssh
karuwak@darkstar:~$ freetotal used free shared buffers cachedMem: 2002824 898584 1104240 0 20880 421836-/+ buffers/cache: 455868 1546956Swap: 979924 227868 752056
karuwak@darkstar:~$ iostatLinux 2.6.31.5 (darkstar) 02/04/2010avg-cpu: %user %nice %system %iowait %steal %idle6.36 2.78 10.31 4.77 0.00 75.78Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnsda 16.66 394.69 758.38 6852636 13167091sda1 7.08 149.52 59.34 2595914 1030344sda2 9.18 240.00 607.45 4166818 10546584sda3 0.00 0.00 0.00 4 0sda4 0.01 0.31 0.00 5442 0sda5 0.23 4.15 27.87 72123 483846sda6 0.02 0.21 0.01 3727 129sda7 0.13 0.45 63.71 7848 1106188sr0 0.64 156.63 0.00 2719452 0sdc 0.12 0.30 0.00 5129 1sdc1 0.12 0.26 0.00 4497 1
karuwak@darkstar:~$ mpstat -P ALLLinux 2.6.31.5 (darkstar) 02/05/201003:38:07 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s03:38:07 PM all 15.68 0.31 5.75 1.74 0.22 0.03 0.00 76.28 2309.7203:38:07 PM 0 16.06 0.34 6.39 1.76 0.20 0.04 0.00 75.21 583.2103:38:07 PM 1 15.87 0.28 5.33 1.78 0.23 0.03 0.00 80.14 583.03
$pmap -d PID
$pmap -d 3683
3683: compiz –replace –sm-disable –ignore-desktop-hints ccp –loose-binding –indirect-renderingAddress Kbytes Mode Offset Device Mapping08048000 208 r-x– 0000000000000000 008:00001 compiz0807c000 4 rw— 0000000000033000 008:00001 compiz0807d000 12984 rw— 0000000000000000 000:00000 [ anon ]b68f0000 220 r—- 0000000000000000 008:00001 LC_CTYPEb6927000 444 r-x– 0000000000000000 008:00001 libGLU.so.1.3.070500b6996000 4 rw— 000000000006f000 008:00001 libGLU.so.1.3.070500b69c2000 24 r-x– 0000000000000000 008:00001 libscalefilter.sob69c8000 4 rw— 0000000000006000 008:00001 libscalefilter.sob69c9000 72 r-x– 0000000000000000 008:00001 libanimation.sob69db000 8 rw— 0000000000011000 008:00001 libanimation.so————————————————————————————————————————————————b782c000 120 r-x– 0000000000000000 008:00001 ld-2.9.sob784a000 4 r—- 000000000001e000 008:00001 ld-2.9.sob784b000 4 rw— 000000000001f000 008:00001 ld-2.9.sobface000 84 rw— 0000000000000000 000:00000 [ stack ]ffffe000 4 r-x– 0000000000000000 000:00000 [ anon ]mapped: 28812K writeable/private: 14304K shared: 0K
karuwak@darkstar:~$ netstat | moreActive Internet connections (w/o servers)Proto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 192.168.1.2:45397 ni-in-f17.1e100.ne:http ESTABLISHEDtcp 0 0 192.168.1.2:48108 cs116.msg.sp1.yaho:mmcc ESTABLISHEDtcp 0 0 192.168.1.2:56615 ni-in-f19.1e100.ne:http ESTABLISHEDtcp 0 0 192.168.1.2:38887 channel73-09-01-sn:http ESTABLISHEDtcp 0 0 192.168.1.2:37428 www-10-01.snc4.fac:http ESTABLISHEDtcp 0 0 192.168.1.2:58755 channel73-09-01-sn:http TIME_WAITActive UNIX domain sockets (w/o servers)Proto RefCnt Flags Type State I-Node Pathunix 13 [ ] DGRAM 9496 /dev/logunix 2 [ ] DGRAM 14294 @/var/run/devkit/udev_socketunix 2 [ ] DGRAM 598 @//org/kernel/udev/udevdunix 2 [ ] DGRAM 10006 @/org/freedesktop/hal/udev_eventunix 3 [ ] STREAM CONNECTED 649906————————————————————————————————————————————————
root@darkstar:/home/karuwak# ss -sTotal: 622 (kernel 635)TCP: 29 (estab 13, closed 1, orphaned 0, synrecv 0, timewait 1/0), ports 0Transport Total IP IPv6* 635 – -RAW 0 0 0UDP 7 7 0TCP 28 24 4INET 35 31 4FRAG 0 0 0
#iptraf ==> outputnya
#tcpdump -i wlan0 ‘udp port 53′
root@darkstar:/home/karuwak# tcpdump -i eth1 ‘udp port 53′tcpdump: eth1: No such device exists(SIOCGIFHWADDR: No such device)root@darkstar:/home/karuwak# tcpdump -i wlan0 ‘udp port 53′tcpdump: verbose output suppressed, use -v or -vv for full protocol decodelistening on wlan0, link-type EN10MB (Ethernet), capture size 96 bytes16:13:17.760338 IP 192.168.1.2.55360 > 192.168.1.1.domain: 58583+ AAAA? photos-b.ak.fbcdn.net. (39)16:13:17.760394 IP 192.168.1.2.32775 > 192.168.1.1.domain: 47174+ AAAA? photos-d.ak.fbcdn.net. (39)16:13:17.760512 IP 192.168.1.2.35025 > 192.168.1.1.domain: 38178+ AAAA? photos-g.ak.fbcdn.net. (39)16:13:17.760626 IP 192.168.1.2.55895 > 192.168.1.1.domain: 43977+ AAAA? techno-os.net. (31)16:13:17.760765 IP 192.168.1.2.55271 > 192.168.1.1.domain: 44323+ PTR? 1.1.168.192.in-addr.arpa. (42)16:13:17.805058 IP 192.168.1.1.domain > 192.168.1.2.55360: 58583 2/1/0[|domain]16:13:17.805154 IP 192.168.1.2.36899 > 192.168.1.1.domain: 60475+ A? photos-b.ak.fbcdn.net. (39)
#tcpdump -ni wlan0 ‘dst 10.0.0.1 and tcp and port http’
karuwak@darkstar:~$ pgrep compiz3683
karuwak@darkstar:~$ strace -p 3683
karuwak@darkstar:~$ strace -p 3683 -o /home/karuwak/hasil-trace.txt
karuwak@darkstar:~$cat /proc/cpuinfo
karuwak@darkstar:~$cat /proc/meminfo
karuwak@darkstar:~$cat /proc/zoneinfo
karuwak@darkstar:~$cat /proc/mounts




February 5th, 2010 at 21:42
Thanks Bro,
ntar aq coba yaw…
February 7th, 2010 at 22:38
siap mas rommy…
lanjutkan….. jangan lupa share ya yang lain… nich hanya sangat sedikit dan masih perlu banyak tambahan. dari pakar2…