prometheus安装教程

简介: prometheus安装教程

下载解压

可以直接下载二进制包,也可以自己下载源码包编译,下载地址:https://prometheus.io/download/

wget https://github.com/prometheus/prometheus/releases/download/v2.36.0/prometheus-2.36.0.linux-amd64.tar.gz
tar -zvxf prometheus-2.36.0.linux-amd64.tar.gz 
cd prometheus-2.36.0.linux-amd64

配置项:

# 全局配置
global:
  scrape_interval: 15s # 设置抓取间隔,默认1分钟,配置是15秒
  evaluation_interval: 15s # 估算规则的默认周期,默认1分钟,配置是15秒
  # scrape_timeout # 抓取超时时间,默认10秒
# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093
# 规则文件列表,使用  evaluation_interval 间隔去抓取
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"
# 抓取节点配置,使用 scrape_interval 间隔去抓取
scrape_configs:
  # prometheus默认的节点配置
  - job_name: "prometheus"
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
      - targets: \["localhost:9091"\]

运行

./prometheus --config.file=./prometheus.yml --web.listen-address=0.0.0.0:9091 --storage.tsdb.path=/usr/local/prometheus-2.36.0.linux-amd64/data

启动成功截图:

image.png

转为服务开机自启动

# vim /etc/systemd/system/prometheus.service
\[Unit\]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
\[Service\]
ExecStart=/usr/local/prometheus-2.36.0.linux-amd64/prometheus --config.file=/usr/local/prometheus-2.36.0.linux-amd64/prometheus.yml --storage.tsdb.path=/usr/local/prometheus-2.36.0.linux-amd64/data --web.listen-address=0.0.0.0:9091
WorkingDirectory=/usr/local/prometheus-2.36.0.linux-amd64/
Restart=on-failure
\[Install\]
WantedBy=multi-user.target

启动服务

systemctl start prometheus
 systemctl status prometheus
 systemctl enable prometheus

image.png

查看

访问:localhost:9090 即可看到prometheus自带的ui:


image.png

目录
相关文章
|
编解码 IDE 算法
2023年电赛---运动目标控制与自动追踪系统(E题)发挥题思路
2023年电赛---运动目标控制与自动追踪系统(E题)发挥题思路
1734 0
|
SQL 存储 缓存
值得收藏!my.cnf配置文档详解
MySql对于开发人员来说应该都比较熟悉,不管是小白还是老码农应该都能熟练使用。但是要说到的各种参数的配置,我敢说大部分人并不是很熟悉,当我们需要优化mysql,改变某项参数的时候。还是要到处在网上查找,有点不方便。今天就把我所知道的MySql的配置文件my.cnf做一个简单的说明吧,注意,我总结的mysql是Linux环境下的。
值得收藏!my.cnf配置文档详解
|
Prometheus 监控 关系型数据库
Linux监控之夜莺
Linux监控之夜莺
2481 0
|
Cloud Native Linux 虚拟化
如何安装和使用Docker?
如何安装和使用Docker?
942 0
|
Prometheus 监控 Kubernetes
Prometheus + Grafana安装
Prometheus + Grafana安装
|
11月前
|
存储 弹性计算 运维
阿里云轻量应用服务器和云服务器区别——ECS和轻量如何选择?
阿里云轻量应用服务器简化易用,适合个人及轻量场景;ECS功能强大、弹性灵活,适用于企业级复杂业务。根据需求选择:轻量型选SWAS,高性能选ECS。
|
11月前
|
存储 弹性计算 小程序
2026年阿里云服务器新手指南:配置选购、费用价格及使用全流程(图文教程)
本文手把手教你从零选购、购买并登录阿里云服务器,涵盖ECS与轻量应用服务器区别、核心配置参数、2026年最新优惠价格及远程登录方法,适合新手快速上手,30分钟轻松迈出上云第一步。
|
人工智能 自然语言处理 机器人
大厂RAG面试题:24个RAG八股文。偷偷背下来,毒打面试官 !
大厂RAG面试题:24个RAG八股文。偷偷背下来,毒打面试官 !
大厂RAG面试题:24个RAG八股文。偷偷背下来,毒打面试官 !
|
canal 消息中间件 监控
[从零单排canal 02] canal 集群版+admin控制台 最新搭建姿势(基于1.1.4版本)
[从零单排canal 02] canal 集群版+admin控制台 最新搭建姿势(基于1.1.4版本)
2961 0
[从零单排canal 02] canal 集群版+admin控制台 最新搭建姿势(基于1.1.4版本)
|
存储 监控 Java
一文看懂分布式链路监控系统
本文通过阿里的Eagleeye(鹰眼)和开源的Skywalking,从数据模型、数据埋点以及数据存储三个方面介绍分布式链路监控系统的实现细节,其中将重点介绍Skywalking字节码增强的实现方案。
92490 6