1.准备工作 安装go、glibe(需要连google服务器,咋连的,我就不写了,因为尝试了各种办法,都失败了,很伤心)
2.下载hadoop_exporter
cd /usr/local/prom/exporter
git clone https://github.com/Datatamer/hadoop_exporter
cd hadoop_exporter
glide install
go get github.com/prometheus/client_golang/prometheus
go get github.com/prometheus/log
go build */*.go
百度云地址
3.创建exporter创建systemd服务
vim /lib/systemd/system/datanode_exporter.service
[Unit]
Description=datanode_exporter
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/zookeeper/prometheus/datanode_exporter -datanode.jmx.url http://ip地址:50075/jmx
Restart=on-failure
[Install]
WantedBy=multi-user.target
4.启动hadoop_exporter
systemctl start namenode_exporter
systemctl start journalnode_exporter
systemctl start datanode_exporter
systemctl start resourcemanager_exporter
systemctl status namenode_exporter
systemctl status journalnode_exporter
systemctl status datanode_exporter
systemctl status resourcemanager_exporter
systemctl enable namenode_exporter
systemctl enable journalnode_exporter
systemctl enable datanode_exporter
systemctl enable resourcemanager_exporter