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.
35 lines
811 B
YAML
35 lines
811 B
YAML
- name: load distribution-specific values
|
|
include_vars: '{{ item }}'
|
|
with_first_found:
|
|
- '{{ ansible_distribution }}.yml'
|
|
- defaults.yml
|
|
tags:
|
|
- always
|
|
|
|
- name: ensure collectd write_prometheus plugin is installed
|
|
package:
|
|
name: '{{ collectd_prometheus_package }}'
|
|
state: present
|
|
when: collectd_prometheus_package is not none
|
|
tags:
|
|
- install
|
|
|
|
- name: ensure collectd-local selinux module is installed
|
|
copy:
|
|
src: collectd-local.pp
|
|
dest: /var/lib/selinux/collectd-local.pp
|
|
notify:
|
|
- install collectd-local selinux module
|
|
tags:
|
|
- selinux
|
|
|
|
- name: ensure collectd write_prometheus plugin is configured
|
|
template:
|
|
src: collectd-prometheus.conf.j2
|
|
dest: /etc/collectd.d/prometheus.conf
|
|
mode: '0644'
|
|
notify:
|
|
- restart collectd
|
|
tags:
|
|
- collectd-config
|