Mercurial > code > home > repos > victoriametrics
view tasks.py @ 68:c5e98d891638
remove 'next' prefix
author | drewp@bigasterisk.com |
---|---|
date | Fri, 03 May 2024 11:32:24 -0700 |
parents | adde35eb4773 |
children | 68164135ae66 |
line wrap: on
line source
from pathlib import Path import yaml from invoke import task from kubernetes import config import alert_rules from k8s_ops import firstPodName, refreshPodCmaps, replaceCmap config.load_kube_config() def scrapeConfig(fn): return yaml.load(open(fn), yaml.FullLoader) @task def push_config(ctx): # plan: # every discovered service may: # - be described here as a forever retention - ignore the discovery # - be blocked here as a no-metrics service - ignore the discovery # - be scraped as 'recent', with possible overrides of port/path # all per-node metrics shall be 'recent' (oops, not smartctl!) map: dict[str, object] = { 'rules': alert_rules.allRules(ctx), } top = Path('build/scrape_config') for p in top.glob('*.yaml'): map[str(p.relative_to(top))] = scrapeConfig(p) replaceCmap("victoriametrics-config", map) refreshPodCmaps(firstPodName("app=victoriametrics-forever-vmagent")) refreshPodCmaps(firstPodName("app=victoriametrics-recent-vmagent"))