Skip to content

Instantly share code, notes, and snippets.

@conr
Last active December 6, 2017 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conr/9104e930e53c4d7af55aaaa25bcfc724 to your computer and use it in GitHub Desktop.
Save conr/9104e930e53c4d7af55aaaa25bcfc724 to your computer and use it in GitHub Desktop.
Little script I use for appending a tonne of dummy scrape configs to the end of a prometheus.yml configuration file.
from jinja2 import Template
file = open('prometheus.yml', 'a')
templ = Template(u'''\
- job_name: {{ name }}
metrics_path: /export
params:
command: [check_load]
static_configs:
- targets:
- '127.0.0.1:5666'
- 'drop_me'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- source_labels: [__param_target]
target_label: testLabel
- source_labels: [__address__]
regex: 'drop_me'
action: drop
''')
for i in xrange(1,10000):
print templ.render(
name="nrpe" + str(i)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment