歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 為Linux用scripts采集數據並畫圖

為Linux用scripts采集數據並畫圖

日期:2017/2/28 16:33:35   编辑:Linux教程

由於目前ucd/net采集內存數據為integer32位的,所以最大4GB內存,而用戶為16GB,而HOST MIB不能采集cached memory,所以Linux下采用script模式來采集數據畫圖

(1)編寫相應的腳本

more memory_freed.sh

#!/bin/sh

free -m|grep "Mem"|awk '{print "real:"$4+$6+$7,"free:"$4,"buffers:"$6,"cached:"$7,"total:"$2}'

輸出格式:

[root@mdj scripts]# ./memory_freed.sh

real:791 free:308 buffers:56 cached:427 total:1010

(2)配置Data Input Methods

說明:然後在創建Data Input Methods時,其中Name值:輸入 一個有代表性的名稱,Input Type選擇 “script/command",然後在Input String中填入上步所創建的腳本存放路徑,下面一項一項添加要收集的數據,注意output field 第一個要添加數據的名要與上面的文字域一樣。

(3)配置data source 和大 data模版

添加一個個data source item,輸入對的internal data source name,選擇好下面的output field相應的菜單,這裡加了5個數據源。再轉換成相應的data template.

(4)配置圖形模版

注意要依次一項一項的添加graph item

(5)圖形模板應用

Copyright © Linux教程網 All Rights Reserved