apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    name: prometheus-blackbox-exporter
    k8s-app: prometheus-blackbox-exporter
    release: prometheus-stack
  name: prometheus-blackbox-exporter
  namespace: monitoring
spec:
  endpoints:
    - interval: 1s
      path: /probe
      port: http
      params:
        module:
          - http_2xx
        target:
          - 'podtato-main.litmus.svc.cluster.local:9000'
      metricRelabelings:
        - action: replace
          regex: (.*)
          replacement: ${1}
          sourceLabels:
            - __address__
          targetLabel: __param_target
        - action: replace
          regex: (.*)
          replacement: ${1}
          sourceLabels:
            - __param_target
          targetLabel: instance
        - targetLabel: __address__
          replacement: 'prometheus-blackbox-exporter:9115'
  selector:
    matchLabels:
      app: prometheus-blackbox-exporter
