here are small tips how to monitor system resources.
many thanks!
[ monitor network info with netstat ]
IP,TCP,UDP
root@ubuntu:~# netstat -s
Ip:
150665 total packets received
0 forwarded
0 incoming packets discarded
149429 incoming packets delivered
117790 requests sent out
<snip>
|
TCP
root@ubuntu:~# netstat -st
IcmpMsg:
InType3: 28
OutType3: 582
Tcp:
3376 active connections openings
1 passive connection openings
3 failed connection attempts
421 connection resets received
52 connections established
138317 segments received
106504 segments send out
<snip>
|
UDP
root@ubuntu:~# netstat -su
IcmpMsg:
InType3: 28
OutType3: 584
Udp:
9955 packets received
584 packets to unknown port received.
0 packet receive errors
10143 packets sent
UdpLite:
IpExt:
InMcastPkts: 154
OutMcastPkts: 168
InOctets: 153334177
<snip>
|
[ monitor network info with dstat ]
install dstat
root@ubuntu:~# apt-get install dstat
|
root@ubuntu:~# dstat --tcp
----tcp-sockets----
lis act syn tim clo
9 7 0 1 0
9 7 0 1 0
9 7 0 1 0^C
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# dstat --udp
--udp--
lis act
14 0
14 0
14 0
14 0^C
root@ubuntu:~#
root@ubuntu:~# dstat --net
-net/total-
recv send
0 0
0 0
60B 42B^C
|
[ monitor CPU, I/O resource with dstat ]
CPU , Disk , Network etc
root@ubuntu:~# dstat -a -T
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- --epoch---
usr sys idl wai hiq siq| read writ| recv send| in out | int csw | epoch
5 1 93 0 0 0| 90k 87k| 0 0 | 0 0 |1271 2624 |1373561131
1 1 99 0 0 0| 0 0 | 0 0 | 0 0 | 252 500 |1373561132
1 0 99 0 0 0| 0 0 | 60B 54B| 0 0 | 229 440 |1373561133^C
|
root@ubuntu:~# dstat --top-cpu 1 3
-most-expensive-
cpu process
chromium-brow1.4
X 0.2
gnome-termina0.2
kworker/3:4 0.2
|
[ monitor I/O with dstat ]
block I/O , I/O
root@ubuntu:~# dstat --top-bio
----most-expensive----
block i/o process
init
65k 1131B
jbd2/dm-1-8 0 4096B
chromium-br 0 16k^C
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# dstat --top-io
----most-expensive----
i/o process
chromium-br 50k 78k
X 3600B 1720B
X 4856B 956B^C
|
[ sar ]
install sysstat
root@ubuntu:~# apt-get install sysstat atsar
|
error
root@ubuntu:~# sar
open /var/log/atsar/atsa12: No such file or directory
|
change “ENABLED” option to true from false
root@ubuntu:~# egrep -i ^enable /etc/default/sysstat
ENABLED="true"
|
restart sysstat
root@ubuntu:~# service sysstat restart
|
root@ubuntu:~# sar -u 1 3
Linux ubuntu 3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:43:33 UTC 2013 x86_64 07/12/2013
01:52:45 cpu %usr %nice %sys %irq %softirq %wait %idle _cpu_
01:52:45 all 1 0 2 0 0 0 98
0 0 0 0 0 0 0 100
1 0 0 3 0 0 0 97
2 0 0 3 0 0 0 97
3 0 0 0 0 0 0 100
01:52:46 all 0 0 0 0 0 0 100
0 1 0 0 0 0 0 99
1 0 0 0 0 0 0 100
2 1 0 0 0 0 0 99
3 1 0 0 0 0 0 99
01:52:47 all 0 0 0 0 0 0 100
0 0 0 1 0 0 0 99
1 1 0 0 0 0 0 99
2 0 0 0 0 0 0 100
3 0 0 0 0 0 0 100
|
[ pidstat ]
monitor specific processes
root@ubuntu:~# unbound-control status | grep -i pid
unbound (pid 1393) is running...
root@ubuntu:~# pidstat -u -p 1393 1 3
Linux 3.8.0-26-generic (ubuntu) 07/12/2013 _x86_64_ (4 CPU)
01:54:42 AM PID %usr %system %guest %CPU CPU Command
01:54:43 AM 1393 0.00 0.00 0.00 0.00 2 unbound
01:54:44 AM 1393 0.00 0.00 0.00 0.00 2 unbound
01:54:45 AM 1393 0.00 0.00 0.00 0.00 2 unbound
Average: 1393 0.00 0.00 0.00 0.00 - unbound
root@ubuntu:~#
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.