update exporter conf for mongoDB and mysql
This commit is contained in:
parent
78bceb35f7
commit
e51e4ce7a0
@ -53,18 +53,18 @@
|
|||||||
notify:
|
notify:
|
||||||
- 'prometheus | mongodb exporter | restart service'
|
- 'prometheus | mongodb exporter | restart service'
|
||||||
|
|
||||||
- name: 'prometheus | mongodb exporter | configuration'
|
|
||||||
template:
|
|
||||||
src: conf/mongodb-exporter.conf.j2
|
|
||||||
dest: /etc/mongodb-exporter.conf
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0600
|
|
||||||
notify:
|
|
||||||
- 'prometheus | mongodb exporter | restart service'
|
|
||||||
|
|
||||||
- name: 'prometheus | mongodb exporter | configure systemd to use service'
|
- name: 'prometheus | mongodb exporter | configure systemd to use service'
|
||||||
systemd:
|
systemd:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
enabled: yes
|
enabled: yes
|
||||||
name: prometheus-mongodb-exporter.service
|
name: prometheus-mongodb-exporter.service
|
||||||
|
|
||||||
|
- name: 'prometheus | mongodb exporter | configuration'
|
||||||
|
template:
|
||||||
|
src: conf/prometheus-mongodb-exporter.j2
|
||||||
|
dest: /etc/default/prometheus-mongodb-exporter
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0600
|
||||||
|
notify:
|
||||||
|
- 'prometheus | mongodb exporter | restart service'
|
||||||
|
@ -44,20 +44,12 @@
|
|||||||
name: prometheus-postgres-exporter.service
|
name: prometheus-postgres-exporter.service
|
||||||
|
|
||||||
- name: 'prometheus | postgres exporter | configuration'
|
- name: 'prometheus | postgres exporter | configuration'
|
||||||
copy:
|
template:
|
||||||
dest: '/etc/default/prometheus-postgres-exporter'
|
src: conf/prometheus-postgres-exporter.j2
|
||||||
|
dest: /etc/default/prometheus-postgres-exporter
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0600
|
||||||
backup: yes
|
|
||||||
content: |
|
|
||||||
DATA_SOURCE_NAME='postgresql://{{ prometheus_exporter_postgresql_user }}:{{ prometheus_exporter_postgresql_password }}@{{ prometheus_exporter_postgresql_host }}:{{prometheus_exporter_postgresql_port }}/''
|
|
||||||
ARGS=''
|
|
||||||
when:
|
|
||||||
- prometheus_postgres_exporter_user is defined
|
|
||||||
- prometheus_postgres_exporter_password is defined
|
|
||||||
- prometheus_postgres_exporter_host is defined
|
|
||||||
- prometheus_postgres_exporter_port is defined
|
|
||||||
register: prometheu_postgres_exporter_configuration
|
register: prometheu_postgres_exporter_configuration
|
||||||
notify:
|
notify:
|
||||||
- 'prometheus | postgres exporter | restart service'
|
- 'prometheus | postgres exporter | restart service'
|
||||||
|
2
templates/conf/prometheus-postgres-exporter.j2
Normal file
2
templates/conf/prometheus-postgres-exporter.j2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
DATA_SOURCE_NAME="user={{ prometheus_postgres_exporter_user|default("postgres") }} host={{ prometheus_postgres_exporter_host|default("/var/run/postgresql/") }} sslmode={{ prometheus_postgres_exporter_sslmode|default("disable") }}"
|
@ -5,7 +5,7 @@ After=network.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/local/bin/prometheus-mongodb-exporter
|
ExecStart=/usr/local/bin/prometheus-mongodb-exporter
|
||||||
EnvironmentFile=/etc/mongodb-exporter.conf
|
EnvironmentFile=/etc/default/prometheus-mongodb-exporter
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Prometheus PostgreSQL Exporter
|
Description=Prometheus PostgreSQL Exporter
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
User={{ prometheus_postgres_exporter_user|default("postgres") }}
|
||||||
ExecStart=/usr/local/bin/prometheus-postgres-exporter
|
ExecStart=/usr/local/bin/prometheus-postgres-exporter
|
||||||
|
EnvironmentFile=/etc/default/prometheus-postgres-exporter
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Loading…
x
Reference in New Issue
Block a user