Skip to content
Snippets Groups Projects

List all alertnames in rules on the k8s cluster

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Sheogorath

    Outputs a list with all your prometheus-operator defined alerts. Very nice to validate the coverage of your runbooks.

    alertnames.sh 159 B
    #!/bin/sh
    
    kubectl get prometheusrules.monitoring.coreos.com -A -o json | jq '.items[].spec.groups[].rules[].alert' --raw-output | grep -v 'null' | sort | uniq
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment