aboutsummaryrefslogtreecommitdiffstats
path: root/src/collectd/include_config.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/collectd/include_config.sh')
-rwxr-xr-xsrc/collectd/include_config.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/collectd/include_config.sh b/src/collectd/include_config.sh
new file mode 100755
index 00000000..95b052f3
--- /dev/null
+++ b/src/collectd/include_config.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+COLLECTD_CONF_FILE=/opt/collectd/etc/collectd.conf
+INCLUDE_CONF="<Include \"/opt/collectd/etc/collectd.conf.d\">"
+
+function write_include {
+ echo $INCLUDE_CONF | sudo tee -a $COLLECTD_CONF_FILE;
+ echo " Filter \"*.conf\"" | sudo tee -a $COLLECTD_CONF_FILE;
+ echo -e "</Include>" | sudo tee -a /opt/collectd/etc/collectd.conf
+}
+
+grep -qe '<Include "/opt/collectd/etc/collectd.conf.d">' $COLLECTD_CONF_FILE; [ $? -ne 0 ] && write_include
+