Mercurial > code > home > repos > victoriametrics
view tasks.py @ 49:febc20caabcb
more alerts
author | drewp@bigasterisk.com |
---|---|
date | Sun, 10 Mar 2024 14:49:32 -0700 |
parents | 3b91d52b007d |
children | 21185db8a52e |
line wrap: on
line source
import yaml from invoke import task from kubernetes import config import alert_rules from k8s_ops import firstPodName, refreshPodCmaps, replaceCmap config.load_kube_config() @task def push_config(ctx): configObj = scrapeConfig(ctx) rulesObj = alert_rules.allRules(ctx) replaceCmap("victoriametrics-config", {"scrape_main": configObj, "rules": rulesObj}) # these don't give errors on rules format! they just quietly keep the old # rules! use `skaffold run` to get errs. # # or run # validateTemplates = flag.Bool("rule.validateTemplates", true, "Whether to validate annotation and label templates") # validateExpressions = flag.Bool("rule.validateExpressions", true, "Whether to validate rules expressions via MetricsQL engine") refreshPodCmaps(firstPodName("app=victoriametrics")) refreshPodCmaps(firstPodName("app=vmalert")) # If the VM reloader isn't fast enough, we could do this too: # hup(ctx, 'deploy/victoriametrics', 'victoria-metrics-prod') def scrapeConfig(ctx): return yaml.load(open("config/scrape_main.yaml"), yaml.FullLoader)