当前位置:网站首页>Prometheus Operator 通过additional 添加target

Prometheus Operator 通过additional 添加target

2022-08-09 18:53:00 叱咤少帅(少帅)

前言

Proms Operator 添加自定义监控可以通过如下两种方式实现,本文是 additional 方式。

  • additional 方式
  • serviceMonitor方式

官网

安装参考这个专栏里以前的博文。

##
https://github.com/prometheus-operator/kube-prometheus#quickstart

按照官网的部署,这个方式部署起来的prometheus还有很多的缺陷,不能直接用于生产环境使用,具体问题点如下:

  • 数据没有持久化存储(grafana、prometheus)
  • svc都是用的clusterIP 不方便运维管理
  • 默认的告警方式不方便
  • 加监控target也不方便

官网

##
https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/additional-scrape-config.md

 vim prometheus-prometheus.yaml 

末尾添加:

  additionalScrapeConfigs:
    name: additional-scrape-configs
    key: prometheus-additional.yaml

vim prometheus-additional.yaml

- job_name: "base-linux"
  static_configs:
  - targets: ["192.168.0.36:9090","192.168.0.11:9090"]

- job_name: "kafka-explorer"
  static_configs:
  - targets: ["192.168.0.11:9000"]

添加secret

kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml --dry-run=client -oyaml > additional-scrape-configs.yaml

Next, apply the generated kubernetes manifest

##
kubectl apply -f additional-scrape-configs.yaml -n monitoring

查看

原网站

版权声明
本文为[叱咤少帅(少帅)]所创,转载请带上原文链接,感谢
https://knight.blog.csdn.net/article/details/126244524