prometheus + grafana

参考链接

相关 tar 包

wget https://github.com/prometheus/prometheus/releases/download/v2.53.4/prometheus-2.53.4.linux-amd64.tar.gz

wget https://dl.grafana.com/enterprise/release/grafana-enterprise-11.5.3.linux-amd64.tar.gz

wget https://github.com/prometheus/node_exporter/releases/download/v1.9.0/node_exporter-1.9.0.linux-amd64.tar.gz

安装 node_exporter
csharp 复制代码
mkdir /home/monitor/
cd /home/monitor/
wget https://github.com/prometheus/node_exporter/releases/download/v1.9.0/node_exporter-1.9.0.linux-amd64.tar.gz
csharp 复制代码
tar -xvf node_exporter-1.9.0.linux-amd64.tar.gz
ln -s node_exporter-1.9.0.linux-amd64  node_exporter
csharp 复制代码
cat >> /etc/systemd/system/node_exporter.service << EOF
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target

[Service]
User=prometheus
Group=prometheus
ExecStart=/home/monitor/node_exporter/node_exporter
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF
csharp 复制代码
useradd -M -s /sbin/nologin  prometheus
chown -R prometheus:prometheus /home/monitor/
csharp 复制代码
systemctl daemon-reload
systemctl enable --now node_exporter.service
systemctl restart  node_exporter
systemctl status  node_exporter
安装 Prometheus
csharp 复制代码
mkdir /home/monitor/
cd /home/monitor/
tar -zxvf prometheus-2.53.4.linux-amd64.tar.gz
ln -s prometheus-2.53.4.linux-amd64 prometheus
useradd -M -s /sbin/nologin  prometheus
chown -R prometheus.prometheus  /home/monitor/

cat >> /etc/systemd/system/prometheus.service << EOF
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview
After=network.target

[Service]
Type=simple
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/home/monitor/prometheus/prometheus \
  --config.file=/home/monitor/prometheus/prometheus.yml \
  --storage.tsdb.path=/home/monitor/prometheus/data \
  --storage.tsdb.retention.time=15d \
  --web.enable-lifecycle

[Install]
WantedBy=multi-user.target
EOF




systemctl daemon-reload
systemctl enable --now prometheus.service
systemctl status prometheus.service

systemctl restart prometheus.service
systemctl status prometheus.service

sudo chown -R prometheus:prometheus /home/monitor/prometheus/
sudo chmod -R 755 /home/monitor/prometheus/

# 实时查看日志(等待新日志出现)
journalctl -u prometheus.service -f

	
http://10.17.26.143:9090
vim /home/monitor/prometheus/prometheus.yml


http://10.17.26.174:9090


Nov 11 06:05:19 hadoop01 prometheus[78973]: ts=2025-11-11T06:05:19.852Z caller=tls_config.go:316 level=info component=web msg="TLS is disabled." http2=false address=[::]:9090
Nov 11 06:05:19 hadoop01 prometheus[78973]: ts=2025-11-11T06:05:19.854Z caller=head.go:626 level=info component=tsdb msg="Replaying on-disk memory mappable chunks if any"
Nov 11 06:05:19 hadoop01 prometheus[78973]: ts=2025-11-11T06:05:19.854Z caller=head.go:713 level=info component=tsdb msg="On-disk memory mappable chunks replay completed" duration=1.38µs







systemctl stop prometheus.service
systemctl disable prometheus.service

rm /etc/systemd/system/prometheus.service

# 重新加载systemd配置,使删除生效
systemctl daemon-reload

# 检查服务是否还存在(应该显示"not found")
systemctl status prometheus.service
安装 grafana
csharp 复制代码
		  
ln -s grafana-v11.5.3  grafana

chown -R prometheus.prometheus  /home/monitor/grafana


cat >> /etc/systemd/system/grafana-server.service << EOF
[Unit]
Description=Grafana server
Documetation=http://dosc.grafana.org

[Service]
Type=simple
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/home/monitor/grafana/bin/grafana-server --config=/home/monitor/grafana/conf/defaults.ini --homepath=/home/monitor/grafana

[Install]
WantedBy=multi-user.target
EOF




systemctl daemon-reload
systemctl enable --now grafana-server.service
systemctl restart  grafana-server
systemctl status  grafana-server
相关推荐
江南风月1 天前
WGCLOUD如果使用SQL Server数据库推荐哪个版本
运维·网络·zabbix·运维开发·prometheus
AI木马人2 天前
8.人工智能实战:大模型服务“看起来正常却突然变慢”?Prometheus + Grafana + GPU 指标构建全链路监控体系
人工智能·grafana·prometheus
萧行之3 天前
Docker部署Loki+Grafana+Vector实现全服务器日志监控(含N8N/SSH/Fail2ban监控)
服务器·docker·grafana
invicinble3 天前
关于搭建运维监控系统(Prometheus+Grafana)
运维·grafana·prometheus
Elastic 中国社区官方博客4 天前
使用 Observability Migration Platform 将 Datadog 和 Grafana 的仪表板与告警迁移到 Kibana
大数据·elasticsearch·搜索引擎·信息可视化·全文检索·grafana·datalog
sitellla4 天前
Grafana Loki 入门:高效日志聚合系统
其他·grafana
日取其半万世不竭4 天前
用 Netdata 实时监控服务器,比 Prometheus + Grafana 轻量得多
linux·服务器·网络·系统架构·负载均衡·zabbix·grafana
梵得儿SHI6 天前
(第二篇)Spring AI 架构设计与优化:可观察性体系,打造全链路可视化的 AI 运维方案
人工智能·微服务·grafana·prometheus·监控·可观察性·spring ai
川石课堂软件测试6 天前
AI如何赋能软件测试行业的发展
人工智能·python·功能测试·网络协议·单元测试·测试用例·prometheus
脏脏a6 天前
监控面板全绿但用户说网站打不开?Prometheus+Blackbox从外部验证服务真实可用性
数据库·prometheus