github.com/thanos-io/thanos@v0.32.5/examples/alerts/tests.yaml (about)

     1  rule_files:
     2    - alerts.yaml
     3    - rules.yaml
     4  
     5  evaluation_interval: 1m
     6  
     7  tests:
     8  - interval: 1m
     9    input_series:
    10    - series: 'thanos_sidecar_prometheus_up{namespace="production", job="thanos-sidecar", instance="thanos-sidecar-0", pod="prometheus-0"}'
    11      values: '1x5 0x15'
    12    - series: 'thanos_sidecar_prometheus_up{namespace="production", job="thanos-sidecar", instance="thanos-sidecar-1", pod="prometheus-1"}'
    13      values: '1x4 0x15'
    14    - series: 'prometheus_tsdb_data_replay_duration_seconds{namespace="production", job="prometheus-k8s", instance="prometheus-k8s-0", pod="prometheus-0"}'
    15      values: '4x5 0x5 5x15'
    16    - series: 'prometheus_tsdb_data_replay_duration_seconds{namespace="production", job="prometheus-k8s", instance="prometheus-k8s-1", pod="prometheus-1"}'
    17      values: '10x14 0x6'
    18    alert_rule_test:
    19    - eval_time: 1m
    20      alertname: ThanosSidecarNoConnectionToStartedPrometheus
    21    - eval_time: 2m
    22      alertname: ThanosSidecarNoConnectionToStartedPrometheus
    23    - eval_time: 3m
    24      alertname: ThanosSidecarNoConnectionToStartedPrometheus
    25    - eval_time: 10m
    26      alertname: ThanosSidecarNoConnectionToStartedPrometheus
    27      exp_alerts:
    28      - exp_labels:
    29          severity: critical
    30          job: thanos-sidecar
    31          instance: thanos-sidecar-1
    32          namespace: production
    33          pod: prometheus-1
    34        exp_annotations:
    35          description: 'Thanos Sidecar thanos-sidecar-1 is unhealthy.'
    36          runbook_url: 'https://github.com/thanos-io/thanos/tree/main/mixin/runbook.md#alert-name-thanossidecarnoconnectiontostartedprometheus'
    37          summary: 'Thanos Sidecar cannot access Prometheus, even though Prometheus seems healthy and has reloaded WAL.'
    38    - eval_time: 11m
    39      alertname: ThanosSidecarNoConnectionToStartedPrometheus
    40      exp_alerts:
    41      - exp_labels:
    42          severity: critical
    43          job: thanos-sidecar
    44          instance: thanos-sidecar-1
    45          namespace: production
    46          pod: prometheus-1
    47        exp_annotations:
    48          description: 'Thanos Sidecar thanos-sidecar-1 is unhealthy.'
    49          runbook_url: 'https://github.com/thanos-io/thanos/tree/main/mixin/runbook.md#alert-name-thanossidecarnoconnectiontostartedprometheus'
    50          summary: 'Thanos Sidecar cannot access Prometheus, even though Prometheus seems healthy and has reloaded WAL.'
    51    - eval_time: 12m
    52      alertname: ThanosSidecarNoConnectionToStartedPrometheus
    53      exp_alerts:
    54      - exp_labels:
    55          severity: critical
    56          job: thanos-sidecar
    57          instance: thanos-sidecar-1
    58          namespace: production
    59          pod: prometheus-1
    60        exp_annotations:
    61          description: 'Thanos Sidecar thanos-sidecar-1 is unhealthy.'
    62          runbook_url: 'https://github.com/thanos-io/thanos/tree/main/mixin/runbook.md#alert-name-thanossidecarnoconnectiontostartedprometheus'
    63          summary: 'Thanos Sidecar cannot access Prometheus, even though Prometheus seems healthy and has reloaded WAL.'
    64    - eval_time: 20m
    65      alertname: ThanosSidecarNoConnectionToStartedPrometheus
    66      exp_alerts:
    67      - exp_labels:
    68          severity: critical
    69          job: thanos-sidecar
    70          instance: thanos-sidecar-0
    71          namespace: production
    72          pod: prometheus-0
    73        exp_annotations:
    74          description: 'Thanos Sidecar thanos-sidecar-0 is unhealthy.'
    75          runbook_url: 'https://github.com/thanos-io/thanos/tree/main/mixin/runbook.md#alert-name-thanossidecarnoconnectiontostartedprometheus'
    76          summary: 'Thanos Sidecar cannot access Prometheus, even though Prometheus seems healthy and has reloaded WAL.'
    77  
    78  - interval: 1m
    79    input_series:
    80    - series: 'prometheus_rule_evaluations_total{namespace="production", job="thanos-ruler", instance="thanos-ruler-0"}'
    81      values: '5x7 0x8'
    82    - series: 'prometheus_rule_evaluations_total{namespace="production", job="thanos-ruler", instance="thanos-ruler-1"}'
    83      values: '5x7 0x8'
    84    - series: 'thanos_rule_loaded_rules{namespace="production", job="thanos-ruler", instance="thanos-ruler-0"}'
    85      values: '0x5 5x10'
    86    - series: 'thanos_rule_loaded_rules{namespace="production", job="thanos-ruler", instance="thanos-ruler-1"}'
    87      values: '0x5 5x10'
    88    alert_rule_test:
    89      - eval_time: 1m
    90        alertname: ThanosNoRuleEvaluations
    91      - eval_time: 5m
    92        alertname: ThanosNoRuleEvaluations
    93      - eval_time: 6m
    94        alertname: ThanosNoRuleEvaluations
    95      - eval_time: 11m
    96        alertname: ThanosNoRuleEvaluations
    97        exp_alerts:
    98        - exp_labels:
    99            severity: critical
   100            job: thanos-ruler
   101            instance: thanos-ruler-0
   102          exp_annotations:
   103            description: 'Thanos Rule thanos-ruler-0 did not perform any rule evaluations in the past 10 minutes.'
   104            runbook_url: 'https://github.com/thanos-io/thanos/tree/main/mixin/runbook.md#alert-name-thanosnoruleevaluations'
   105            summary: 'Thanos Rule did not perform any rule evaluations.'
   106        - exp_labels:
   107            severity: critical
   108            job: thanos-ruler
   109            instance: thanos-ruler-1
   110          exp_annotations:
   111            description: 'Thanos Rule thanos-ruler-1 did not perform any rule evaluations in the past 10 minutes.'
   112            runbook_url: 'https://github.com/thanos-io/thanos/tree/main/mixin/runbook.md#alert-name-thanosnoruleevaluations'
   113            summary: 'Thanos Rule did not perform any rule evaluations.'