Skip to content

Instantly share code, notes, and snippets.

@FUSAKLA
Last active November 23, 2020 06:44
Show Gist options
  • Save FUSAKLA/ac72683b5b4f5b604161f1af9dffba1a to your computer and use it in GitHub Desktop.
Save FUSAKLA/ac72683b5b4f5b604161f1af9dffba1a to your computer and use it in GitHub Desktop.
promruval severity example
validationRules:
- name: check-severity-label
scope: Alert # Defines which rule types should be validated by this rule.
validations:
- type: hasLabels # Name of the validation check.
params: # Each validation check has its own params depending on the type.
labels: [ "severity" ]
- type: labelHasAllowedValue
params:
label: "severity"
allowedValues: [ "info", "warning", "critical" ]
- name: check-playbook-annotation
scope: Alert
validations:
- type: hasAnnotations
params:
annotations: [ "playbook", "title"]
- type: annotationIsValidURL
params:
annotation: "playbook"
resolveUrl: true # Actually makes HTTP request anch checks for 404 status code.
- name: check-prometheus-limitations
scope: All rules
validations:
- type: expressionDoesNotUseOlderDataThan
params:
limit: "5d" # Parses the PromQL and checks all range selectors, offsets and subqueries.
- type: expressionDoesNotUseLabels
params:
labels: [ "cluster", "dc" ] # Parses the PromQL and checks if the labels are not used in selectors, grouping or joining metrics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment