Mercurial > code > home > repos > victoriametrics
view next/tasks.py @ 64:def1aa2bfa3f
more targets polish. reorg code into next/
author | drewp@bigasterisk.com |
---|---|
date | Thu, 02 May 2024 23:06:31 -0700 |
parents | 8134cd480817 |
children | 429bfd62e6ba |
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_2024(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("next-victoriametrics-config", map) refreshPodCmaps(firstPodName("app=next-victoriametrics-forever-vmagent")) refreshPodCmaps(firstPodName("app=next-victoriametrics-recent-vmagent"))