diff --git a/app/collectd/schema/schema.cue b/app/collectd/schema/schema.cue new file mode 100644 index 0000000..28ebfcc --- /dev/null +++ b/app/collectd/schema/schema.cue @@ -0,0 +1,5 @@ +package schema + +#Collectd: { + ... +} diff --git a/app/collectd/templates.cue b/app/collectd/templates.cue new file mode 100644 index 0000000..33b0ecd --- /dev/null +++ b/app/collectd/templates.cue @@ -0,0 +1,40 @@ +package collectd + +import "du5t1n.me/cfg/base/schema/instructions" + +templates: [...instructions.#RenderInstruction] & [ + { + template: "collectd/collectd-df.conf" + dest: "/etc/collectd.d/df.conf" + hooks: { + changed: [{run: "systemctl try-restart collectd"}] + } + }, + { + template: "collectd/collectd-plugins.conf" + dest: "/etc/collectd.d/plugins.conf" + hooks: { + changed: [{run: "systemctl try-restart collectd"}] + } + }, + { + template: "collectd/collectd-prometheus.conf" + dest: "/etc/collectd.d/prometheus.conf" + hooks: { + changed: [{run: "systemctl try-restart collectd"}] + } + }, + { + template: "collectd/collectd.container" + dest: "/etc/containers/systemd/collectd.container" + hooks: { + changed: [ + { + run: "systemctl daemon-reload" + immediate: true + }, + {run: "systemctl restart collectd"}, + ] + } + }, +] diff --git a/templates/collectd/collectd-df.conf b/templates/collectd/collectd-df.conf new file mode 100644 index 0000000..f628bba --- /dev/null +++ b/templates/collectd/collectd-df.conf @@ -0,0 +1,8 @@ +LoadPlugin df + + + ReportByDevice true + + FSType overlay + IgnoreSelected true + diff --git a/templates/collectd/collectd-plugins.conf b/templates/collectd/collectd-plugins.conf new file mode 100644 index 0000000..c961a39 --- /dev/null +++ b/templates/collectd/collectd-plugins.conf @@ -0,0 +1,9 @@ +LoadPlugin chrony +LoadPlugin cpufreq +LoadPlugin disk +LoadPlugin entropy +LoadPlugin processes +LoadPlugin swap +LoadPlugin tcpconns +LoadPlugin thermal +LoadPlugin uptime diff --git a/templates/collectd/collectd-prometheus.conf b/templates/collectd/collectd-prometheus.conf new file mode 100644 index 0000000..8283102 --- /dev/null +++ b/templates/collectd/collectd-prometheus.conf @@ -0,0 +1,5 @@ +LoadPlugin write_prometheus + + + Port 9103 + diff --git a/templates/collectd/collectd.container b/templates/collectd/collectd.container new file mode 100644 index 0000000..e257c45 --- /dev/null +++ b/templates/collectd/collectd.container @@ -0,0 +1,21 @@ +# vim: set ft=systemd : +[Unit] +Description=Collectd statistics daemon +After=network.target +Wants=network.target + +[Container] +Image=git.pyrocufflink.net/containerimages/collectd:latest +Volume=/etc/collectd.d:/etc/collectd.d:ro +Volume=/run:/run:rw +Tmpfs=/tmp +Network=host +SecurityLabelDisable=true +PodmanArgs=--privileged +PodmanArgs=--ipc=host +PodmanArgs=--uts=host +PodmanArgs=--pid=host +PodmanArgs=--cgroupns=host + +[Install] +WantedBy=multi-user.target