本文介紹的kafka_exporter是prometheus監控系統中針對kafka的一款監控插件,要使用這個監控插件,kafka的版本需要滿足 0.10.1.0 及以上。
項目的github地址:https://github.com/danielqsj/kafka_exporter
一、安裝kafka_exporter
1、安裝go
[root@localhost ~]# go
bash: go: command not found
[root@localhost ~]# yum -y install go
...
2、安裝git工具
[root@localhost ~]# git
bash: git: command not found
[root@localhost ~]# yum -y install git
4、從github上下載kafka_exporter的源碼
[root@localhost ~]# go get -d -v github.com/danielqsj/kafka_exporter
github.com/danielqsj/kafka_exporter (download)
created GOPATH=/root/go; see 'go help gopath'
5、暫時未知原因,需要這一步操作
touch /root/go/bin/promu
ln -s /root/go/bin/promu /bin/promu
rm -f /root/go/bin/promu
6、安裝kafka_exporter
cd /root/go/src/github.com/danielqsj/kafka_exporter
make
二、附錄:go get使用時的附加參數
使用 go get 時可以配合附加參數顯示更多的信息及實現特殊的下載和安裝操作,詳見下表所示。
| 附加參數 | 備 注 |
|---|---|
| -v | 顯示操作流程的日志及信息,方便檢查錯誤 |
| -u | 下載丟失的包,但不會更新已經存在的包 |
| -d | 只下載,不安裝 |
| -insecure | 允許使用不安全的 HTTP 方式進行下載操作 |
