【基础篇】prometheus命令行参数详解

文章目录

    • 本篇内容讲解
    • 命令行参数详解

本篇内容讲解

prometheus高频修改命令行参数详解

命令行参数详解

  • 在页面的/页面上能看到所有的命令行参数,如图所示:
    在这里插入图片描述
  • 使用shell命令查看
# ./prometheus --help
usage: prometheus [<flags>]The Prometheus monitoring serverFlags:-h, --help                     Show context-sensitive help (also try --help-long and --help-man).--version                  Show application version.--config.file="prometheus.yml"Prometheus configuration file path.--web.listen-address="0.0.0.0:9090"Address to listen on for UI, API, and telemetry.--web.config.file=""       [EXPERIMENTAL] Path to configuration file that can enable TLS or authentication.--web.read-timeout=5m      Maximum duration before timing out read of the request, and closing idle connections.--web.max-connections=512  Maximum number of simultaneous connections.--web.external-url=<URL>   The URL under which Prometheus is externally reachable (for example, if Prometheus is served via a reverse proxy). Used for generating relative and absolute links back to Prometheus itself. If the URL has a path portion, it will be used toprefix all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived automatically.--web.route-prefix=<path>  Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url.--web.user-assets=<path>   Path to static asset directory, available at /user.--web.enable-lifecycle     Enable shutdown and reload via HTTP request.--web.enable-admin-api     Enable API endpoints for admin control actions.--web.console.templates="consoles"Path to the console template directory, available at /consoles.--web.console.libraries="console_libraries"Path to the console library directory.--web.page-title="Prometheus Time Series Collection and Processing Server"Document title of Prometheus instance.--web.cors.origin=".*"     Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1|domain2)\.com'--storage.tsdb.path="data/"Base path for metrics storage.--storage.tsdb.retention=STORAGE.TSDB.RETENTION[DEPRECATED] How long to retain samples in storage. This flag has been deprecated, use "storage.tsdb.retention.time" instead.--storage.tsdb.retention.time=STORAGE.TSDB.RETENTION.TIMEHow long to retain samples in storage. When this flag is set it overrides "storage.tsdb.retention". If neither this flag nor "storage.tsdb.retention" nor "storage.tsdb.retention.size" is set, the retention time defaults to 15d. UnitsSupported: y, w, d, h, m, s, ms.--storage.tsdb.retention.size=STORAGE.TSDB.RETENTION.SIZEMaximum number of bytes that can be stored for blocks. A unit is required, supported units: B, KB, MB, GB, TB, PB, EB. Ex: "512MB".--storage.tsdb.no-lockfileDo not create lockfile in data directory.--storage.tsdb.allow-overlapping-blocksAllow overlapping blocks, which in turn enables vertical compaction and vertical query merge.--storage.remote.flush-deadline=<duration>How long to wait flushing sample on shutdown or config reload.--storage.remote.read-sample-limit=5e7Maximum overall number of samples to return via the remote read interface, in a single query. 0 means no limit. This limit is ignored for streamed response types.--storage.remote.read-concurrent-limit=10Maximum number of concurrent remote read calls. 0 means no limit.--storage.remote.read-max-bytes-in-frame=1048576Maximum number of bytes in a single frame for streaming remote read response types before marshalling. Note that client might have limit on frame size as well. 1MB as recommended by protobuf by default.--rules.alert.for-outage-tolerance=1hMax time to tolerate prometheus outage for restoring "for" state of alert.--rules.alert.for-grace-period=10mMinimum duration between alert and restored "for" state. This is maintained only for alerts with configured "for" time greater than grace period.--rules.alert.resend-delay=1mMinimum amount of time to wait before resending an alert to Alertmanager.--alertmanager.notification-queue-capacity=10000The capacity of the queue for pending Alertmanager notifications.--query.lookback-delta=5m  The maximum lookback duration for retrieving metrics during expression evaluations and federation.--query.timeout=2m         Maximum time a query may take before being aborted.--query.max-concurrency=20Maximum number of queries executed concurrently.--query.max-samples=50000000Maximum number of samples a single query can load into memory. Note that queries will fail if they try to load more samples than this into memory, so this also limits the number of samples a query can return.--enable-feature= ...      Comma separated feature names to enable. Valid options: promql-at-modifier, promql-negative-offset, remote-write-receiver, exemplar-storage, expand-external-labels. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for moredetails.--log.level=info           Only log messages with the given severity or above. One of: [debug, info, warn, error]--log.format=logfmt        Output format of log messages. One of: [logfmt, json]
  • 重要参数讲解

  • --web.listen-address=“0.0.0.0:9090” 代表prometheus监听的地址,多个prometheus实例在一起时候会争抢。

  • --storage.tsdb.path=“data/” 本地tsdb存储位置

  • --storage.tsdb.retention.time 代表数据保留时间 默认15天

  • --web.enable-lifecycle 代表开启热更新配置

  • 热更新演示:

修改prometheus配置文件参数:

vim prometheus.yml
# 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"scrape_interval: 10s # 添加本行# metrics_path defaults to '/metrics'# scheme defaults to 'http'.static_configs:- targets: ["localhost:9090"]
# 热更新:
curl -X POST -vvv  localhost:9090/-/reload
* About to connect() to localhost port 9090 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 9090 (#0)
> POST /-/reload HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:9090
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 28 Apr 2025 10:42:50 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact

验证:
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/903348.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

深入理解CSS3:Flex/Grid布局、动画与媒体查询实战指南

引言 在现代Web开发中&#xff0c;CSS3已经成为构建响应式、美观且高性能网站的核心技术。它不仅提供了更强大的布局系统&#xff08;Flexbox和Grid&#xff09;&#xff0c;还引入了令人惊艳的动画效果和精准的媒体查询能力。本文将深入探讨这些关键技术&#xff0c;帮助您提…

从线性到非线性:简单聊聊神经网络的常见三大激活函数

大家好&#xff0c;我是沛哥儿&#xff0c;我们今天一起来学习下神经网络的三个常用的激活函数。 引言&#xff1a;什么是激活函数 激活函数是神经网络中非常重要的组成部分&#xff0c;它引入了非线性因素&#xff0c;使得神经网络能够学习和表示复杂的函数关系。 在神经网络…

2025上海车展 | 移远通信重磅发布AR脚踢毫米波雷达,重新定义“无接触交互”尾门

4月25日&#xff0c;在2025上海国际汽车工业展览会期间&#xff0c;全球领先的物联网和车联网整体解决方案供应商移远通信宣布&#xff0c;其全新AR脚踢毫米波雷达RD7702AC正式发布。 该产品专为汽车尾门“无接触交互”设计&#xff0c;基于先进的毫米波技术&#xff0c;融合AR…

深度学习:迁移学习

迁移学习 标题1.什么是迁移学习 迁移学习(Transfer Learning)是一种机器学习方法&#xff0c;就是把为任务 A 开发 的模型作为初始点&#xff0c;重新使用在为任务 B 开发模型的过程中。迁移学习是通过 从已学习的相关任务中转移知识来改进学习的新任务&#xff0c;虽然大多数…

Rabbitmq下载和安装(Windows系统,百度网盘)

一.下载安装Erlang 1.百度云下载 链接&#xff1a;https://pan.baidu.com/s/1k_U25KKngEf1iXWD1ANOeg 提取码&#xff1a;8ilc 2.安装 傻瓜式安装 直接下一步 选择自己要安装的路径 3.配置环境变量 增加变量名为&#xff1a;ERLANG_HOME 变量值填写自己的安装路径&#x…

(一)Linux的历史与环境搭建

【知识预告】 Linux背景介绍Linux操作系统特性Linux的应用场景Linux的发行版本搭建Linux环境 1 Linux背景介绍 1.1 什么是Linux&#xff1f; Linux是一种自由、开源的操作系统。严格来说&#xff0c;它是基于类Unix设计思想&#xff0c;旨在为用户提供稳定、安全、高效的计…

光流法:从传统方法到深度学习方法

1 光流法简介 光流&#xff08;Optical Flow&#xff09;是指图像中像素灰度值随时间的变化而产生的运动场。 简单来说&#xff0c;它描述了图像中每个像素点的运动速度和方向。 光流法是一种通过分析图像序列中像素灰度值来计算光流的方法。对于图像数据计算出来的光流是一个二…

解决ssh拉取服务器数据,要多次输入密码的问题

问题在于&#xff0c;每次循环调用 rsync 都是新开一个连接&#xff0c;所以每次都需要输入一次密码。为了只输入一次密码&#xff0c;有以下几种方式可以解决&#xff1a; ✅ 推荐方案&#xff1a;设置 SSH 免密登录 最稳最安全的方式是&#xff1a;配置 SSH 免密登录&#x…

web技术与Nginx网站服务

目录 一. web基础 1. 域名概念 2. Hosts 文件 3. DNS 4. 域名注册 5. 网页与 HTML 二. 网页概述 1. HTML 概述 2. HTML 基本标签 3. 网站和主页 三. 静态网页与动态网页 1. 静态网页 2. 动态网页 3. 动态网页语言 四. HTTP 协议 1. HTTP 协议概述 2. HTTP …

信创系统资产清单采集脚本:主机名+IP+MAC 一键生成 CSV

原文链接&#xff1a;信创系统资产清单采集脚本&#xff1a;主机名IPMAC 一键生成 CSV Hello&#xff0c;大家好啊&#xff01;今天给大家带来一篇在信创终端操作系统上自动批量采集主机名、IP 和 MAC 并导出为 CSV 表格的实战文章&#xff01;本方案使用 sshpass 和 Bash 脚本…

【dify+docker安装教程】

目录 一、dify安装包下载 二、运行环境配置 1、下载docker 2、安装 2.1 新建文件夹 2.2 安装 2.3 命令安装 3.下载完成后需要重启电脑&#xff0c;注意保存文档&#xff01;&#xff01;注意保存&#xff01;&#xff01;注意&#xff01;&#xff01;&#xff08;血的教…

HTML 地理定位(Geolocation)教程

HTML 地理定位(Geolocation)教程 简介 HTML5 的 Geolocation API 允许网页应用获取用户的地理位置信息。这个功能可用于提供基于位置的服务&#xff0c;如导航、本地搜索、天气预报等。本教程将详细介绍如何在网页中实现地理定位功能。 工作原理 浏览器可以通过多种方式确定…

协作开发攻略:Git全面使用指南 — 引言

协作开发攻略&#xff1a;Git全面使用指南 — 引言 Git 是一种分布式版本控制系统&#xff0c;用于跟踪文件和目录的变更。它能帮助开发者有效管理代码版本&#xff0c;支持多人协作开发&#xff0c;方便代码合并与冲突解决&#xff0c;广泛应用于软件开发领域。 文中内容仅限技…

毕业设计-基于预训练语言模型与深度神经网络的Web入侵检测系统

项目技术说明 基于预训练语言模型与深度神经网络的Web入侵检测系统&#xff0c;通过预训练模型CodeBert分词&#xff0c;将分词输入给BiGRU的深度学习模型训练。通过sniff函数实时捕获http流量信息&#xff0c;将流量信息输入给模型进行检测&#xff0c;模型可以检测的类别有S…

[计算机科学#4]:二进制如何塑造数字世界(0和1的力量)

【核知坊】&#xff1a;释放青春想象&#xff0c;码动全新视野。 我们希望使用精简的信息传达知识的骨架&#xff0c;启发创造者开启创造之路&#xff01;&#xff01;&#xff01; 内容摘要&#xff1a; 二进制是计算机世界的基石&#xff0c;数学是世界的…

JUC中各种锁机制的应用和原理及死锁问题定位

JUC中各种锁机制的应用和原理及死锁问题定位 在互联网大厂Java求职者的面试中&#xff0c;经常会被问到关于JUC&#xff08;Java Util Concurrency&#xff09;中的各种锁机制及其应用和原理的问题。本文通过一个故事场景来展示这些问题的实际解决方案。 第一轮提问 面试官&…

配置Ubuntu18.04中的Qt Creator为中文(图文详解)

配置Qt Creator为中文 1、前言2、先设置Ubuntu系统语言为中文3、配置Qt Creator中文环境2.1 IBus输入法&#xff08;方法一&#xff09;2.2、测试IBus输入法2.21IBus输入法终端中测试2.2.2IBus输入法Qt Creator中测试 2.3、Fcitx输入法&#xff08;方法二&#xff09;2.3.1安装…

高性能服务器配置经验指南3——安装服务器可能遇到的问题及解决方法

文章目录 1、重装系统后VScode远程连接失败问题2、XRDP连接黑屏问题1. 打开文件2. 添加配置3. 重启xrdp服务 3、VScode远程免密连接问题4、Vim编辑文件时出现不同用户冲突编辑的问题 在完成 服务器基本配置和 深度学习环境准备后&#xff0c;大家应该就可以正常使用服务器了&…

PyQt6基础_QThread

目录 前置 代码&#xff1a; 运行 正常运行 QThread运行报错 视频 前置 1 PySide6.QtCore.QThread - Qt for Python QThread官方文档 2 长时间任务可以放到QThread中执行&#xff0c;避免占用主线程导致界面卡顿无法操作 代码&#xff1a; import traceback,sys fro…

Spring Boot 应用运行指南

&#x1f680; Spring Boot 应用运行指南 ⚙️ 使用 Maven &#x1f527; 运行命令 $ mvn spring-boot:run✨ 启动效果 . ____ _ __ _ _/\\ / ____ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | _ | _| | _ \/ _ | \ \ \ \\\/ ___)| |_)| | | | | || (_…