hadoop_exporter+prometheus

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 /etc/systemd/system/namenode_exporter.service
[Unit]
Description=namenode_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prom/exporter/hadoop_exporter/namenode_exporter -namenode.jmx.url http://lab1:50070/jmx
Restart=on-failure
[Install]
WantedBy=multi-user.target
#vim /etc/systemd/system/datanode_exporter.service
[Unit]
Description=datanode_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prom/exporter/hadoop_exporter/datanode_exporter -datanode.jmx.url http://lab1:50075/jmx
Restart=on-failure
[Install]
WantedBy=multi-user.target
#vim /etc/systemd/system/journalnode_exporter.service
[Unit]
Description=journalnode_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prom/exporter/hadoop_exporter/journalnode_exporter -journalnode.jmx.url http://lab1:8480/jmx
Restart=on-failure
[Install]
WantedBy=multi-user.target
#vim /etc/systemd/system/resourcemanager_exporter.service
[Unit]
Description=resourcemanager_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prom/exporter/hadoop_exporter/resourcemanager_exporter -resourcemanager.url http://lab1:8080
Restart=on-failure
[Install]
WantedBy=multi-user.target

4.为几个exporter配置prometheus配置文件

##hadoop##
  - job_name: 'nn'
    static_configs:
    - targets: ['localhost:9070']
      labels:
          instance: lab1

  - job_name: 'rm'
    static_configs:
    - targets: ['localhost:9088']
      labels:
          instance: lab1

  - job_name: 'dn'
    static_configs:
    - targets: ['localhost:9072']
      labels:
          instance: lab1

  - job_name: 'jn'
    static_configs:
    - targets: ['localhost:9071']
      labels:
          instance: lab1

5.启动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
 

6.

 

转载于:https://www.cnblogs.com/roger888/p/10647340.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值