feat: collectd/influx role

This commit is contained in:
2023-01-03 21:49:28 +01:00
parent 6dd59bb9a2
commit 15a1bcbe9f
6 changed files with 108 additions and 1 deletions

View File

@@ -4,7 +4,8 @@
- { role : monitoring-client, tags : [ "monitoring", "monitoring-client", "client"] } - { role : monitoring-client, tags : [ "monitoring", "monitoring-client", "client"] }
- { role : sshd-config, tags : [ "sshd" ] } - { role : sshd-config, tags : [ "sshd" ] }
- { role : rsyslog, tags : [ "rsyslog" ] } - { role : rsyslog, tags : [ "rsyslog" ] }
- { role : monitoring-influx, tags : [ "influx" ] }
- hosts: monitoring - hosts: monitoring
roles: roles:
- monitoring-master - { role : monitoring-master, tags : [ "monitoring-master" ] }

View File

@@ -9,3 +9,13 @@
systemd: systemd:
name: rsyslog name: rsyslog
state: restarted state: restarted
- name: restart collectd
systemd:
name: collectd
state: restarted
- name: restart influxdb
systemd:
name: influxdb
state: restarted

View File

@@ -0,0 +1,2 @@
dependencies:
- global-handlers

View File

@@ -0,0 +1,31 @@
- name: Install influxdb
apt:
name: influxdb
state: present
when: monitoring_master
- name: Influxdb master server config
template:
src: influxdb.conf.j2
dest: /etc/influxdb/influxdb.conf
when: monitoring_master
notify:
- restart influxdb
- name: Create Influx collectd-db
shell: 'echo "CREATE DATABASE collectd;" | influx'
changed_when: False
when: monitoring_master
- name: Install collectd
apt:
name: collectd
install_recommends: false
state: present
- name: Collectd config
template:
src: collectd.conf.j2
dest: /etc/collectd/collectd.conf
notify:
- restart collectd

View File

@@ -0,0 +1,34 @@
FQDNLookup true
LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin entropy
LoadPlugin interface
LoadPlugin irq
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin processes
LoadPlugin swap
LoadPlugin users
LoadPlugin rrdtool
<Plugin df>
FSType rootfs
FSType sysfs
FSType proc
FSType devtmpfs
FSType devpts
FSType tmpfs
FSType fusectl
FSType cgroup
IgnoreSelected true
</Plugin>
<Plugin network>
Server "internal.monitoring.atlantishq.de" "25826"
</Plugin>
<Plugin rrdtool>
DataDir "/var/lib/collectd/rrd"
</Plugin>
<Include "/etc/collectd/collectd.conf.d">
Filter "*.conf"
</Include>

View File

@@ -0,0 +1,29 @@
[meta]
dir = "/var/lib/influxdb/meta"
[data]
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"
[[collectd]]
enabled = true
bind-address = ":25826"
database = "collectd"
retention-policy = ""
# security-level = "none"
# auth-file = "/etc/collectd/auth_file"
batch-size = 5000
batch-pending = 10
batch-timeout = "10s"
read-buffer = 0
# Multi-value plugins can be handled two ways.
# "split" will parse and store the multi-value plugin data into separate measurements
# "join" will parse and store the multi-value plugin as a single multi-value measurement.
# "split" is the default behavior for backward compatability with previous versions of influxdb.
# parse-multivalue-plugin = "split"