ติดตามการใช้ ทรัพยากรบน network ด้วย vnStat


Posted in:

มีหลายโปรแกรมที่เราใช้เพื่อติดตามการใช้ ทรัพยากรในเครือข่ายของเรา

mrtg
darkstat

ส่วนมากแล้วผมเชื่อว่าทุกท่าคงใช้ mrtg กัน แต่วันนี้ผมขอเสนอ

vnStat


การติดตั้งง่ายดายมากครับ

sudo apt-get install vnstat
sudo chmod o+x /usr/bin/vnstat
sudo chmod o+wx /var/lib/vnstat/

ครั้งแรกที่ใช้งานต้องให้สั่งให้มันสร้าง cron job (scheduled task) โดยใช้คำสั่ง

 

vnstat -u -i eth0

 

เปลี่ยน eth0 เป็น interface ที่ท่านใช้ เช่น ath0 สำหรับ wireless

แล้ว เรียกโปแกรมขึ้นมาดูครับ

										      vnstat

ก็จะขึ้นหน้าจอประมาณแบบนี้มาครับ (เพี้ยนไปเยอะเลย)

	Database updated: Thu Aug 30 13:40:01 2007
	eth0
	received:          90.65 MB (11.9%)
	transmitted:         666.12 MB (88.1%)
	total:         756.77 MB
	rx     |     tx     |  total
	-----------------------+------------+-----------
	yesterday     49.94 MB |  378.44 MB |  428.38 MB
	today     17.27 MB |  125.30 MB |  142.57 MB
	-----------------------+------------+-----------
	estimated        29 MB |     218 MB |     247 MB
	

 

										      vnstat -h

 

							 eth0                                                                     13:40
	^   t
	|   t
	|   t
	|   t
	|   t           t                                                     t
	|   t  t  t     t        t                                t  t     t  t
	|   t  t  t  t  t  t  t  t  t  t                 t  t     t  t     t  t
	|   t  t  t  t  t  t  t  t  t  t  t        t  t  t  t  t  t  t  t  t  t  t
	|   t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t
	|  rt  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t
	-+--------------------------------------------------------------------------->
	|  14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13    
	h   rx (kB)    tx (kB)      h   rx (kB)    tx (kB)      h   rx (kB)    tx (kB)
	14       2543      21517    22       1286       9950    06       1304       9431
	15       1628      11561    23       1406       9223    07       1147       8576
	16       1770      12431    00        999       7849    08       1775      12656
	17       1388       9518    01        673       5071    09       1485      11738
	18       1870      13693    02        932       6089    10       1063       7514
	19       1392       9417    03        882       7620    11       1530      11656
	20       1522      10194    04       1024       7629    12       2118      14688
	21       1838      11744    05       1429       9662    13       1330       8130
	

แล้วมันดีกว่าโปรแกรมตัวอื่นยังไง ?
ผมขอยกคำพูดของเจ้าของโปรแกรมมาละกันครับ

		Some time ago (in 2002) I felt that I needed some kind of network traffic monitor to see how much traffic
	my server/router actually generated. I had been using mrtg for a while but the problem with it was that it didn't 
	tell how many megabytes the daily traffic was.
	Next I tested ntop, but it had far too many features compared to my needs. Then I found darkstat that was 
	much smaller and stabler, but after using it for about a week, I came to a conclusion that a packet sniffer wasn't 
	what I needed since it generates too much cpu load when the network traffic is near 10MB/s and requires the 
	process running with root permissions. Since I needed something really simple but stable, I decided to write it by myself. 
	

หุหุ

เท่าที่อ่านดู แสดงว่า อันนี้ เสถียรกว่าเนอะ หุ หุ ปกติก็ยังไม่ค่อยได้ใช้ mrtg จริง ๆ จัง ๆ เลย หุ หุ เดี๋ยวคงได้ลองตัวนี้บ้างล่ะ หุ หุ

หุ หุ

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <i> <center> <span> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <br> <dt> <dd> <object> <embed> <hr> <img> <blockquote> <b> <u> <del> <div> <p> <table> <tr> <td> <font>

More information about formatting options