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项目。参考:https://book.open-falcon.org/zh/quick_install/graph_components.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
客户机上只需要配置启动agent即可:
[[email protected] ~]# 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
    }
}
 
 
[[email protected] ~]# cd /data/work/open-falcon/agent/
[[email protected] agent]# ./control start
falcon-agent started..., pid=183538
[[email protected] 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
[[email protected] 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是否可以正常跑在当前机器上。
[[email protected] 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)

open-falcon ---客户机agent操作

由于这台客户机的hostname为IDC-Admin-02。所以可以在服务端的dashboard界面里搜索Endpoint。(这里是根据客户机的hostname来匹配搜索的,可以将客户机的主机名按照一定的规则命名或者做hosts映射,比如web01.wang.com、web02.wang.com、backup.wang.com等*.wang.com,那么这里Endpoint搜索的话,就根据wang.com进行搜索,就会匹配出对应的客户机)

open-falcon ---客户机agent操作

open-falcon ---客户机agent操作

open-falcon ---客户机agent操作

***************当你发现自己的才华撑不起野心时,就请安静下来学习吧***************

本文转自散尽浮华博客园博客,原文链接:http://www.cnblogs.com/kevingrace/p/7361963.html,如需转载请自行联系原作者