Mercurial > code > home > repos > victoriametrics
diff next/create_scrape_configs.py @ 62:8134cd480817
make next/ a complete standalone setup dir- no deps on ./
author | drewp@bigasterisk.com |
---|---|
date | Thu, 02 May 2024 20:33:29 -0700 |
parents | config/create_scrape_configs.py@fb0519859645 |
children | def1aa2bfa3f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/next/create_scrape_configs.py Thu May 02 20:33:29 2024 -0700 @@ -0,0 +1,104 @@ +from pathlib import Path + +from scrape_job import jobConfig, scrape_deployments, writeJobConfigs +import private + + + + +# previously this used `kubernetes_sd_configs: [{ role: node }]` +all_hosts = [ + 'dash', + 'ditto', + # 'ws-printer', + #todo: +] + +smartctl_hosts = [ + # ideally, all nodes with disks, but many turn off and on + 'dash', + 'ditto', +] + +ping_hosts = [ + # printer, since it falls out of ntop with no traffic at all. Or, we could poll ink status at http://printer/general/status.html?pageid=1 + 'printer', + # wireguard connection test + 'prime5', + # after pyinfra or reboot, seems to lose wg0 address + 'garage5', +] + +deploy_doesnt_serve_metrics = [ + 'apprise', + 'bitwarden', + 'digi-files', + 'digi-pose-predict', + 'digi-tts-mimic', + 'dovecot', + 'front-door-display', + 'hass', + 'homepage', + 'itch150', + 'kallithea', + 'kube-web-view', + 'magma', + 'megasecond', + 'minecraft-build-world', + 'minecraft-lake-world', + 'minecraft-smp-world', + 'mongodb', + 'mqtt1', + 'mqtt2', + 'nodered', + 'photoprism', + 'plik', + 'projects', + 'registry', + 'registry-ui', + 'speakerphone', + 'video', + 'video-files', + 'zigbee2mqtt', +] + +forever_jobs = [ + jobConfig(name='maildir-count', targets=['prime:2500']), + jobConfig(name='mongodb', targets=['mongodb:9216']), + jobConfig(name='net-traffic', targets=['pipe:8080']), + jobConfig(name='ping', targets=ping_hosts, scrape_interval='2m', ping_job=True), + jobConfig(name='power-eagle', targets=['power-eagle:80'], scrape_interval='8s'), # from powerEagle/private_config.periodSec + jobConfig(name='powermeter-exporter', targets=['powermeter-exporter'], scrape_interval='10s'), + jobConfig(name='smartctl', targets=[f'{h}:9633' for h in smartctl_hosts]), + jobConfig(name='wifi', targets=['wifi:80']), + jobConfig(name='zfs-exporter', targets=['ditto:9634']), + jobConfig(name='zigbee2mqtt-exporter', targets=['zigbee2mqtt-exporter:80']), + jobConfig(name='zpool-exporter', targets=['ditto:9986']), + jobConfig(name='octoprint', targets=['octoprint'], + metrics_path='/plugin/prometheus_exporter/metrics', + params={'apikey' : [private.octoprint_apikey]}, + ), +] # yapf: disable + +recent_jobs = [ + jobConfig( name="telegraf", targets=[f'{h}:9273' for h in all_hosts]), + jobConfig( name="filebeat", targets=[f'{h}:5067' for h in all_hosts]), + jobConfig( name="net-routes", targets=['pipe:9999']), + jobConfig( name="net-traffic", targets=['pipe:8080']), + jobConfig( name="dnsmasq-log", targets=['pipe:9991']), + jobConfig( + name="racc", + scrape_interval='30s', + targets=[ + # - dash:5150 + # - dot:5150 + # - squib:5150 + # - ashermac:5150 + ], + ), +] # yapf: disable +recent_jobs.extend(scrape_deployments(deploy_doesnt_serve_metrics, forever_jobs)) + +top = Path('build/scrape_config') +writeJobConfigs(top, forever_jobs, 'forever') +writeJobConfigs(top, recent_jobs, 'recent')