aboutsummaryrefslogtreecommitdiffstats
path: root/src/collectd/include_config.sh
blob: 95b052f36740ac9c5ac35e35d8be75c8da3c619a (plain)
1
2
3
4
5
6
7
8
9
10
11
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