Telegraf?是一個(gè)Influxdata的數(shù)據(jù)采集套件,使用起來跟Collectd、Statsd、Logstash等軟件很像。通過plugin來實(shí)現(xiàn)數(shù)據(jù)的input和output。 今天我們嘗試自己編寫一個(gè)采集supervisord的插件
1. 準(zhǔn)備golang (最好1.9+)環(huán)境,
2. 準(zhǔn)備一些dep 編譯環(huán)境 https://golang.github.io/dep/docs/installation.html
3. 準(zhǔn)備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