Last active
December 6, 2017 10:57
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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