Mercurial > code > home > repos > victoriametrics
view next/tasks.py @ 66:429bfd62e6ba
clean out old config; move remaining bits into next/
author | drewp@bigasterisk.com |
---|---|
date | Fri, 03 May 2024 11:19:50 -0700 |
parents | def1aa2bfa3f |
children |
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("next-victoriametrics-config", map) refreshPodCmaps(firstPodName("app=next-victoriametrics-forever-vmagent")) refreshPodCmaps(firstPodName("app=next-victoriametrics-recent-vmagent"))