如何python安装hadoop_hadoop_exporter python版本的安装使用

1.需要使用python pip

参考https://www.cnblogs.com/rain124/p/6196053.html

python2.7.5 安装pip

1 先安装setuptools

下载地址:https://pypi.python.org/pypi/setuptools#downloads

将下载后的tar文件解压,用CMD模式进入到解压后的文件所在的目录执行命令:python setup.py install

2 安装pip

下载地址:https://pypi.python.org/pypi/pip#downloads

将下载后的tar文件解压,用CMD模式进入到解压后的文件所在的目录执行命令:python setup.py install

安装完成

3.安装pip install prometheus_client

4.安装pip install python_consu

2.下载hadoop_exporter

git clone https://github.com/cauwulixuan/hadoop_exporter

3.help

python hadoop_exporter.py -h

usage: hadoop_exporter.py [-h] [-c cluster_name] [-hdfs namenode_jmx_url]

[-rm resourcemanager_jmx_url] [-dn datanode_jmx_url]

[-jn journalnode_jmx_url] [-mr mapreduce2_jmx_url]

[-hbase hbase_jmx_url] [-hive hive_jmx_url]

[-p metrics_path] [-host ip_or_hostname] [-P port]

4.为几个exporter创建systemd服务

#cat /etc/systemd/system/nn_exporter.service

[Unit]

Description=namenode_exporter

After=network.target

[Service]

Type=simple

User=prometheus

ExecStart=python /usr/local/prom/exporter/hadoop_exporter/cmd/hdfs_namenode.py -s http://lab1:9135 -hdfs http://lab1:50070/jmx -P 9070Restart=on-failure

[Install]

WantedBy=multi-user.target#cat /etc/systemd/system/dn_exporter.service

[Unit]

Description=namenode_exporter

After=network.target

[Service]

Type=simple

User=prometheus

ExecStart=python /usr/local/prom/exporter/hadoop_exporter/cmd/hdfs_datanode.py -s http://lab1:9135 -dn http://lab1:50075/jmx -P 9072Restart=on-failure

[Install]

WantedBy=multi-user.target#cat /etc/systemd/system/jn_exporter.service

[Unit]

Description=namenode_exporter

After=network.target

[Service]

Type=simple

User=prometheus

ExecStart=python /usr/local/prom/exporter/hadoop_exporter/cmd/hdfs_journalnode.py -s http://lab1:9135 -jn http://lab1:8480/jmx -P 9071Restart=on-failure

[Install]

WantedBy=multi-user.target#cat /etc/systemd/system/rm_exporter.service

[Unit]

Description=namenode_exporter

After=network.target

[Service]

Type=simple

User=prometheus

ExecStart=python /usr/local/prom/exporter/hadoop_exporter/cmd/yarn_resourcemanager.py -s http://lab1:9135 -rm http://lab1:8088/jmx -P 9088Restart=on-failure

[Install]

WantedBy=multi-user.target#cat /etc/systemd/system/nm_exporter.service

[Unit]

Description=namenode_exporter

After=network.target

[Service]

Type=simple

User=prometheus

ExecStart=python /usr/local/prom/exporter/hadoop_exporter/cmd/yarn_nodemanager.py -s http://lab1:9135 -nm http://lab1:8042/jmx -P 9042Restart=on-failure

[Install]

WantedBy=multi-user.target

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

copycode.gif

##hadoop##

- job_name: 'nn'static_configs:

- targets: ['lab1:9070']

labels:

instance: lab1

- job_name: 'rm'static_configs:

- targets: ['lab1:9088']

labels:

instance: lab1

- job_name: 'dn'static_configs:

- targets: ['lab1:9072']

labels:

instance: lab1

- job_name: 'jn'static_configs:

- targets: ['lab1:9071']

labels:

instance: lab1

- job_name: 'nm'static_configs:

- targets: ['lab1:9042:']

labels:

instance: lab1

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值