新增部署Prometheus监控工具脚本;更新README.md文件
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /tmp/positions.yaml
|
||||
|
||||
clients:
|
||||
- url: http://{{ groups.server.0 }}:{{ loki.port }}/loki/api/v1/push
|
||||
|
||||
scrape_configs:
|
||||
{% for node in promtail.nodes -%}
|
||||
{% if node.host == inventory_hostname -%}
|
||||
{% for target in node.targets -%}
|
||||
- job_name: {{ target.name }}
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: {{ target.name }}
|
||||
__path__: {{ target.path }}/*log
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
27
prometheus/roles/promtail/templates/docker-compose.yml.j2
Normal file
27
prometheus/roles/promtail/templates/docker-compose.yml.j2
Normal file
@@ -0,0 +1,27 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
promtail:
|
||||
image: {{ promtail.image }}
|
||||
container_name: {{ docker.network.name }}-promtail
|
||||
hostname: promtail
|
||||
restart: always
|
||||
networks:
|
||||
- {{ docker.network.name }}
|
||||
{% for node in promtail.nodes -%}
|
||||
{% if node.host == inventory_hostname -%}
|
||||
ports:
|
||||
- {{ node.port }}:9080
|
||||
volumes:
|
||||
- {{ promtail.dir.conf }}/promtail-config.yaml:/etc/promtail/promtail-config.yaml
|
||||
{% for target in node.targets -%}
|
||||
- {{ target.path }}:{{ target.path }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
command: "-config.file=/etc/promtail/promtail-config.yaml"
|
||||
|
||||
networks:
|
||||
{{ docker.network.name }}:
|
||||
external: true
|
||||
name: {{ docker.network.name }}
|
||||
Reference in New Issue
Block a user