prometheus (四) 黑盒监控

2023-05-02 16:56:27 浏览数 (4)

Probe CRD 的 API 文档: https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1.Probe

在 k8s 集群创建 Probe

代码语言:javascript复制
apiVersion: monitoring.coreos.com/v1
kind: Probe
metadata:
  name: demo-probe-node-exporter
  namespace: monitoring
spec:
  jobName: demo-probe-node-exporter
  interval: 10s
  prober:
    url: localhost
    path: /metrics
  metricRelabelings:
  - sourceLabels: [__address__]
    targetLabel: target
  targets:
    staticConfig:
      static:
      - 1.1.1.4:9100
      relabelingConfigs:
      - sourceLabels: [__param_target]
        targetLabel: instance
      - sourceLabels: [__param_target]
        targetLabel: __address__

应用完上述配置文件后, 查看 prometheus

简单查询一下 count(node_cpu_seconds_total{instance="1.1.1.4:9100",mode='system'})

1 人点赞