Skip to content

Instantly share code, notes, and snippets.

@guangbochen
Last active July 24, 2020 05:49
Show Gist options
  • Save guangbochen/4e9ca45037efedc698ac5486fc45aea7 to your computer and use it in GitHub Desktop.
Save guangbochen/4e9ca45037efedc698ac5486fc45aea7 to your computer and use it in GitHub Desktop.
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
cattle.io/creator: norman
source: rancher-alert
name: michelia-test
namespace: cattle-prometheus
spec:
groups:
- name: c-7nw2m:cag-8r7xg
rules:
- alert: michelia
annotations:
current_value: '{{ .Value }}'
test_ann: test_ann_value # 1. 支持添加自定义的annotations
expr: sum(container_cpu_cfs_periods_total)>0
for: 10s
labels: # Note: 默认的labels与annotations不可修改,主要是为了规避用户自定义输入引入的不可知问题
group_id: c-7nw2m:cag-8r7xg
rule_id: c-7nw2m:cag-8r7xg_car-zscnr
alert_name: michelia
alert_type: metric
cluster_name: 'clcos (ID: c-7nw2m)'
comparison: greater than
duration: 10s
expression: sum(container_cpu_cfs_periods_total)>0
severity: critical
test: test # 2. 支持添加自定义的labels
threshold_value: "0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment