前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >open-falcon ---客户机agent操作

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

作者头像
洗尽了浮华
发布2018-01-23 15:21:29
1.4K0
发布2018-01-23 15:21:29
举报
文章被收录于专栏:散尽浮华散尽浮华

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

代码语言:javascript
复制
客户机上只需要配置启动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进行搜索,就会匹配出对应的客户机)

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017-08-15 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档