#!/bin/bash
COLLECTD_CONF_FILE=/opt/collectd/etc/collectd.conf
INCLUDE_CONF=""
function write_include {
echo $INCLUDE_CONF | sudo tee -a $COLLECTD_CONF_FILE;
echo " Filter \"*.conf\"" | sudo tee -a $COLLECTD_CONF_FILE;
echo -e "" | sudo tee -a /opt/collectd/etc/collectd.conf
}
grep -qe '' $COLLECTD_CONF_FILE; [ $? -ne 0 ] && write_include