mirror of
https://github.com/FAUSheppy/no-secrets-athq-ansible
synced 2025-12-06 12:01:37 +01:00
feat: collectd/influx role
This commit is contained in:
@@ -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" ] }
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
2
roles/monitoring-influx/meta/main.yml
Normal file
2
roles/monitoring-influx/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
dependencies:
|
||||||
|
- global-handlers
|
||||||
31
roles/monitoring-influx/tasks/main.yaml
Normal file
31
roles/monitoring-influx/tasks/main.yaml
Normal 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
|
||||||
34
roles/monitoring-influx/templates/collectd.conf.j2
Normal file
34
roles/monitoring-influx/templates/collectd.conf.j2
Normal 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>
|
||||||
29
roles/monitoring-influx/templates/influxdb.conf.j2
Normal file
29
roles/monitoring-influx/templates/influxdb.conf.j2
Normal 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"
|
||||||
Reference in New Issue
Block a user