文章目录
一.架构说明与资源准备

需要准备的软件包:
node_exporter-1.2.0.tar.gz
grafana-7.3.0-1.x86_64.rpm
prometheus-2.45.1.linux-amd64.tar.gz
以上软件版本可以有一定的差异,只要兼容RHEL7的操作系统,本次部署的3台虚拟机操作系统是 CentOS Linux release 7.9.2009 (Core) 。
软件包下载地址参考:
https://rpmfind.net/linux/rpm2html/search.php
https://sourceforge.net/projects/infozip/files/
https://centos.pkgs.org/7/centos-x86_64/
https://access.redhat.com/downloads
二.部署prometheus
本章操作都在node01进行。
1.上传软件包
首先将软件包上传到/root目录下

2.解压软件包并移动到指定位置
接着创建/data目录,准备将后续解压后的软件文件放在/data目录
mkdir /data
tar zxf prometheus-2.45.1.linux-amd64.tar.gz
mv prometheus-2.45.1.linux-amd64 /data/prometheus
3.修改配置文件
针对配置文件 /data/prometheus/prometheus.yml 进行修改
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- 192.168.0.201:9093
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
- rules/*.yml
scrape_configs:
- job_name: "node_exporter"
static_configs:
# #监控的主机IP和node-exporter端口
- targets: ['192.168.0.201:9100','192.168.0.202:9100','192.168.0.203:9100']
relabel_configs:
- source_labels:
- "__address__"
regex: "(.*):9100"
target_label: "instance"
action: replace
replacement: "$1"
remote_write:
- url: "http://192.168.0.201:8086/api/v1/prom/write

本文详细描述了如何在Linux服务器上部署Prometheus和Grafana,包括软件包的上传、配置文件的修改、node-exporter的部署以及Grafana的数据源设置和监控模板定制,确保资源监控的完整性和可扩展性。
最低0.47元/天 解锁文章
1136

被折叠的 条评论
为什么被折叠?



