comparison tasks.py @ 15:2c37fab420da

rm dead code
author drewp@bigasterisk.com
date Fri, 23 Jun 2023 23:53:13 -0700
parents b6720e379d5b
children f5777b65f035
comparison
equal deleted inserted replaced
14:35cf43082d83 15:2c37fab420da
37 for workaround in [1]: 37 for workaround in [1]:
38 print(' -> status', 38 print(' -> status',
39 urllib.request.urlopen(reload_url, data=b'unused').status) 39 urllib.request.urlopen(reload_url, data=b'unused').status)
40 time.sleep(0) 40 time.sleep(0)
41 41
42
43 def httpsCertProber():
44 domains = []
45 for line in open(
46 '/my/doc/ssl/letsencrypt/run.py'): # moved to cert-manager
47 if line.startswith('update_certs('):
48 domains.append(line.split("'")[1])
49 relabel = {
50 'relabel_configs': [{
51 'source_labels': ['__address__'],
52 'target_label': '__param_target'
53 }, {
54 'source_labels': ['__param_target'],
55 'target_label': 'instance'
56 }, {
57 'target_label': '__address__',
58 'replacement': 'prober'
59 }]
60 }
61 return yaml.dump( # Note that an included file must skip the scrape_configs toplevel key and just include the list.
62 [{
63 'job_name': 'prober',
64 'scrape_interval': '24h',
65 'metrics_path': '/probe',
66 'params': {
67 'module': ['https']
68 },
69 'static_configs': [{
70 'targets': domains
71 }],
72 } | relabel])
73 42
74 43
75 def hostsExpectedOnline(ctx): 44 def hostsExpectedOnline(ctx):
76 return ctx.run( 45 return ctx.run(
77 'cd /my/serv/lanscape; pdm run python hosts_expected_online.py').stdout 46 'cd /my/serv/lanscape; pdm run python hosts_expected_online.py').stdout