CentOS7 prometheus +node_exporter+Grafana 安装篇

Posted xibuhaohao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7 prometheus +node_exporter+Grafana 安装篇相关的知识,希望对你有一定的参考价值。

一、下载与安装

1、prometheus下载与安装

1)下载

https://prometheus.io/download/ 

2)安装

上传prometheus-2.15.2.linux-amd64.tar.gz

tar -xvf prometheus-2.15.2.linux-amd64.tar.gz

mkdir /u01/soft/prometheus/

groupadd prometheus
useradd -g prometheus prometheus -d /u01/soft/prometheus/

cd prometheus-2.5.0.linux-amd64/
mv * /u01/soft/prometheus/
cd /u01/soft/prometheus/
mkdir {data,cfg,logs,bin} -p
mv prometheus promtool bin/
mv prometheus.yml cfg/
chown -R prometheus.prometheus /u01/soft/prometheus/*
3)设置环境变量

vim /etc/profile
PATH= /u01/soft/prometheus/bin:$PATH:$HOME/bin
source /etc/profile

4)创建prometheus.service 的 systemd unit 文件
vim /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/u01/soft/prometheus/bin/prometheus --config.file=/u01/soft/prometheus/cfg/prometheus.yml --storage.tsdb.path=/u01/soft/prometheus/data
Restart=on-failure
[Install]
WantedBy=multi-user.target
5)prometheus.yml配置文件
先使用默认设置
技术图片

 

 6)启动服务

systemctl daemon-reload

systemctl enable prometheus.service

systemctl start prometheus.service

systemctl status prometheus.service

技术图片

7)登录Prometheus自带有简单的UI

http://172.16.102.15:9090/targets

技术图片

 2、node_exporter下载与安装
1)下载
在prometheus官网
2)安装
tar -vzxf node_exporter-0.18.1.linux-amd64
mv node_exporter-0.18.1.linux-amd64 node_exporter
3)创建node_exporter.service的 systemd unit 文件
vim /usr/lib/systemd/system/node_exporter.service
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/u01/soft/prometheus/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
4)启动服务

systemctl daemon-reload
systemctl enable node_exporter.service
systemctl start node_exporter.service

技术图片

 5)客户监控端数据汇报

http://172.16.102.15:9100/metrics

技术图片

 

 

 

3、grafana下载与安装

1)下载grafana

下载需要登陆

user:xibuhaohao

pass:

https://grafana.com/grafana/download

2)安装grafana

mkdir /u01/soft/grafana/

rpm -ivh grafana-6.5.3-1.x86_64.rpm

技术图片

 3)启动服务

systemctl daemon-reload
systemctl enable grafana-server.service
systemctl start grafana-server.service

systemctl status grafana-server.service

技术图片

 

 4)访问grafana WEB界面

默认账号/密码:admin/admin

技术图片

 

以上是关于CentOS7 prometheus +node_exporter+Grafana 安装篇的主要内容,如果未能解决你的问题,请参考以下文章

Centos7 安装Docker

34J-3_4 corosync集群配置精讲

centos7安装指定版本node

cAdvisor Prometheus container_cpu_load_average_10s具有两个值

cAdvisor Prometheus container_cpu_load_average_10s 有两个值

CentOS7利用yum安装node.js