centos7.6部署prometheus

1.安装前准备

Prometheus Server 192.168.2.79
node_exporter 192.168.2.70

2.下载所需的包下载所需的包

$ cd /usr/local/
prometheus-2.11.1.linux-amd64.tar
node_exporter-0.18.1.linux-amd64.tar
tar -zxvf  prometheus-2.11.1.linux-amd64.tar 
mv prometheus-2.11.1.linux-amd64 prometheus

3.创建prometheus用户。

$ groupadd prometheus
$ useradd -g prometheus -m -d /var/lib/prometheus -s /sbin/nologin prometheus

4.创建systemctl启动文件

[root@localhost ~]# cat /usr/lib/systemd/system/prometheus.service 
[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --storage.tsdb.retention=15d --log.level=info
Restart=on-failure
[Install]
WantedBy=multi-user.target

5.启动prometheus

systemctl daemon-reload
systemctl start prometheus
systemctl enable prometheus

6.浏览器访问:

192.168.2.79:9090即可打开Prometheus Server

7.安装agent端,创建prometheus用户。

$ groupadd prometheus
$ useradd -g prometheus -m -d /var/lib/prometheus -s /sbin/nologin prometheus

8.解压包

$ cd /usr/local/
tar -zxvf  node_exporter-0.18.1.linux-amd64.tar
mv node_exporter-0.18.1.linux-amd64 node_exporter

9.创建systemctl启动文件

[root@localhost local]# cat /usr/lib/systemd/system/node_exporter.service 
[Unit]
Description=node_export
Documentation=https://github.com/prometheus/node_exporter
After=network.target
 
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target

10启动node_export

systemctl daemon-reload
systemctl start node_exporter
systemctl enable node_exporter

11去Prometheus Server端修改配置文件,将agent端加入到主节点中

- job_name: 'jp-test'
    scrape_interval: 5s
    static_configs:
    - targets: ['192.168.2.70:9100','192.168.2.71:9100','192.168.2.72:9100','192.168.2.73:9100']
  - job_name: '50-mysql'
    scrape_interval: 5s
    static_configs:
    - targets: ['192.168.2.50:9104']

加入以上,保存配置文件

12重启prometheus

systemctl restart prometheus

13部署grafana

yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.4.3-1.x86_64.rpm

14 启动grafana

systemctl start grafana-server
systemctl enable grafana-server

15 访问浏览器:

192.168.2.79:3000即可打开页面 重置密码 进入后选择data sources 设置prometheus 地址选择localhost:9090 导入自带的模板即可

学习更多教程

在这里插入图片描述

下载地址

下载地址

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值