Add more plugins

Add a bunch of new plugins that can be configured via this role.
This commit is contained in:
Felix Niederwanger 2022-06-29 14:47:32 +02:00
parent e23d84bb22
commit f13a0120ff
Signed by: phoenix
GPG key ID: 31860289A704FB3C
4 changed files with 126 additions and 110 deletions

View file

@ -2,8 +2,7 @@
# geekoops-collectd
Easy ansible role to setup system metrics transmission to `collectd`.
Currently only `influxdb` is supported by this role. This ansible role works with
Easy ansible role to setup system metrics transmission to `collectd`. This ansible role works with
- openSUSE Leap 15.3
- openSUSE Leap 15.4
@ -13,20 +12,44 @@ Currently only `influxdb` is supported by this role. This ansible role works wit
| Value | Description | Default |
|-------|-------------|---------|
|`nodename`| Name of the node that will be shown in grafana | "localhost" |
|`interval`| Report interval in seconds | 10 |
|`overwrite`| Overwrite existing `collectd.conf` file | false |
|`enable_influx`| Enable InfluxDB | false |
|`influx_host`| InfluxDB host | "127.0.0.1" |
|`influx_port`| InfluxDB post | 25826 |
|`enable_disk`| Enable disk plugin | true |
|`enable_cpu`| Enable CPU plugin | true |
|`enable_load`| Enable load plugin | true |
|`enable_memory`| Enable memory plugin | true |
|`enable_swap`| Enable swap plugin | true |
|`enable_df`| Enable df plugin | false |
|`nodename`| Name of the node that will be shown in grafana | `{{ ansible_hostname }}` |
|`interval`| Report interval in seconds | `10` |
|`overwrite`| Overwrite existing `collectd.conf` file | `true` |
|`influx_host`| If set, collectd will push its metrics to this InfluxDB host | "" |
|`influx_port`| InfluxDB post | `25826` |
|`prometheus_port`| If set, collectd will open a webserver of this port to accept scrape requests from Prometheus on this port | `""` |
|`enable_disk`| Enable the disk plugin | `true` |
|`disk_disks`| Disks added to the `disk` plugin | [] |
|`df_disks`| Disks added to the `df` plugin | [] |
|`enable_cpu`| Enable the CPU plugin | `true` |
|`enable_uptime`| Enable the uptime plugin | `true` |
|`enable_cpufreq`| Enable the cpufreq plugin | `true` |
|`enable_load`| Enable the load plugin | `true` |
|`enable_memory`| Enable the memory plugin | `true` |
|`enable_swap`| Enable the swap plugin | `true` |
|`enable_smart`| Enable the smart plugin | `false` |
|`smart_disk` | Select disk(s) to be monitored by the smart plugin | `""` |
|`smart_use_serial` | Use the disk serial number instead of the kernel name to store data | `true` |
|`enable_df`| Enable the df plugin | `false` |
|`df_disks`| Disks added to the `df` plugin | `[]` |
|`enable_apcups`| Enable the apcups plugin | `false` |
|`apcups_host` | Hostname of the running `acpupsd` to query | `localhost` |
|`apcups_port` | Port to query | `3551` |
|`apcups_report_seconds` | Convert the lifetime to seconds | `true` |
|`apcups_persistent_connection` | Keep the connection between reads open | `true` |
|`enable_vmem`| Enable the vmem plugin | `false` |
|`vmem_verbose`| Report vmem stats verbosely | `false` |
|`enable_connectivity`| Enable the connectivity plugin to report if interfaces are up or down | `false` |
|`connectivity_interfaces`| Set the list of interfaces for the connectivity plugin to monitor | `[]` |
|`enable_battery` | Enable the battery plugin | `false` |
|`battery_percentage` | Report the battery stats as percentages | `true` |
|`battery_report_degraded` | Report the degraded stats instead the corrected-for-degraded stats | `false` |
|`enable_hddtemp` | Enable the hddtemp plugin | `false` |
|`hdd_temp_host` | Host to query by the plugin. This is where the hddtemp daemon is running | `127.0.0.1` |
|`hdd_temp_port` | Port of the hddtemp host to query | `7634` |
|`enable_md` | Enable the md plugin (RAID monitoring) | `false` |
|`md_device` | Device the md plugin should monitor | `/dev/md0` |
If `overwrite` is true, any existing `collectd.conf` file will be overwritten by ansible. Use this with caution! The existing configuration will only be written, if `collectd` is installed.
@ -43,15 +66,9 @@ Extended example
- role: geekoops-collectd
vars:
nodename: "jellyfish"
enable_influx: true
influx_host: vinculum
influx_host: "192.168.122.3"
enable_df: true
## License
MIT
## Author Information
phoenix
Have a lot of fun!

View file

@ -1,32 +1,61 @@
---
# defaults file for geekoops-collectd
nodename: "localhost"
nodename: "{{ ansible_hostname }}"
interval: 10
overwrite: false
overwrite: true
enable_influx: false
influx_host: "127.0.0.1"
## Enable pushing of metrics to influxdb
influx_host: ""
influx_port: 25826
enable_prometheus: false
prometheus_port: "9103"
## Enable prometheus scrape webserver on this port
prometheus_port: ""
## Plugins
enable_disk: true
enable_cpu: true
enable_uptime: true
enable_cpufreq: false
enable_load: true
enable_memory: true
enable_swap: true
enable_smart: false
enable_df: false
enable_apcups: false
enable_vmem: false
enable_connectivity: false
enable_battery: false
enable_hddtemp: false
enable_md: false
disk_disks: []
df_disks: []
smart_disk: ""
smart_use_serial: true
report_by_cpu: false
report_by_state: false
cpu_report_by_cpu: "false"
cpu_report_by_state: "false"
cpu_values_percentage: "true"
cpu_report_num_cpus: "false"
apcups_host: "localhost"
apcups_port: "3551"
apcups_report_seconds: "true"
apcups_persistent_connection: "true"
vmem_verbose: "false"
connectivity_interfaces: []
battery_percentage: "true"
battery_report_degraded: "false"
hdd_temp_host: "127.0.0.1"
hdd_temp_port: "7634"
md_device: "/dev/md0"

View file

@ -37,5 +37,4 @@ verifier:
lint:
name: flake8
lint: |
set -e
yamllint .
yamllint -d "{extends: relaxed, rules: {line-length: {max: 200}}}" .

View file

@ -11,42 +11,20 @@ Hostname "{{ nodename }}"
AutoLoadPlugin true
Interval {{ interval }}
LoadPlugin syslog
LoadPlugin cpu
#LoadPlugin syslog
#LoadPlugin cpu
#LoadPlugin cpufreq
{% if enable_cpufreq == true %}
LoadPlugin cpusleep
{% else %}
#LoadPlugin cpusleep
{% endif %}
{% if enable_df == true %}
LoadPlugin df
{% else %}
#LoadPlugin df
{% endif %}
{% if enable_disk == true %}
LoadPlugin disk
{% else %}
#LoadPlugin disk
{% endif %}
#LoadPlugin hddtemp
#LoadPlugin hugepages
LoadPlugin interface
#LoadPlugin ipmi
{% if enable_load == true %}
LoadPlugin load
{% else %}
#LoadPlugin load
{% endif %}
#LoadPlugin md
{% if enable_memory == true %}
LoadPlugin memory
{% else %}
#LoadPlugin memory
{% endif %}
#LoadPlugin mysql
#LoadPlugin netlink
#LoadPlugin network
#LoadPlugin nfs
#LoadPlugin nginx
#LoadPlugin ntpd
@ -59,42 +37,32 @@ LoadPlugin memory
#LoadPlugin rrdtool
#LoadPlugin sensors
#LoadPlugin serial
{% if enable_smart == true and smart_disk != "" %}
#LoadPlugin smart
{% else %}
#LoadPlugin smart
{% endif %}
#LoadPlugin snmp
#LoadPlugin snmp_agent
#LoadPlugin statsd
{% if enable_swap == true %}
LoadPlugin swap
{% else %}
#LoadPlugin swap
{% endif %}
#LoadPlugin thermal
{% if enable_uptime == true %}
LoadPlugin uptime
{% endif %}
#LoadPlugin users
#LoadPlugin virt
#LoadPlugin vmem
{% if enable_prometheus == true %}
LoadPlugin write_prometheus
{% if enable_apcups == true %}
<Plugin apcups>
Host "{{ apcups_host }}"
Port "{{ apcups_port }}"
ReportSeconds {{ apcups_report_seconds }}
PersistentConnection {{ apcups_persistent_connection }}
</Plugin>
{% endif %}
#<Plugin apcups>
# Host "localhost"
# Port "3551"
# ReportSeconds true
# PersistentConnection true
#</Plugin>
#<Plugin "battery">
# ValuesPercentage false
# ReportDegraded false
# QueryStateFS false
#</Plugin>
{% if enable_battery == true %}
<Plugin "battery">
ValuesPercentage {{ battery_percentage }}
ReportDegraded {{ battery_report_degraded }}
QueryStateFS false
</Plugin>
{% endif %}
#<Plugin chrony>
# Host "localhost"
@ -102,9 +70,13 @@ LoadPlugin write_prometheus
# Timeout "2"
#</Plugin>
#<Plugin connectivity>
# Interface eth0
#</Plugin>
{% if enable_connectivity == true %}
<Plugin connectivity>
{% for interface in connectivity_interfaces %}
Interface {{ interface }}
{% endfor %}
</Plugin>
{% endif %}
#<Plugin cgroups>
# CGroup "libvirt"
@ -113,16 +85,10 @@ LoadPlugin write_prometheus
{% if enable_cpu == true %}
<Plugin cpu>
{% if report_by_cpu == true %}
ReportByCpu true
{% endif %}
{% if report_by_state == true %}
ReportByState true
{% endif %}
ValuesPercentage true
ReportNumCpu false
ReportGuestState false
SubtractGuestState true
ReportByCpu {{ cpu_report_by_cpu }}
ReportByState {{ cpu_report_by_state }}
ValuesPercentage {{ cpu_values_percentage }}
ReportNumCpu {{ cpu_report_num_cpus }}
</Plugin>
{% endif %}
@ -172,10 +138,13 @@ LoadPlugin write_prometheus
# </Directory>
#</Plugin>
#<Plugin hddtemp>
# Host "127.0.0.1"
# Port "7634"
#</Plugin>
{% if enable_hddtemp == true %}
<Plugin hddtemp>
Host "127.0.0.1"
Port "7634"
# TranslateDevicename true
</Plugin>
{% endif %}
#<Plugin hugepages>
# ReportPerNodeHP true
@ -198,10 +167,11 @@ LoadPlugin write_prometheus
</Plugin>
{% endif %}
#<Plugin md>
# Device "/dev/md0"
# IgnoreSelected false
#</Plugin>
{% if enable_md == true %}
<Plugin md>
Device "{{ md_device }}"
</Plugin>
{% endif %}
{% if enable_memory == true %}
<Plugin memory>
@ -250,7 +220,7 @@ LoadPlugin write_prometheus
# IgnoreSelected false
#</Plugin>
{% if enable_influx %}
{% if influx_host != "" %}
<Plugin network>
Server "{{ influx_host }}" "{{ influx_port }}"
</Plugin>
@ -545,11 +515,10 @@ LoadPlugin write_prometheus
</Plugin>
{% endif %}
{% if enable_prometheus == true %}
{% if prometheus_port != "" %}
<Plugin "write_prometheus">
Port "{{ prometheus_port }}"
</Plugin>
{% endif %}
#<Plugin sysevent>
@ -580,6 +549,8 @@ LoadPlugin write_prometheus
# PersistentNotification false
#</Plugin>
#<Plugin vmem>
# Verbose false
#</Plugin>
{% if enable_vmem == true %}
<Plugin vmem>
Verbose {{ vmem_verbose }}
</Plugin>
{% endif %}