Prometheus笔记-file_sd_config
1.Prometheus笔记-安装2.Prometheus笔记-Label标签
3.Prometheus笔记-file_sd_config
4.Prometheus笔记-监控docker容器5.Prometheus笔记-Grafana可视化6.Prometheus笔记-安装Node_exporter7.Prometheus笔记-配置文件字段解析8.Prometheus笔记-安装blackbox_exporter9.Prometheus笔记-设置Basic_auth登录校验10.Prometheus笔记-Docker部署Prometheus11.Prometheus笔记-监控Nginx12.Prometheus笔记-告警规则配置一般一个job作为一个业务服务,它下面的监控的机器/节点都是这个服务的节点,为了方便管理,我们可以按照job划分,为每个job创建一个子配置文件,这样方便管理
配置文件
# my global config global: scrape_interval: 15s # #每15s采集一次数据 evaluation_interval: 15s #每15s做一次告警检测. # scrape_timeout is set to the global default (10s). # Alertmanager configuration(告警配置) alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # rule_files 加载告警规则文件 rule_files: # - "first_rules.yml" # - "second_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: # 定义一个job名称 - job_name: "prometheus" # 默认指标地址 '/metrics' metrics_path: '/metrics' # scheme defaults to 'http'. scheme: 'http' # 基于文件的服务发现提供了一种更通用的方法来配置静态目标,子配置文件支持json和yaml file_sd_configs: - files: ["./child_config/prometheus.yml"]
创建子配置文件目录
[root@VM-24-9-centos prometheus-2.41.0.linux-amd64]# mkdir -p child_config
创建子配置文件
[root@VM-24-9-centos prometheus-2.41.0.linux-amd64]# cd child_config [root@VM-24-9-centos prometheus-2.41.0.linux-amd64]# touch prometheus.yml
- targets: ["localhost:9090"] labels: env: 'test' host: 'localhost'
显示效果
作者:jruing
出处:https://www.cnblogs.com/jruing/p/17057602.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
本文来自博客园,作者:Jruing,转载请注明原文链接:https://www.cnblogs.com/jruing/p/17057602.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫