From 8a18c92730504a4e34a41c1ef0ab254c9b035ace Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 26 Dec 2020 09:44:04 -0600 Subject: [PATCH] roles/collectd-prometheus: Configure plugin The *collectd-prometheus* role configures the *write_prometheus* plugin for collectd. This plugin exposes data collected or received by the collectd process in the Prometheus Exposition Format over HTTP. It provides the same functionality as the "official" collectd Exporter maintained by the Prometheus team, but integrates natively into the collectd process, and is much more complete. The main intent of this role is to provide a mechanism to combine the collectd data from all Pyrocufflink hosts and insert it into Prometheus. By configuring the collectd instance on the Prometheus server itself to enable and use the *write_prometheus* plugin and to receive the multicast data from other hosts, collectd itself provides the desired functionality. --- roles/collectd-prometheus/defaults/main.yml | 2 ++ .../files/collectd-local.pp | Bin 0 -> 892 bytes roles/collectd-prometheus/handlers/main.yml | 8 +++++ roles/collectd-prometheus/tasks/main.yml | 34 ++++++++++++++++++ .../templates/collectd-prometheus.conf.j2 | 10 ++++++ roles/collectd-prometheus/vars/defaults.yml | 1 + 6 files changed, 55 insertions(+) create mode 100644 roles/collectd-prometheus/defaults/main.yml create mode 100644 roles/collectd-prometheus/files/collectd-local.pp create mode 100644 roles/collectd-prometheus/handlers/main.yml create mode 100644 roles/collectd-prometheus/tasks/main.yml create mode 100644 roles/collectd-prometheus/templates/collectd-prometheus.conf.j2 create mode 100644 roles/collectd-prometheus/vars/defaults.yml diff --git a/roles/collectd-prometheus/defaults/main.yml b/roles/collectd-prometheus/defaults/main.yml new file mode 100644 index 0000000..30a73ea --- /dev/null +++ b/roles/collectd-prometheus/defaults/main.yml @@ -0,0 +1,2 @@ +collectd_load_prometheus_plugin: true +collectd_prometheus_port: 9103 diff --git a/roles/collectd-prometheus/files/collectd-local.pp b/roles/collectd-prometheus/files/collectd-local.pp new file mode 100644 index 0000000000000000000000000000000000000000..4695d7b181cf49fb616da32291e44dfea1b9ffe6 GIT binary patch literal 892 zcmb`FK?(vf3`M^RA}&<$0$xDT8@O?&D-SSe?LsY9oDR5{D~RWvmGZU0P@IkUAT&+W zpS0xuD60kl+5o`qQC58b>&0lfKNZ)}%I^win*fG*(}`;jfbq^*6Lw?g&BnC=%qG)$ zOwdS;ZVYlyQ5p&6oaNpeZD_}CHpbZVYsVb7&x1XQ3R|F0{Pti?$S%5SoiFHf(PU@h zi?+^_r)EJ^>PS_Hj!~5+Rb+#D|bS{0G)R6U;93j0cP&=(B{ng$1SNvb_ a4V;9}JTjt + Port {{ collectd_prometheus_port }} +{% if collectd_prometheus_host is defined %} + Host "{{ collectd_prometheus_host }}" +{% endif %} + diff --git a/roles/collectd-prometheus/vars/defaults.yml b/roles/collectd-prometheus/vars/defaults.yml new file mode 100644 index 0000000..ec78586 --- /dev/null +++ b/roles/collectd-prometheus/vars/defaults.yml @@ -0,0 +1 @@ +collectd_prometheus_package: collectd-write_prometheus