编写telegraf Input插件
lmy_8db4 · · 4848 次点击 · · 开始浏览Telegraf是一个Influxdata的数据采集套件,使用起来跟Collectd、Statsd、Logstash等软件很像。通过plugin来实现数据的input和output。 今天我们尝试自己编写一个采集supervisord的插件
1. 准备golang (最好1.9+)环境,
2. 准备一些dep 编译环境 https://golang.github.io/dep/docs/installation.html
3. 准备http_proxy (你懂的)
4. go get github.com/influxdata/telegraf
5. cd $GOPATH/github.com/influxdata/telegraf
6. git checkout -b supervisor
7. cd plugins/inputs
8. mkdir supervisor
9. cd supervisor
10. 参考https://github.com/influxdata/telegraf/blob/master/CONTRIBUTING.md#input-plugin-example
11. vim telegraf/plugins/inputs/all/all.go 追加 _ "github.com/influxdata/telegraf/plugins/inputs/supervisor"
12. cd $GOPATH/github.com/influxdata/telegraf
13. http_proxy="http://<proxy>" make
14. ./telegraf --help
15. ./telegraf --input-filter supervisor config > telegraf.conf
16. ./telegraf --config telegraf.conf --test
supervisor.go 代码 blog/telegraf.md at master · lmyyao/blog · GitHub
有疑问加站长微信联系(非本文作者)
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
关注微信- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传
收入到我管理的专栏 新建专栏
Telegraf是一个Influxdata的数据采集套件,使用起来跟Collectd、Statsd、Logstash等软件很像。通过plugin来实现数据的input和output。 今天我们尝试自己编写一个采集supervisord的插件
1. 准备golang (最好1.9+)环境,
2. 准备一些dep 编译环境 https://golang.github.io/dep/docs/installation.html
3. 准备http_proxy (你懂的)
4. go get github.com/influxdata/telegraf
5. cd $GOPATH/github.com/influxdata/telegraf
6. git checkout -b supervisor
7. cd plugins/inputs
8. mkdir supervisor
9. cd supervisor
10. 参考https://github.com/influxdata/telegraf/blob/master/CONTRIBUTING.md#input-plugin-example
11. vim telegraf/plugins/inputs/all/all.go 追加 _ "github.com/influxdata/telegraf/plugins/inputs/supervisor"
12. cd $GOPATH/github.com/influxdata/telegraf
13. http_proxy="http://<proxy>" make
14. ./telegraf --help
15. ./telegraf --input-filter supervisor config > telegraf.conf
16. ./telegraf --config telegraf.conf --test
supervisor.go 代码 blog/telegraf.md at master · lmyyao/blog · GitHub