Skip to content

Commit 3ed3e81

Browse files
dougszumskijovial
authored andcommitted
Support monitoring Fluentd with Prometheus
This patch adds support for integrating Prometheus with Fluentd. This can be used to extract useful information about the status of Fluentd, such as output buffer capacity and logging rate, and also to extract metrics from logs via custom Fluentd configuration. More information can be found here in [1]. [1] https://docs.fluentd.org/monitoring-fluentd/monitoring-prometheus Change-Id: I233d6dd744848ef1f1589a462dbf272ed0f3aaae (cherry picked from commit b692ce7)
1 parent 552a5c5 commit 3ed3e81

File tree

6 files changed

+58
-10
lines changed

6 files changed

+58
-10
lines changed

ansible/group_vars/all.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ prometheus_memcached_exporter_port: "9150"
457457
prometheus_rabbitmq_exporter_port: "15692"
458458
# Default cadvisor port of 8080 already in use
459459
prometheus_cadvisor_port: "18080"
460+
prometheus_fluentd_integration_port: "24231"
460461

461462
# Prometheus alertmanager ports
462463
prometheus_alertmanager_port: "9093"
@@ -1106,6 +1107,7 @@ enable_prometheus_mysqld_exporter: "{{ enable_mariadb | bool }}"
11061107
enable_prometheus_node_exporter: "{{ enable_prometheus | bool }}"
11071108
enable_prometheus_memcached_exporter: "{{ enable_memcached | bool }}"
11081109
enable_prometheus_cadvisor: "{{ enable_prometheus | bool }}"
1110+
enable_prometheus_fluentd_integration: "{{ enable_prometheus | bool and enable_fluentd | bool }}"
11091111
enable_prometheus_alertmanager: "{{ enable_prometheus | bool }}"
11101112
enable_prometheus_ceph_mgr_exporter: "no"
11111113
enable_prometheus_openstack_exporter: "{{ enable_prometheus | bool }}"

ansible/roles/common/tasks/config.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,29 @@
114114
( not enable_monasca | bool or not monasca_ingest_control_plane_logs | bool ) }}
115115
fluentd_version: "{{ fluentd_labels.images.0.ContainerConfig.Labels.fluentd_version | default('0.12') }}"
116116
# Inputs
117-
fluentd_input_files: "{{ default_input_files | customise_fluentd(customised_input_files) }}"
117+
fluentd_input_files: "{{ default_input_files_enabled | customise_fluentd(customised_input_files) }}"
118+
default_input_files_enabled: "{{ default_input_files | selectattr('enabled') | map(attribute='name') | list }}"
118119
default_input_files:
119-
- "conf/input/00-global.conf.j2"
120-
- "conf/input/01-syslog.conf.j2"
121-
- "conf/input/02-mariadb.conf.j2"
122-
- "conf/input/03-rabbitmq.conf.j2"
123-
- "conf/input/04-openstack-wsgi.conf.j2"
124-
- "conf/input/05-libvirt.conf.j2"
125-
- "conf/input/06-zookeeper.conf.j2"
126-
- "conf/input/07-kafka.conf.j2"
127-
- "conf/input/09-monasca.conf.j2"
120+
- name: "conf/input/00-global.conf.j2"
121+
enabled: true
122+
- name: "conf/input/01-syslog.conf.j2"
123+
enabled: true
124+
- name: "conf/input/02-mariadb.conf.j2"
125+
enabled: true
126+
- name: "conf/input/03-rabbitmq.conf.j2"
127+
enabled: true
128+
- name: "conf/input/04-openstack-wsgi.conf.j2"
129+
enabled: true
130+
- name: "conf/input/05-libvirt.conf.j2"
131+
enabled: true
132+
- name: "conf/input/06-zookeeper.conf.j2"
133+
enabled: true
134+
- name: "conf/input/07-kafka.conf.j2"
135+
enabled: true
136+
- name: "conf/input/08-prometheus.conf.j2"
137+
enabled: "{{ enable_prometheus_fluentd_integration | bool }}"
138+
- name: "conf/input/09-monasca.conf.j2"
139+
enabled: true
128140
customised_input_files: "{{ find_custom_fluentd_inputs.files | map(attribute='path') | list }}"
129141
# Filters
130142
fluentd_filter_files: "{{ default_filter_files | customise_fluentd(customised_filter_files) }}"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<source>
2+
@type prometheus
3+
bind {{ api_interface_address }}
4+
port {{ prometheus_fluentd_integration_port }}
5+
metrics_path /metrics
6+
</source>
7+
8+
<source>
9+
@type prometheus_output_monitor
10+
interval 10
11+
<labels>
12+
Hostname ${hostname}
13+
</labels>
14+
</source>

ansible/roles/prometheus/templates/prometheus.yml.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ scrape_configs:
7474
{% endfor %}
7575
{% endif %}
7676

77+
{% if enable_prometheus_fluentd_integration | bool %}
78+
- job_name: fluentd
79+
static_configs:
80+
- targets:
81+
{% for host in groups['fluentd'] %}
82+
- '{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_fluentd_integration_port'] }}'
83+
{% endfor %}
84+
{% endif %}
85+
7786
{% if enable_prometheus_ceph_mgr_exporter | bool %}
7887
- job_name: ceph_mgr_exporter
7988
honor_labels: true

etc/kolla/globals.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@
711711
#enable_prometheus_mysqld_exporter: "{{ enable_mariadb | bool }}"
712712
#enable_prometheus_node_exporter: "{{ enable_prometheus | bool }}"
713713
#enable_prometheus_cadvisor: "{{ enable_prometheus | bool }}"
714+
#enable_prometheus_fluentd_integration: "{{ enable_prometheus | bool and enable fluentd | bool }}"
714715
#enable_prometheus_memcached: "{{ enable_prometheus | bool }}"
715716
#enable_prometheus_alertmanager: "{{ enable_prometheus | bool }}"
716717
#enable_prometheus_ceph_mgr_exporter: "no"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
features:
3+
- |
4+
Adds support for integrating Fluentd metrics into Prometheus. By
5+
default this is now enabled when Prometheus is enabled. This behaviour
6+
can be overridden via the `enable_prometheus_fluentd_integration` flag. By
7+
default the integration provides metrics relating to the processing of logs
8+
by Fluentd. These metrics can be useful for monitoring the status of the
9+
Fluentd service. Additional metrics can also be extracted from logs via
10+
custom Fluentd config.

0 commit comments

Comments
 (0)