centos7下安装promethus及grafana

1、下载,如下地址下载prometheus和相应的exporter

https://github.com/prometheus/prometheus/releases

本次下载的是2.55.1

https://github.com/prometheus/prometheus/releases/download/v2.55.1/prometheus-2.55.1.linux-amd64.tar.gz

2、node_exporter

https://github.com/prometheus/node_exporter/releases

版本为1.8.2

https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz

3、解压并复制文件到/usr/bin

tar zxvf prometheus-2.55.1.linux-amd64.tar.gz

tar zxvf node_exporter-1.8.2.linux-amd64.tar.gz

prometheus.yaml 文件内容:其实是模板

bash 复制代码
# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]

4、设置服务

nano /usr/lib/systemd/system/prometheus.service

bash 复制代码
[Unit]
  Description=https://prometheus.io
  
  [Service]
  Restart=on-failure
  ExecStart=/usr/bin/prometheus --config.file=/app/prometheus/prometheus.yml --web.listen-address=:9090

  [Install]                      
  WantedBy=multi-user.target

systemctl status prometheus
systemctl start prometheus
systemctl enable prometheus

5、启动后

起来后使用 节点名或ip:9090访问

6、node_exporter启动

直接启动

bash 复制代码
./node_exporter &

启动后会监听9100端口

添加为服务方式启动

bash 复制代码
nano /usr/lib/systemd/system/node_exporter.service
bash 复制代码
[Unit]
Description=node_exporter
After=network.target 

[Service]
ExecStart=/usr/bin/node_exporter
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动node_exporter

systemctl daemon-reload

systemctl start node_exporter

7、安装grafana

bash 复制代码
docker run -d -p 3000:3000 --name grafana swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/rancher/mirrored-grafana-grafana:9.1.5

8、下载grfana的promethus模板并导入

访问地址 节点ip:3000 默认admin/admin

promethus的grafana模板

https://grafana.com/grafana/dashboards/8919

相关推荐
❀͜͡傀儡师3 天前
Docker 部署 Grafana + Loki + Promtail 日志可视化搭建
docker·容器·grafana
袁煦丞 cpolar内网穿透实验室3 天前
Grafana突破局域网限制,随时随地访问数据看板! cpolar内网穿透实验室第 515 个成功挑战
grafana·远程工作·内网穿透·cpolar·随时访问
递归尽头是星辰4 天前
架构实战:1 小时搭建Java微服务指标监控体系(Prometheus+Grafana 落地指南)
grafana·prometheus·可观测性·micrometer·指标监控·java 微服务监控
IDOlaoluo6 天前
Windows 安装 Grafana 看板详细步骤
windows·grafana
safestar20127 天前
Grafana+MySQL监控实战:从数据库救火到性能预测的完整方案
mysql·grafana
礼拜天没时间.7 天前
《Grafana 企业级可视化监控实战指南:从安装、配置到智能告警》:Grafana 使用
linux·运维·信息可视化·zabbix·grafana·监控
礼拜天没时间.7 天前
《Grafana 企业级可视化监控实战指南:从安装、配置到智能告警》:Grafana 安装部署
linux·运维·信息可视化·zabbix·grafana·监控
礼拜天没时间.8 天前
《Grafana 企业级可视化监控实战指南:从安装、配置到智能告警》:Grafana 简介
linux·运维·信息可视化·zabbix·grafana·监控
礼拜天没时间.8 天前
《Grafana 企业级可视化监控实战指南:从安装、配置到智能告警》:Grafana 环境搭建
linux·运维·信息可视化·zabbix·grafana·监控
Connie145110 天前
记一次K8s故障告警排查(Grafna告警排查)
云原生·容器·kubernetes·grafana