Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend remote write options and add read read option. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions prometheus/files/server/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,102 @@ remote_write:
{%- if remote_endpoint.get('enabled', True) %}
# {{ name }}
- url: {{ remote_endpoint.url }}
{%- if remote_endpoint.write_relabel_configs is defined %}
write_relabel_configs:
{%- for conf in remote_endpoint.write_relabel_configs%}
- source_labels: {{conf["source_labels"]}}
{%- if 'separator' in conf.keys() %}
separator: {{conf['separator']}}
{%- endif %}
{%- if 'target_label' in conf.keys() %}
target_label: {{conf['target_label']}}
{%- endif %}
{%- if 'regex' in conf.keys() %}
regex: {{conf['regex']}}
{%- endif %}
{%- if 'modulus' in conf.keys() %}
modulus: {{conf['modulus']}}
{%- endif %}
{%- if 'replacement' in conf.keys() %}
{%- if conf['replacement'] == '' %}
replacement: ''
{%- else %}
replacement: {{conf['replacement']}}
{%- endif %}
{%- endif %}
{%- if 'action' in conf.keys() %}
action: {{conf['action']}}
{%- endif %}
{%- endfor %}
{%- if remote_endpoint.basic_auth is defined %}
basic_auth:
username: {{remote_endpoint.basic_auth.username}}
password: {{remote_endpoint.basic_auth.password}}
{%- endif %}
{%- if remote_endpoint.bearer_token is defined %}
bearer_token: {{remote_endpoint.bearer_token}}
{%- endif %}
{%- if remote_endpoint.bearer_token_file is defined %}
bearer_token_file: {{remote_endpoint.bearer_token_file}}
{%- endif %}
{%- if remote_endpoint.tls_config is defined %}
tls_config:
ca_file: {{remote_endpoint.tls_config.ca_file}}
cert_file: {{remote_endpoint.tls_config.cert_file}}
key_file: {{remote_endpoint.tls_config.key_file}}
server_name: {{remote_endpoint.tls_config.server_name}}
insecure_skip_verify: {{remote_endpoint.tls_config.insecure_skip_verify}}
{%- endif %}
{%- if remote_endpoint.proxy_url is defined %}
proxy_url: {{remote_endpoint.proxy_url}}
{%- endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}

{%- if server.get('config', {}).get('remote_read') %}
remote_read:
{%- for name, remote_endpoint in server.config.remote_read.iteritems() %}
{%- if remote_endpoint.get('enabled', True) %}
# {{ name }}
- url: {{ remote_endpoint.url }}
{%- if remote_endpoint.required_matchers is defined %}
required_matchers: {{remote_endpoint.required_matchers}}
{%- endif %}
{%- if remote_endpoint.remote_timeout is defined %}
remote_timeout: {{remote_endpoint.remote_timeout}}
{%- endif %}
{%- if remote_endpoint.read_recent is defined %}
read_recent: {{remote_endpoint.read_recent}}
{%- endif %}
{%- if remote_endpoint.basic_auth is defined %}
basic_auth:
username: {{remote_endpoint.basic_auth.username}}
password: {{remote_endpoint.basic_auth.password}}
{%- endif %}
{%- if remote_endpoint.bearer_token is defined %}
bearer_token: {{remote_endpoint.bearer_token}}
{%- endif %}
{%- if remote_endpoint.bearer_token_file is defined %}
bearer_token_file: {{remote_endpoint.bearer_token_file}}
{%- endif %}
{%- if remote_endpoint.tls_config is defined %}
tls_config:
ca_file: {{remote_endpoint.tls_config.ca_file}}
cert_file: {{remote_endpoint.tls_config.cert_file}}
key_file: {{remote_endpoint.tls_config.key_file}}
server_name: {{remote_endpoint.tls_config.server_name}}
insecure_skip_verify: {{remote_endpoint.tls_config.insecure_skip_verify}}
{%- endif %}
{%- if remote_endpoint.proxy_url is defined %}
proxy_url: {{remote_endpoint.proxy_url}}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}


rule_files:
- alerts.yml

Expand Down