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.jenkins-master
parent
b6650e4067
commit
8a18c92730
|
@ -0,0 +1,2 @@
|
||||||
|
collectd_load_prometheus_plugin: true
|
||||||
|
collectd_prometheus_port: 9103
|
Binary file not shown.
|
@ -0,0 +1,8 @@
|
||||||
|
- name: install collectd-local selinux module
|
||||||
|
command:
|
||||||
|
semodule -i /var/lib/selinux/collectd-local.pp
|
||||||
|
|
||||||
|
- name: restart collectd
|
||||||
|
service:
|
||||||
|
name: collectd
|
||||||
|
state: restarted
|
|
@ -0,0 +1,34 @@
|
||||||
|
- 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
|
|
@ -0,0 +1,10 @@
|
||||||
|
{% if collectd_load_prometheus_plugin %}
|
||||||
|
LoadPlugin write_prometheus
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
<Plugin write_prometheus>
|
||||||
|
Port {{ collectd_prometheus_port }}
|
||||||
|
{% if collectd_prometheus_host is defined %}
|
||||||
|
Host "{{ collectd_prometheus_host }}"
|
||||||
|
{% endif %}
|
||||||
|
</Plugin>
|
|
@ -0,0 +1 @@
|
||||||
|
collectd_prometheus_package: collectd-write_prometheus
|
Loading…
Reference in New Issue