小米的監控系統:open-falcon實現對Windows單機進行監控

上次我們已經安裝完成了open-falcon但是沒有添加任何監控,今天寫一篇關於對於Windows單機進行監控的文章。

  • 安裝open-falcon監控的鏈接:
<code>https://www.toutiao.com/i6778724345788236301//<code>
  • 對Windows主機進行監控有四種方法(小編使用的第一種也是本人認為最簡單的一種)

官方文檔有列出:https://book.open-falcon.org/zh_0_2/usage/win.html

<code>①:windows_collect:python腳本https://github.com/freedomkk-qfeng/falcon-scripts/tree/master/windows_collect/<code>
<code>②:windows-agent: go 語言實現的 agent https://github.com/LeonZYang/agent/<code>
<code>③:Windows-Agent:汽車之家開源的作為Windows Service運行的Agent,python實現。https://github.com/AutohomeRadar/Windows-Agent/<code>
<code>④:windows-agent:另一個 go 語言實現的 windows-agent。支持端口,進程監控,支持後臺服務運行。https://github.com/freedomkk-qfeng/windows-agent/<code>
  • 首先配置依賴

安裝python以及其模塊

<code>python >= 2.6

pip install psutil

pip instal requests/<code>
  • 下載腳本代碼
<code>https://github.com/freedomkk-qfeng/falcon-scripts/tree/master/windows_collect/<code> 
  • 修改代碼
<code>#此腳本的主要監控項在github裡面都有說明,這裡就說一下需要修改的地方。
cpu_interval = 60
push_interval = 300 #這是推送間隔,默認的是300秒
zh_decode = "gbk"
endpoint = "you hostname" #主機名稱
ignore_interface = ["Loopback","Teredo Tunneling","isatap","6TO4 Adapter"]
push_url = "server IP" #這是給該機器的配的名稱,自己指定/<code>

還有一項需要特別注意的地方運行之後可能會報110行代碼出錯,若出現則修改110行代碼為:

<code>data["tags"] = "interface=" + key.decode(zh_decode)中的decode不支持,修改為data["tags"] = "interface=" + key/<code>
  • 接著運行即可
<code>python windows_collect.py/<code>


小米的監控系統:open-falcon實現對Windows單機進行監控


小米的監控系統:open-falcon實現對Windows單機進行監控


分享到:


相關文章: