grafana agent metrics 使用简单使用

grafana agent 的能力还是比较强大的,支持log,metrics,trace,以下简单说明下

简单模式

只包含了metrics,不包含集成模式
核心点是metrics 配置,包含了remote write 以及静态或者动态配置(比喻基于文件的服务发现以及基于k8s 的服务发现)

 
server:
  log_level: info
 
metrics:
  global:
    scrape_interval: 1m
  configs:
    - name: agent
      scrape_configs:
        - job_name: agent
          static_configs:
            - targets: ['127.0.0.1:12345']
      remote_write:
        - url: http://localhost:9009/api/prom/push

包含集成的模式

因为agent 嵌入了不少开源exporter,我们可以直接拿来使用,此中模式是一个比较强大而且灵活的能力,我们就了不用安装那个多的exporter 了

server:
  log_level: info
 
metrics:
  global:
    scrape_interval: 1m
    remote_write:
      - url: http://localhost:9009/api/prom/push
  configs:
    - name: default
      scrape_configs:
        - job_name: agent
          static_configs:
            - targets: ['127.0.0.1:12345']
 
integrations:
  node_exporter: {}

说明

目前grafana agent 支持一种基于remote 配置的模式,可以通过使用远端http(s) 的配置,这样就比较方便了,可以简化我们不少配置管理的问题,目前处于体验状态
可以开启使用,此中模式就很不错了,我们可以基于http server 管理配置,可以做到灵活的配置管理,特别适合大量服务管理的时候,期待ga
同时官方目前也在测试一种动态配置模式(基于了gomplate)可以支持不少数据源模式的配置管理,比remote 更加强灵活,也期待ga

参考资料

https://grafana.com/docs/agent/latest/configuration/metrics-config/
https://grafana.com/docs/agent/latest/configuration/logs-config/
https://grafana.com/docs/agent/latest/configuration/traces-config/
https://grafana.com/docs/agent/latest/configuration/dynamic-config/
https://grafana.com/docs/agent/latest/configuration/integrations/
https://grafana.com/docs/agent/latest/configuration/create-config-file/
https://grafana.com/docs/agent/latest/configuration/
https://docs.gomplate.ca/datasources/

posted on   荣锋亮  阅读(962)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 百万级群聊的设计实践
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
历史上的今天:
2021-11-06 使用jproflier 分析dremio
2021-11-06 一次因为arthas 引起jvm crash 问题记录
2020-11-06 openfeign+retronfit http 访问
2020-11-06 java 一些访问http api 请求访问的方法整理
2019-11-06 Checking Types Against the Real World in TypeScript
2019-11-06 nexus pip proxy config
2018-11-06 ballerina 学习 三十一 扩展开发(二)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示