diff options
author | 2018-07-27 15:32:54 +0100 | |
---|---|---|
committer | 2018-09-07 08:45:23 +0100 | |
commit | b20fa77aef9d184afa2dadba619afc12878ae67b (patch) | |
tree | addad04a31b2a73ed74f9196321ab8461277f731 /src/collectd/include_config.sh | |
parent | 1db7418e39d41cb92e3b1af71d2cb4b9fabb29f2 (diff) |
Add support for 'collectd-master' container
'collectd-master' contains development versions of collectd
with the latest features. It is based on master branch from
collect repository.
Change-Id: I720b5e5938b402281674ee73851c5f611e4d1178
Signed-off-by: Radoslaw Jablonski <radoslawx.jablonski@intel.com>
Diffstat (limited to 'src/collectd/include_config.sh')
-rwxr-xr-x | src/collectd/include_config.sh | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/collectd/include_config.sh b/src/collectd/include_config.sh index dd20893d..4f91a453 100755 --- a/src/collectd/include_config.sh +++ b/src/collectd/include_config.sh @@ -13,12 +13,31 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Config file options are changing between releases so we have to store both +# configurations variants and choose correct one for target collectd version + +if [ -z "$1" ]; then + echo "Error! Please sample configs variant name as a param!"\ + "(name of directory with sample-configs)" + echo "Usage:" + echo "$0 SAMPLE_CONFIGS_VARIANT_NAME" + echo "e.g. $0 'collectd_sample_configs'" + exit 1 +fi + +SAMPLE_CONF_VARIANT="$1" COLLECTD_CONF_FILE=/opt/collectd/etc/collectd.conf COLLECTD_CONF_DIR=/opt/collectd/etc/collectd.conf.d INCLUDE_CONF="<Include \"/opt/collectd/etc/collectd.conf.d\">" CURR_DIR=`pwd` HOSTNAME=`hostname` -SAMPLE_CONF_DIR=$CURR_DIR/collectd_sample_configs/* +SAMPLE_CONF_DIR=$CURR_DIR/$SAMPLE_CONF_VARIANT + +if [ ! -d "$SAMPLE_CONF_DIR" ]; then + echo "$SAMPLE_CONF_DIR does not exits!"\ + "Probably passed bad variant name as a param: $SAMPLE_CONF_VARIANT" + exit 1 +fi function write_include { echo "Hostname \"$HOSTNAME\"" | sudo tee -a $COLLECTD_CONF_FILE; @@ -31,7 +50,8 @@ grep -qe '<Include "/opt/collectd/etc/collectd.conf.d">' $COLLECTD_CONF_FILE; [ `mkdir -p $COLLECTD_CONF_DIR` -for F in $SAMPLE_CONF_DIR; do +SAMPLE_CONF_FILES=$SAMPLE_CONF_DIR/* +for F in $SAMPLE_CONF_FILES; do FILE=$(basename $F) [ -f $COLLECTD_CONF_DIR/$FILE ] && echo "File $COLLECTD_CONF_DIR/$FILE exists" || cp $F $COLLECTD_CONF_DIR done |