apiVersion: v1
data:
  init.sh: |-
    #!/bin/sh
    cd /data/
    rm -R *
    mkdir prometheus
    mkdir blackbox-exporter
    mkdir opentelemetry
    mkdir alertmanager
    cp /template/prometheus.yml /data/prometheus/prometheus.yml
    cp /template/blackbox.yml /data/blackbox-exporter/blackbox.yml
    cp /template/opentelemetry.yaml /data/opentelemetry/otel-collector-config.yaml
    cp /template/alertmanager.yaml /data/alertmanager/alertmanager.yaml
  prometheus.yml: |-
    global:
      scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
      evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
      # scrape_timeout is set to the global default (10s).
    
    # Alertmanager configuration
    alerting:
      alertmanagers:
        - static_configs:
          - targets:
          # - alertmanager:9093

      # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
    rule_files:
      
    scrape_configs:
      - job_name: "prometheus"
        static_configs:
          - targets: ["localhost:9090"]
  blackbox.yml: |-
    modules:
      http_2xx:
        prober: http
        timeout: 5s
        http:
          valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
          no_follow_redirects: false
          preferred_ip_protocol: "ip4"
      icmp:
        prober: icmp
        timeout: 5s
        icmp:
          preferred_ip_protocol: "ip4"
  opentelemetry.yaml: |-
    receivers:
      otlp:
        protocols:
          grpc:

    processors:

    exporters:
      otlp:
        endpoint: otelcol:4317

    extensions:

    service:
      pipelines:
        traces:
          receivers: [otlp]
          exporters: [otlp]
  alertmanager.yml: |-
    route:
      group_by: ['alertname']
      group_wait: 30s
      group_interval: 5m
      repeat_interval: 1h
      receiver: 'web.hook'
    receivers:
    - name: 'web.hook'
      webhook_configs:
      - url: 'http://127.0.0.1:5001/'
    inhibit_rules: []
kind: ConfigMap
metadata:
  name: init-workspace-cm
