Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature to include collectd plugin dependencies and configuration
- Loading branch information
1 parent
688f854
commit 229ae9e
Showing
6 changed files
with
458 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,225 @@ | ||
--- | ||
# defaults file for collectd | ||
collectd_settings: | ||
- parameter: Hostname | ||
value: "{{ ansible_hostname }}" | ||
collectd_conf_hostname: "{{ ansible_hostname }}" | ||
collectd_conf_fqdnlookup: "false" | ||
collectd_conf_basedir: /var/lib/collectd | ||
collectd_conf_pidfile: /var/run/collectd.pid | ||
collectd_conf_plugindir: /usr/lib64/collectd | ||
collectd_conf_typesdb: /usr/share/collectd/types.db | ||
|
||
collectd_plugins: | ||
- syslog | ||
collectd_conf_autoloadplugin: "false" | ||
collectd_conf_collectinternalstats: "false" | ||
|
||
collectd_conf_interval: 10 | ||
collectd_conf_maxreadinterval: 86400 | ||
collectd_conf_timeout: 2 | ||
collectd_conf_readthreads: 5 | ||
collectd_conf_writethreads: 5 | ||
|
||
collectd_conf_include_dir: /etc/collectd.d | ||
collectd_conf_fnmatch_filters: | ||
- "*.conf" | ||
|
||
#### Logging Configuration | ||
|
||
collectd_plugin_logging: syslog | ||
|
||
collectd_plugin_logging_directory: "/var/log/collectd" | ||
|
||
collectd_plugin_logfile_loglevel: "info" | ||
collectd_plugin_logfile_file: "{{ collectd_plugin_logging_directory }}/collectd.log" | ||
collectd_plugin_logfile_timestamp: "true" | ||
collectd_plugin_logfile_printseverity: "false" | ||
|
||
collectd_plugin_logstash_loglevel: "info" | ||
collectd_plugin_logstash_file: "{{ collectd_plugin_logging_directory }}/collectd.json.log" | ||
|
||
collectd_plugin_syslog_loglevel: "info" | ||
#collectd_plugin_syslog_notifylevel: "" | ||
|
||
# Use 'collectd_basic_plugins' to enable plugins not requiring additional configuration and/or dependencies to work | ||
collectd_basic_plugins: | ||
- cpu | ||
- interface | ||
- load | ||
- memory | ||
#-aggregation | ||
#-amqp | ||
#-apache | ||
#-apcups | ||
#-apple_sensors | ||
#-aquaero | ||
#-ascent | ||
#-barometer | ||
#-battery | ||
#-bind | ||
#-ceph | ||
#-cgroups | ||
#-chrony | ||
#-conntrack | ||
#-contextswitch | ||
#-cpu | ||
#-cpufreq | ||
#-cpusleep | ||
#-csv | ||
#-curl | ||
#-curl_json | ||
#-curl_xml | ||
#-dbi | ||
#-df | ||
#-disk | ||
#-dns | ||
#-dpdkevents | ||
#-dpdkstat | ||
#-drbd | ||
#-entropy | ||
#-ethstat | ||
#-exec | ||
#-fhcount | ||
#-filecount | ||
#-fscache | ||
#-gmond | ||
#-gps | ||
#-grpc | ||
#-hddtemp | ||
#-hugepages | ||
#-intel_pmu | ||
#-intel_rdt | ||
#-interface | ||
#-ipc | ||
#-ipmi | ||
#-iptables | ||
#-ipvs | ||
#-irq | ||
#-java | ||
#-load | ||
#-lpar | ||
#-lua | ||
#-lvm | ||
#-madwifi | ||
#-mbmon | ||
#-mcelog | ||
#-md | ||
#-memcachec | ||
#-memcached | ||
#-memory | ||
#-mic | ||
#-modbus | ||
#-mqtt | ||
#-multimeter | ||
#-mysql | ||
#-netapp | ||
#-netlink | ||
#-network | ||
#-nfs | ||
#-nginx | ||
#-notify_desktop | ||
#-notify_email | ||
#-notify_nagios | ||
#-ntpd | ||
#-numa | ||
#-nut | ||
#-olsrd | ||
#-onewire | ||
#-openldap | ||
#-openvpn | ||
#-oracle | ||
#-ovs_events | ||
#-ovs_stats | ||
#-perl | ||
#-pinba | ||
#-ping | ||
#-postgresql | ||
#-powerdns | ||
#-processes | ||
#-protocols | ||
#-python | ||
#-redis | ||
#-routeros | ||
#-rrdcached | ||
#-rrdtool | ||
#-sensors | ||
#-serial | ||
#-sigrok | ||
#-smart | ||
#-snmp | ||
#-snmp_agent | ||
#-statsd | ||
#-swap | ||
#-table | ||
#-tail | ||
#-tail_csv | ||
#-tape | ||
#-tcpconns | ||
#-teamspeak2 | ||
#-ted | ||
#-thermal | ||
#-tokyotyrant | ||
#-turbostat | ||
#-unixsock | ||
#-uptime | ||
#-users | ||
#-uuid | ||
#-varnish | ||
#-virt | ||
#-vmem | ||
#-vserver | ||
#-wireless | ||
#-write_graphite | ||
#-write_http | ||
#-write_kafka | ||
#-write_log | ||
#-write_mongodb | ||
#-write_prometheus | ||
#-write_redis | ||
#-write_riemann | ||
#-write_sensu | ||
#-write_tsdb | ||
#-xencpu | ||
#-xmms | ||
#-zfs_arc | ||
#-zone | ||
#-zookeeper | ||
|
||
# Use 'collectd_plugins' to enable plugins requiring additional configuration and/or dependencies to work | ||
collectd_plugins: [] | ||
# examples: | ||
# - name: example | ||
# interval: 120 #seconds | ||
# flush_interval: 600 #seconds | ||
# flush_timeout: | ||
# config: |4 | ||
# Something: true | ||
# <Nested block> | ||
# NestedKey: "value" | ||
# </Nested> | ||
# - name: write_http | ||
# config: |4 | ||
# <Node "oms"> | ||
# URL "127.0.0.1:26000/oms.collectd" | ||
# Format "JSON" | ||
# StoreRates true | ||
# </Node> | ||
# - name: postgresql | ||
# dependencies: | ||
# - collectd-postgresql | ||
# config: |4 | ||
# <Query tickets> | ||
# Statement "SELECT count(t.id) AS count FROM tickets t WHERE t.closed is null;" | ||
# <Result> | ||
# Type gauge | ||
# InstancePrefix "tickets" | ||
# ValuesFrom "count" | ||
# </Result> | ||
# </Query> | ||
# <Database "ptfe"> | ||
# Host "psql-database.hostname.com" | ||
# Port "5432" | ||
# User "my_psqladminuser" | ||
# Password "my_passwd" | ||
# SSLMode "prefer" | ||
# Query tickets | ||
# </Database> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
- name: install collectd plugin dependencies | ||
package: | ||
name: "{{ plugin.dependencies }}" | ||
state: present | ||
register: collectd_install_collectd_deps | ||
until: collectd_install_collectd_deps is succeeded | ||
when: plugin.dependencies is defined | ||
retries: 3 | ||
|
||
- name: configure collectd plugins | ||
template: | ||
src: collectd.d/plugin.conf.j2 | ||
dest: "{{ collectd_conf_include_dir }}/{{ '%03d' | format(index + 1) }}-{{ plugin.name }}.conf" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
validate: collectd -C %s -t | ||
register: configured_plugin | ||
when: plugin.config is defined | ||
notify: | ||
- restart collectd | ||
|
||
- name: Append configured plugin to list | ||
set_fact: | ||
_new_plugins_configured: "{{ _new_plugins_configured + [ configured_plugin.dest ]}}" | ||
when: plugin.config is defined |
Oops, something went wrong.