LINUX進程獲取

1.整個性能和實體監控採用一個source設計

(1)主機實體採集定義開關,http發送,入mysql 每次做update
host_entity_collect=on
host_entity_collect_interval=24h

(2)主機性能採集,入es ,配置日誌規則解析
host_performan_collect=on
host_performan_collect_interval=1m

(3)進程實體採集,http發送,入mysql 每次做update
process_entity_collect=on
process_entity_collect_interval=24h
process_entity_collect_keys=*** ps關鍵字可配置多個進程

設計進程關鍵字配置規則和解析規則
設定進程關鍵字通過命令獲取進程實體信息
ps -aux |grep smartlog-api-6.0.0-SNAPSHOT.jar |grep Xbootclasspath 單個進程
ps -aux |grep nginx|grep -E “worker|master” 多個進程

實體字段設計:
(1)實體主表( 主機IP 進程名稱 聯合唯一索引,agent啓動做檢查)
主機IP 進程名稱 關鍵字配置 創建時間 ,更新時間 , 描述 獲取失敗和獲取成功
(2)實體附表
主機IP
進程名稱
進程PID
進程啓動參數
監聽端口號,通過命令獲取
netstat -nap | grep 3110|grep LISTEN | awk ‘{print $4}’ ,寫正則取端口號

進程啓動時間
啓動用戶
更新時間,入庫字段
創建時間,入庫字段

(4)進程性能採集,入es ,配置日誌規則解析
根據進程關鍵字獲取到PID,調用OSHI獲取性能數據
process_performan_collect=on
process_performan_collect_interval=1m
process_performan_collect_keys=*** ps關鍵字可配置多個進程,和進程實體一致
1)es字段設計
進程名稱、進程參數、進程CPU、進程MEMORY、進程CPU百分比,進程MEMORY百分比
2)通過配置的命令獲取進程ID,通過OSHI獲取進程的CPU MEMORY
List procs = Arrays.asList( os.getProcess(25436));

(5)拓撲關係實體和更新

(6)遺留問題,更新和刪除怎麼辦

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章