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

相关推荐
苦逼IT运维12 小时前
Jenkins 监控方案:Prometheus + Grafana 实践
jenkins·grafana·prometheus
川石课堂软件测试3 天前
Oracle 数据库:视图与索引
数据库·网络协议·nginx·http·oracle·grafana·prometheus
川石课堂软件测试3 天前
Oracle 数据库如何查询列
linux·数据库·sql·功能测试·oracle·grafana·prometheus
MasterNeverDown7 天前
.NET 微服务日志系统:Serilog + Loki + Grafana 实践指南
微服务·.net·grafana
❀͜͡傀儡师8 天前
docker安装Prometheus和Grafana 监控界面
docker·grafana·prometheus
好运连连9998 天前
ubuntu promethus+grafana监控多台服务器
linux·ubuntu·grafana
夏目&贵志9 天前
prometheus+grafana监控系统
docker·grafana·prometheus
强_子10 天前
基于 Prometheus+Alertmanager+Grafana 打造监控报警后台(四)-Grafana告警配置
服务器·grafana·prometheus
TTBIGDATA10 天前
【Ambari-Metrics监控】Grafana+Infinity快速构建DEMO-插件安装
hadoop·ambari·hdp·grafana·cdh·bigtop·ambari-metrics
Clownseven10 天前
Prometheus+Grafana入门教程:从零搭建云原生服务器监控系统
云原生·grafana·prometheus