首页 > 其他分享 >prometheus使用3

prometheus使用3

时间:2024-02-11 10:13:35浏览次数:25  
标签:name rules prometheus job static 使用 configs targets

服务发现

基于文件的服务发现

现有配置:

[root@mcw03 ~]# cat /etc/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:
  - "rules/node_rules.yml"
  # - "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']
  - job_name: 'agent1'   
    static_configs:
    - targets: ['10.0.0.14:9100','10.0.0.12:9100']
  - job_name: 'promserver'   
    static_configs:
    - targets: ['10.0.0.13:9100']
  - job_name: 'server_mariadb' 
    static_configs:
    - targets: ['10.0.0.13:9104']
  - job_name: 'docker' 
    static_configs:
    - targets: ['10.0.0.12:8080']
    metric_relabel_configs:
    - regex: 'kernelVersion'
      action: labeldrop
[root@mcw03 ~]# 

把static_configs 替换成file_sd_configs

配置刷新重载文件配置的时间。可以不用手动刷新

 

标签:name,rules,prometheus,job,static,使用,configs,targets
From: https://www.cnblogs.com/machangwei-8/p/18013188

相关文章

  • 10.使用RestSharps请求WebAPI
    1.请求类publicclassBaseRequest{///<summary>///请求法式///</summary>publicRestSharp.MethodMethod{get;set;}///<summary>///路由///</summary>publicstr......
  • C#使用MiniExcel导入导出数据到Excel/CSV文件
    MiniExcel简介简单、高效避免OOM的.NET处理Excel查、写、填充数据工具。目前主流框架大多需要将数据全载入到内存方便操作,但这会导致内存消耗问题,MiniExcel尝试以Stream角度写底层算法逻辑,能让原本1000多MB占用降低到几MB,避免内存不够情况。特点:低内存耗用,避免OOM、频繁......
  • Ubuntu服务器使用 Daphne + Nginx + supervisor部署Django项目
    视频:https://www.bilibili.com/video/BV1e6421G7uM/?vd_source=36191bed2c30378060ff2efe6831b331Django从3.0版开始加入对ASGI的支持,使Django开始具有异步功能。截止目前的5.0版,对异步支持逐步也越来越好,相信在未来的版本中异步将会支持的更加完善。所以说,我们也需要适时的......
  • 04. GitHub的使用
    一、创建远程库  创建好远程库后,我们可以查看远程库地址链接。二、创建远程库别名gitremoteadd别名远程库地址链接三、查看远程库别名gitremote-v四、推送本地分支到远程库gitpush远程库地址别名或远程库地址链接分支名  我们在第一次使用gitpush......
  • loguru简单使用
    1.安装pipinstallloguru2.简单使用fromloguruimportloggerlogger.debug("xxx")logger.info("xxx")logger.waring("xxx")...3.add函数logger的add函数可以配置Handler、Formatter、Filter等。示例:importsysfromloguruimportloggerlogger.add(sys.stde......
  • 单机版 Xxl-Job 分布式定时任务调度的部署和使用
    Xxl-Job是一个分布式任务调度平台,其核心设计目标是开发迅速、学习简单、轻量级、易扩展。现已开放源代码并接入多家公司线上产品线,开箱即用。本篇博客主要介绍如何进行单机版部署和使用,并在博客最后提供源代码下载。Gitee地址:https://gitee.com/xuxueli0323/xxl-jobGitHub地......
  • 【Azure Function】Azure Function中使用 Java 8 的安全性问题
    问题描述使用AzureFunction,环境是Linux的Java8。目前OracleJavaJDK8,11,17和OpenJDK8/11/17都在存在漏洞受影响版本的范围内。OpenJDK                 CVEnumbers:    CVE‑2023‑21954CVE‑2023‑21938CVE‑2023‑21937CVE......
  • 使用FluentScheduler和IIS预加载在asp.net中实现定时任务管理
    FluentScheduler介绍github地址:https://github.com/fluentscheduler/FluentSchedulerFluentScheduler是一个简单的任务调度框架,使用起来非常方便,这个框架也是我在搜索iis预加载的时候偶然间发现的,立马拿来试用一下,感觉爽呆了,当然还有Quarz.Net之类的其他任务管理框架,不过看配置......
  • Mac 电脑下的一些快捷键及功能使用
    复制粘贴复制粘贴command+ccommand+v剪切粘贴command+ccommand+option+v指定目录打开terminal右键点击目录+option->Services->NewTreminalatFolder复制指定目录的路径多种方式command+option+coption+右键copyxxxasPathnameElmed......
  • 8.Prism聚合器的使用IEventAggregator
    IEventAggregator是一个事件聚合器,用于在不同模块之间进行通信。它允许模块之间进行解耦,通过发布和订阅事件来实现通信。在使用WPFprismIEventAggregator时,你可以创建自定义事件,订阅事件并在需要时发布事件。这样可以实现模块之间的松耦合,提高代码的可维护性和可扩展性。 ......