HDFS & Yarn 即Hadoop by Jmx on Promethues + Grafana的监控(一) —— Promethues的安装

一、安装Go环境

因为Promethues是用go语言开发,所以要先安装一个go环境

1、下载安装包地址:

2、解压

 tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz

3、修改环境变量

vim  /etc/profile
添加
export PATH=$PATH:/usr/local/go/bin 
刷新配置
source  /etc/profile 

4、确认是否配置好

go  version

go version go1.8.3 linux/amd64 

二、安装Promethues

1、下载安装包

官网链接:https://prometheus.io/download/

选择最新的2.24.0的linux版本:https://github.com/prometheus/prometheus/releases/download/v2.24.0/prometheus-2.24.0.linux-amd64.tar.gz

2、解压

tar  -vxf  prometheus-2.24.0.linux-amd64.tar.gz  -C /usr/local/

3、建个软链

ln  -sv  /usr/local/prometheus-2.24.0.linux-amd64/  /usr/local/prometheus

三、启动Promethues

1、进入/usr/local/prometheus启动Promethues

注意:不建议这样方式后台启动./prometheus --config.file=prometheus.yml & ,这样容易导致重启Promethues时之前的数据都会丢失

$ vim /etc/systemd/system/prometheus.service
--------------------------------------------------
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /usr/local/prometheus/prometheus.yml \
--storage.tsdb.path /data/prometheus/ \
--web.console.templates=/usr/local/prometheus/consoles \
--web.console.libraries=/usr/local/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
--------------------------------------------------

$ cp /usr/local/prometheus/prometheus /usr/local/bin 

$ systemctl start prometheus

$ systemctl status prometheus 

2、用promethues的web默认访问端口9090在浏览器上访问

http://promethuess所在host:9090/classic/graph

如果出现以下的画面就说明你配置成功:

image

四、使用和配置Grafana

参考我另外两篇文章:

HDFS & Yarn on Promethues + Grafana的监控(二) —— Promethues数据源配置

HDFS & Yarn on Promethues + Grafana的监控(三) —— Grafana的Dashboard配置(以 Yarn 为例)

推荐阅读更多精彩内容