open-falcon ---客戶機agent操做

open-falcon的agent用於採集機器負載監控指標,好比cpu.idle、load.1min、disk.io.util等等,每隔60秒push給Transfer。agent與Transfer創建了長鏈接,數據發送速度比較快,agent提供了一個http接口/v1/push用於接收用戶手工push的一些數據,而後經過長鏈接迅速轉發給Transfer。agent項目以前是一個獨立項目名字叫falcon-eye ,其自帶有web頁面來自於linux-dash項目。node

客戶機上只須要配置啓動agent便可:
[root@IDC-Admin-02 ~]# cat /data/work/open-falcon/agent/cfg.json
{
    "debug": true,
    "hostname": "",
    "ip": "",
    "plugin": {
        "enabled": false,                                    #默認不開啓插件機制
        "dir": "./plugin",
        "git": "https://github.com/open-falcon/plugin.git",
        "logs": "./logs"
    },
    "heartbeat": {
        "enabled": true,                                    #此處enabled要設置爲true
        "addr": "127.0.0.1:6030",                           #hbs的地址,端口是hbs的rpc端口
        "interval": 60,
        "timeout": 1000
    },
    "transfer": {
        "enabled": true,                                   #此處enabled要設置爲true
        "addrs": [
            "192.168.1.30:8433",                           #transfer的地址,這裏寫服務端的IP地址,由於transfer部署在服務端,端口是transfer的rpc端口
            "192.168.1.30:8433"
        ],
        "interval": 60,
        "timeout": 1000
    },
    "http": {
        "enabled": true,
        "listen": ":1988",
        "backdoor": false
    },
    "collector": {
        "ifacePrefix": ["bond", "em"]           #默認配置只會採集網卡名稱前綴是bond、em的網卡流量,配置爲空就會採集全部的,lo的也會採集。
    },
    "ignore": {                                 #默認採集了200多個metric,能夠經過ignore設置爲不採集
        "cpu.busy": true,
        "df.bytes.free": true,
        "df.bytes.total": true,
        "df.bytes.used": true,
        "df.bytes.used.percent": true,
        "df.inodes.total": true,
        "df.inodes.free": true,
        "df.inodes.used": true,
        "df.inodes.used.percent": true,
        "mem.memtotal": true,
        "mem.memused": true,
        "mem.memused.percent": true,
        "mem.memfree": true,
        "mem.swaptotal": true,
        "mem.swapused": true,
        "mem.swapfree": true
    }
}


[root@IDC-Admin-02 ~]# cd /data/work/open-falcon/agent/
[root@IDC-Admin-02 agent]# ./control start
falcon-agent started..., pid=183538
[root@IDC-Admin-02 agent]# ps -ef|grep 183538
root     183538      1  0 00:08 pts/0    00:00:00 ./falcon-agent -c cfg.json
root     183555 183270  0 00:08 pts/0    00:00:00 grep 183538
[root@IDC-Admin-02 agent]# lsof -i:1988
COMMAND      PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
falcon-ag 183538 root    4u  IPv6 9968490      0t0  TCP *:tr-rsrb-p2 (LISTEN)

驗證 
看var目錄下的log是否正常,或者瀏覽器訪問其1988端口。另外agent提供了一個--check參數,能夠檢查agent是否能夠正常跑在當前機器上。
[root@IDC-Admin-02 agent]# ./falcon-agent --check
cpustat  ... ok
disk.io  ... ok
memory   ... ok
ss -s    ... ok
netstat  ... ok
ss -tln  ... ok
ps aux   ... ok
du -bs   ... ok
kernel   ... ok
df.bytes ... ok
net.if   ... ok
loadavg  ... ok

打開url  http://IP:1988能夠查看相關監控信息   (假設這裏客戶機ip爲192.168.1.22)

因爲這臺客戶機的hostname爲IDC-Admin-02。因此能夠在服務端的dashboard界面裏搜索Endpoint。(這裏是根據客戶機的hostname來匹配搜索的,能夠將客戶機的主機名按照必定的規則命名或者作hosts映射,好比web01.wang.com、web02.wang.com、backup.wang.com等*.wang.com,那麼這裏Endpoint搜索的話,就根據wang.com進行搜索,就會匹配出對應的客戶機)linux

相關文章
相關標籤/搜索