Interview Prep/SRE & Reliability/Best Practices & Rapid-Fire Commands

Rapid-fire: Prometheus and promtool commands every SRE should know.

BeginnerConceptBest Practices & Rapid-Fire Commands
Answer
promtool check rules slo-rules.yaml                 # syntax and validity
promtool test rules slo-rules.test.yaml             # unit test alerts
promtool check config prometheus.yml
promtool query instant http://localhost:9090 'slo:sli_error:ratio_rate1h'
curl -s localhost:9090/api/v1/rules | jq '.data.groups[].name'
curl -s localhost:9090/api/v1/alerts | jq '.data.alerts[] | {alertname: .labels.alertname, state}'
curl -X POST localhost:9090/-/reload                # needs --web.enable-lifecycle
All SRE & Reliability questions

More on Best Practices & Rapid-Fire Commands