summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaryam Tahhan <maryam.tahhan@intel.com>2017-11-15 13:25:19 +0000
committerMaryam Tahhan <maryam.tahhan@intel.com>2017-11-15 13:51:49 +0000
commitd2a3dafe82dc8d92f01b8749acb1b5b603789668 (patch)
tree421f0af526df2c2b2f30560d0a73531303cffefc /src
parentb53b4c46c0990f07a3ef91c8521dda61fd4f611d (diff)
src: ensure hostname is included in collectd conf
As part of the final step of copying all the appropriate configuration files to /opt/collectd/etc/collectd.conf.d make sure that the hostname is set. Change-Id: Iff1634ebcc647f7b6d6ec991d98bd199367f9d4e Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/collectd/include_config.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/collectd/include_config.sh b/src/collectd/include_config.sh
index 1996e96b..dd20893d 100755
--- a/src/collectd/include_config.sh
+++ b/src/collectd/include_config.sh
@@ -1,14 +1,30 @@
#!/bin/bash
+# Copyright 2017 OPNFV
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
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/*
function write_include {
+ echo "Hostname \"$HOSTNAME\"" | sudo tee -a $COLLECTD_CONF_FILE;
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
+ echo -e "</Include>" | sudo tee -a $COLLECTD_CONF_FILE;
}
grep -qe '<Include "/opt/collectd/etc/collectd.conf.d">' $COLLECTD_CONF_FILE; [ $? -ne 0 ] && write_include