Prometheus Grafana 安装

本文指导您从安装Prometheus、Grafana到配置node_exporter,详解如何构建监控架构,包括配置文件详解和可视化平台的使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

一、简介

二、prometheus安装

 三、grafana安装

四、node_exporter 安装


一、简介

Grafana支持Prometheus可视化

Prometheus是一个开源监控系统,Prometheus架构图如下:

文档

     https://prometheus.io/docs/guides/node-exporter/

exporter 列表

     https://prometheus.io/docs/instrumenting/exporters/

prometheus下载

    https://prometheus.io/download/

grafana下载

    https://grafana.com/grafana/download

二、prometheus安装

​​​​

  1、tar xvf prometheus-2.33.5.linux-amd64.tar.gz

  2、prometheus.xml(prometheus 配置文件)

# 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"]

3、启动prometheus(默认端口9090)

./prometheus --config.file=/usr/local/prometheus/prometheus.yml &

 三、grafana安装

1、tar -zxvf grafana-enterprise-8.4.3.linux-amd64.tar.gz 

2、启动(默认端口3000,用户名/密码:admin/admin)

./bin/grafana-server 

3    添加Prometheus数据源

四、node_exporter 安装

  1、tar -zvxf node_exporter-1.3.1.linux-amd64.tar.gz

  2、启动

   ./node_exporter-1.3.1.linux-amd64/node_exporter 

 3、访问metrics (http://ip:9100/metrics)

     

4、配置prometheus(prometheus.xml)

   

 - job_name: "linux"

    # metrics_path defaults to '/metrics'
    #     # scheme defaults to 'http'.
    #
    static_configs:
       - targets: ["localhost:9100"]
         labels:
           instance: Linux

5、配置grafana

  ( 1) 官方提供很多dashboards(Dashboards | Grafana Labs

(2) 导入模版

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农_程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值