如何利用spotlight for unix對linux進行系統性能監控

 
 
首先要啓動SSH
system-config-service將SSHD啓動並設置爲系統自動啓動
一定要安裝system-system tools下的sysstat包,以安裝sar和iostat包(此包非默認安裝)
然後連接spotlight即可
要注意的是spotlight顯示出來的內存是不對的
原因如下:
spotlight利用vmstat命令的mem中的free作爲空餘內存
-bash-3.00$ vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 0  0    160 746116  50016  64124    0    0     2     2    3     2  2  1 96
linux的的內存分配類似於vista,會有一部分空閒內存作爲buffer和cache
A buffer is something that has yet to be "written" to disk. A cache is something that has been "read" from the disk and stored for later use.
所以這裏的free的內存並不是我們傳統意義上的"free memory"
要想看真正的"free memory"
在linux下需要用如下命令
-bash-3.00$ free -m
             total       used       free     shared    buffers     cached
Mem:          1010        287        722          0         49         67
-/+ buffers/cache:        170        839
Swap:         2047          0       2047
 
FREE命令參考
free
free 命令相對於top 提供了更簡潔的查看系統內存使用情況:
$ free
total used free shared buffers cachedMem: 255268 238332 16936 0 85540 126384-/+ buffers/cache: 26408 228860Swap: 265000 0 265000
Mem:表示物理內存統計
-/+ buffers/cached:表示物理內存的緩存統計
Swap:表示硬盤上交換分區的使用情況,這裏我們不去關心。
系統的總物理內存:255268Kb(256M),但系統當前真正可用的內存b並不是第一行free 標記的 16936Kb,它僅代表未被分配的內存。
我們使用total1、used1、free1、used2、free2 等名稱來代表上面統計數據的各值,1、2 分別代表第一行和第二行的數據。
total1:表示物理內存總量。
used1:表示總計分配給緩存(包含buffers 與cache )使用的數量,但其中可能部分緩存並未實際使用。
free1:未被分配的內存。
shared1:共享內存,一般系統不會用到,這裏也不討論。
buffers1:系統分配但未被使用的buffers 數量。
cached1:系統分配但未被使用的cache 數量。buffer 與cache 的區別見後面。
used2:實際使用的buffers 與cache 總量,也是實際使用的內存總量。
free2:未被使用的buffers 與cache 和未被分配的內存之和,這就是系統當前實際可用內存。
可以整理出如下等式:
total1 = used1 + free1total1 = used2 + free2used1 = buffers1 + cached1 + used2free2 = buffers1 + cached1 + free1
buffer 與cache 的區別
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章