Use Grafana's upstream Debian packages for promtail
Migration playbook:
- name: Cleanup old promtail install
hosts: all
tasks:
- name: Stop and disable old service
when: prometheus_agent.agents.promtail.enable
service:
name: grafana-promtail
state: stopped
enabled: false
- name: Migrate state dir
when: prometheus_agent.agents.promtail.enable
copy:
src: /var/lib/grafana-promtail/
dest: /var/lib/promtail/
remote_src: yes
- name: Uninstall old package
when: prometheus_agent.agents.promtail.enable
apt:
name: grafana-promtail
state: absent
purge: true # Removes user, group and /var/lib/grafana-promtail
- name: create promtail group
when: prometheus_agent.agents.promtail.enable
group:
name: promtail
system: true
- name: create promtail user
when: prometheus_agent.agents.promtail.enable
user:
name: promtail
system: true
group: promtail
home: /var/lib/promtail
- name: Fix state dir owner and group
when: prometheus_agent.agents.promtail.enable
file:
name: /var/lib/promtail/
state: directory
recurse: true
owner: promtail
group: promtail
This commit is contained in:
parent
dfa8092538
commit
c236bb61a4
3 changed files with 27 additions and 10 deletions
|
|
@ -1,44 +0,0 @@
|
|||
server:
|
||||
disable: true
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /var/lib/grafana-promtail/positions.yaml
|
||||
|
||||
clients:
|
||||
{% for i in prometheus_agent.scrapers if prometheus_agent.scrapers[i].get("loki") %}
|
||||
{% set lokiconfig = {}|combine({ "external_labels": merged_prometheus_labels|combine( {"instance": inventory_hostname} ) }, prometheus_agent.scrapers[i]['loki'] ) %}
|
||||
- {{ lokiconfig|to_json }}
|
||||
{% endfor %}
|
||||
|
||||
scrape_configs:
|
||||
- job_name: system
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: varlogs
|
||||
__path__: /var/log/*log
|
||||
- job_name: journal
|
||||
journal:
|
||||
max_age: 12h
|
||||
labels:
|
||||
job: systemd-journal
|
||||
relabel_configs:
|
||||
- source_labels: ['__journal__systemd_unit']
|
||||
target_label: 'unit'
|
||||
- job_name: nginx
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: nginx
|
||||
__path__: /var/log/nginx/access-promtail.log
|
||||
- job_name: postfix-bounces
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: postfix-bounces
|
||||
__path__: /var/log/mailman3/bounce.log
|
||||
Loading…
Add table
Add a link
Reference in a new issue