apiVersion: v1
data:
  prometheus.yml: |
    global:
      scrape_interval: 5s
    rule_files:
      - "/etc/prometheus-rules/alert.rules"
    alerting:
      alertmanagers:
        - static_configs:
          - targets: ["alertmanager:9093"]
    scrape_configs:
      - job_name: 'postgres-exporter'
        static_configs:
          - targets: ['postgres-exporter.postgres.svc.cluster.local:9187']
      - job_name: 'chaos-exporter'
        static_configs:
          - targets: ['chaos-exporter.litmus.svc.cluster.local:8080']
      - job_name: 'redis-metrics'
        static_configs:
          - targets: ['redis-svc.redis.svc.cluster.local:9121']
      - job_name: kubernetes-pods
        kubernetes_sd_configs:
          - role: pod
        relabel_configs:
          - source_labels:
              - __meta_kubernetes_pod_annotation_prometheus_io_scrape
            action: keep
            regex: 'true'
          - source_labels:
              - __meta_kubernetes_namespace
              - __meta_kubernetes_pod_label_name
            separator: /
            target_label: job
          - source_labels:
              - __meta_kubernetes_pod_node_name
            target_label: node
      - job_name: kubernetes-nodes
        kubernetes_sd_configs:
          - role: node
        tls_config:
          insecure_skip_verify: true
        bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
        relabel_configs:
          - target_label: __scheme__
            replacement: https
          - source_labels:
              - __meta_kubernetes_node_label_kubernetes_io_hostname
            target_label: instance
      - job_name: weave
        kubernetes_sd_configs:
          - role: pod
        relabel_configs:
          - source_labels:
              - __meta_kubernetes_namespace
              - __meta_kubernetes_pod_label_name
            action: drop
            regex: ^kube-system;weave-net$
          - source_labels:
              - __meta_kubernetes_pod_container_name
              - __address__
            action: replace
            target_label: __address__
            regex: '^weave;(.+?)(?::\d+)?$'
            replacement: '$1:6782'
          - source_labels:
              - __meta_kubernetes_pod_container_name
              - __address__
            action: replace
            target_label: __address__
            regex: '^weave-npc;(.+?)(?::\d+)?$'
            replacement: '$1:6781'
          - source_labels:
              - __meta_kubernetes_pod_container_name
            action: replace
            target_label: job
kind: ConfigMap
metadata:
  name: prometheus-configmap
  namespace: monitoring
