add role for victoriametrics v1.71.0

This commit is contained in:
ikerbs
2021-12-22 15:03:21 +03:00
commit 153d45afab
17 changed files with 474 additions and 0 deletions

View File

@ -0,0 +1,50 @@
# https://docs.victoriametrics.com/
#
# https://github.com/VictoriaMetrics/VictoriaMetrics/blob/cluster/deployment/docker/prometheus.yml
#
# Example to use vmagent with VictoriaMetrics Cluster
#
# global:
# scrape_interval: 1s
# evaluation_interval: 1s
#
# scrape_configs:
# - job_name: 'vmagent'
# static_configs:
# - targets: ['vmagent:8429']
# - job_name: 'vmalert'
# static_configs:
# - targets: ['vmalert:8880']
# - job_name: 'vminsert'
# static_configs:
# - targets: ['vminsert:8480']
# - job_name: 'vmselect'
# static_configs:
# - targets: ['vmselect:8481']
# - job_name: 'vmstorage'
# static_configs:
# - targets: ['vmstorage:8482']
#
# Example to use vmagent with VictoriaMetrics Single
{{ victoriametrics_vmagent_prometheus_config_combined }}
- job_name: 'vmagent'
static_configs:
- targets: ['127.0.0.1:8429']
- job_name: 'vminsert'
static_configs:
- targets:
{% for insert in groups[victoriametrics_vminsert_group] %}
- {{ hostvars[insert]['inventory_hostname'] }}:8480
{% endfor %}
- job_name: 'vmselect'
static_configs:
- targets:
{% for select in groups[victoriametrics_vmselect_group] %}
- {{ hostvars[select]['inventory_hostname'] }}:8481
{% endfor %}
- job_name: 'vmstorage'
static_configs:
- targets:
{% for storage in groups[victoriametrics_vmstorage_group] %}
- {{ hostvars[storage]['inventory_hostname'] }}:8482
{% endfor %}

View File

@ -0,0 +1,15 @@
# https://docs.victoriametrics.com/vmagent.html
#
# Example command line:
# /path/to/vmagent -promscrape.config=/path/to/prometheus.yml -remoteWrite.url=https://victoria-metrics-host:8428/api/v1/write
#
# Please note that to write scraped data from vmagent to VictoriaMetrics Cluster you should use url like in this example -remoteWrite.url=http://vminsert-ip:8480/insert/0/prometheus/ .
# See more information here https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format.
#
# If you only need to collect Influx data, then the following command is sufficient:
#
# /path/to/vmagent -remoteWrite.url=https://victoria-metrics-host:8428/api/v1/write
#
# Then send Influx data to http://vmagent-host:8429. See these https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf for more details.
ARGS="-promscrape.config={{ victoriametrics_vmagent_promscrape_config_file }} -remoteWrite.url={% for host in groups[victoriametrics_vmauth_group] %}http://{{ hostvars[host]['inventory_hostname'] }}:8427/api/v1/write{% if not loop.last %},{% endif %}{% endfor %} -remoteWrite.tmpDataPath={{ victoriametrics_vmagent_remoteWrite_tmpDataPath }} -remoteWrite.basicAuth.password=foobar,foobar,foobar -remoteWrite.basicAuth.username=foobar,foobar,foobar"

View File

@ -0,0 +1,92 @@
# # https://docs.victoriametrics.com/vmauth.html#auth-config
# # Arbitrary number of usernames may be put here.
# # Usernames must be unique.
# users:
# # Requests with the 'Authorization: Bearer XXXX' header are proxied to http://localhost:8428 .
# # For example, http://vmauth:8427/api/v1/query is proxied to http://localhost:8428/api/v1/query
# - bearer_token: "XXXX"
# url_prefix: "http://localhost:8428"
# # The user for querying local single-node VictoriaMetrics.
# # All the requests to http://vmauth:8427 with the given Basic Auth (username:password)
# # will be proxied to http://localhost:8428 .
# # For example, http://vmauth:8427/api/v1/query is proxied to http://localhost:8428/api/v1/query
# - username: "local-single-node"
# password: "***"
# url_prefix: "http://localhost:8428"
# # The user for querying local single-node VictoriaMetrics with extra_label team=dev.
# # All the requests to http://vmauth:8427 with the given Basic Auth (username:password)
# # will be routed to http://localhost:8428 with extra_label=team=dev query arg.
# # For example, http://vmauth:8427/api/v1/query is routed to http://localhost:8428/api/v1/query?extra_label=team=dev
# - username: "local-single-node"
# password: "***"
# url_prefix: "http://localhost:8428?extra_label=team=dev"
# # The user for querying account 123 in VictoriaMetrics cluster
# # See https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format
# # All the requests to http://vmauth:8427 with the given Basic Auth (username:password)
# # will be load-balanced among http://vmselect1:8481/select/123/prometheus and http://vmselect2:8481/select/123/prometheus
# # For example, http://vmauth:8427/api/v1/query is proxied to the following urls in a round-robin manner:
# # - http://vmselect1:8481/select/123/prometheus/api/v1/select
# # - http://vmselect2:8481/select/123/prometheus/api/v1/select
# - username: "cluster-select-account-123"
# password: "***"
# url_prefix:
# - "http://vmselect1:8481/select/123/prometheus"
# - "http://vmselect2:8481/select/123/prometheus"
# # The user for inserting Prometheus data into VictoriaMetrics cluster under account 42
# # See https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format
# # All the requests to http://vmauth:8427 with the given Basic Auth (username:password)
# # will be load-balanced between http://vminsert1:8480/insert/42/prometheus and http://vminsert2:8480/insert/42/prometheus
# # For example, http://vmauth:8427/api/v1/write is proxied to the following urls in a round-robin manner:
# # - http://vminsert1:8480/insert/42/prometheus/api/v1/write
# # - http://vminsert2:8480/insert/42/prometheus/api/v1/write
# - username: "cluster-insert-account-42"
# password: "***"
# url_prefix:
# - "http://vminsert1:8480/insert/42/prometheus"
# - "http://vminsert2:8480/insert/42/prometheus"
# # A single user for querying and inserting data:
# # - Requests to http://vmauth:8427/api/v1/query, http://vmauth:8427/api/v1/query_range
# # and http://vmauth:8427/api/v1/label/<label_name>/values are proxied to the following urls in a round-robin manner:
# # - http://vmselect1:8481/select/42/prometheus
# # - http://vmselect2:8481/select/42/prometheus
# # For example, http://vmauth:8427/api/v1/query is proxied to http://vmselect1:8480/select/42/prometheus/api/v1/query
# # or to http://vmselect2:8480/select/42/prometheus/api/v1/query .
# # - Requests to http://vmauth:8427/api/v1/write are proxied to http://vminsert:8480/insert/42/prometheus/api/v1/write
# - username: "foobar"
# url_map:
# - src_paths:
# - "/api/v1/query"
# - "/api/v1/query_range"
# - "/api/v1/label/[^/]+/values"
# url_prefix:
# - "http://vmselect1:8481/select/42/prometheus"
# - "http://vmselect2:8481/select/42/prometheus"
# - src_paths: ["/api/v1/write"]
# url_prefix: "http://vminsert:8480/insert/42/prometheus"
users:
{% for user in victoriametrics_vmauth_users %}
- username: {{ user.username }}
password: {{ user.password }}
url_map:
- src_paths:
- "/api/v1/query"
- "/api/v1/query_range"
- "/api/v1/label/[^/]+/values"
url_prefix:
{% for select in groups[victoriametrics_vmselect_group] %}
- "http://{{ hostvars[select]['inventory_hostname'] }}:8481/select/{{ user.id }}/prometheus"
{% endfor %}
- src_paths: ["/api/v1/write"]
url_prefix:
{% for insert in groups[victoriametrics_vminsert_group] %}
- "http://{{ hostvars[insert]['inventory_hostname'] }}:8480/insert/{{ user.id }}/prometheus"
{% endfor %}
{% endfor %}

View File

@ -0,0 +1,4 @@
# https://docs.victoriametrics.com/vmauth.html
#
ARGS="-auth.config={{ victoriametrics_vmauth_config_file }}"

View File

@ -0,0 +1,6 @@
# https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html
#
# https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#architecture-overview
#
#ARGS="-storageNode=127.0.0.1:8400"
ARGS="-storageNode={{ groups[victoriametrics_vmstorage_group] | map('extract', hostvars, ['inventory_hostname']) | join(':8400,') }}:8400 -replicationFactor={{ victoriametrics_vminsert_replication_factor }}"

View File

@ -0,0 +1,6 @@
# https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html
#
# https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#architecture-overview
#
#ARGS="-storageNode=127.0.0.1:8401"
ARGS="-storageNode={{ groups[victoriametrics_vmselect_group] | map('extract', hostvars, ['inventory_hostname']) | join(':8401,') }}:8401"

View File

@ -0,0 +1,5 @@
# https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html
#
# https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#architecture-overview
#
ARGS="-storageDataPath={{ victoriametrics_vmstorage_data_dir }}"