summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRutuja Surve <rutuja.r.surve@gmail.com>2017-11-03 10:16:23 +0000
committerRutuja Surve <rutuja.r.surve@gmail.com>2017-11-14 04:31:52 +0000
commit2b84ec5fef4272cf7df6f9c0ae5fb2c239a5b7cc (patch)
tree6c33b67ca7c808b3f6fb196c44d811154342edb4
parentc839c94808a0fa2836c7d18546f32e5a6e24e37b (diff)
Collectd Client-Server installation automation script
JIRA: BOTTLENECK-181 Automated the installation for collectd client from jump server host and corrected docker versions in monitoring script Change-Id: I14ec20f2761c72e261aa1185a381f0c02b84ed45 Signed-off-by: Rutuja Surve <rutuja.r.surve@gmail.com>
-rw-r--r--monitor/automate_collectd_client.py38
-rw-r--r--monitor/config/collectd-client.conf125
-rw-r--r--monitor/config/collectd.conf18
-rw-r--r--monitor/install-collectd-client.sh8
-rw-r--r--monitor/monitoring.sh11
5 files changed, 186 insertions, 14 deletions
diff --git a/monitor/automate_collectd_client.py b/monitor/automate_collectd_client.py
new file mode 100644
index 00000000..6dd70676
--- /dev/null
+++ b/monitor/automate_collectd_client.py
@@ -0,0 +1,38 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import logging
+import sys
+import yaml
+sys.path.insert(0, '/home/opnfv/bottlenecks/utils/infra_setup/passwordless_SSH/')
+import ssh
+
+logger = logging.getLogger(__name__)
+with open('/tmp/pod.yaml') as f:
+ dataMap = yaml.safe_load(f)
+ for x in dataMap:
+ for y in dataMap[x]:
+ if (y['role']=='Controller') or (y['role']=='Compute'):
+ ip = str(y['ip'])
+ user = str(y['user'])
+ pwd = str(y['password'])
+ ssh_d = ssh.SSH(user, host= ip, password= pwd)
+ status, stdout, stderr = ssh_d.execute("cd /etc && mkdir collectd-config")
+ if status:
+ raise Exception("Command failed with non-zero status.")
+ logger.info(stdout.splitlines())
+ with open("/home/opnfv/bottlenecks/monitor/install-collectd-client.sh") as stdin_file:
+ ssh_d.run("cat > /etc/collectd-config/install.sh", stdin=stdin_file)
+ with open("/home/opnfv/bottlenecks/monitor/config/collectd-client.conf") as stdin_file:
+ ssh_d.run("cat > /etc/collectd-config/collectd.conf", stdin=stdin_file)
+ status, stdout, stderr = ssh_d.execute("sudo apt-get install docker.io")
+ if status:
+ raise Exception("Command for installing docker failed.")
+ logger.info(stdout.splitlines())
+ ssh_d.run("cd /etc/collectd-config/ && bash ./install.sh")
diff --git a/monitor/config/collectd-client.conf b/monitor/config/collectd-client.conf
new file mode 100644
index 00000000..96a2a690
--- /dev/null
+++ b/monitor/config/collectd-client.conf
@@ -0,0 +1,125 @@
+#
+# Config file for collectd(1).
+# Please read collectd.conf(5) for a list of options.
+# http://collectd.org/
+#
+
+##############################################################################
+# Global #
+#----------------------------------------------------------------------------#
+# Global settings for the daemon. #
+##############################################################################
+
+#Hostname "localhost"
+#FQDNLookup true
+#BaseDir "${prefix}/var/lib/collectd"
+#PIDFile "${prefix}/var/run/collectd.pid"
+#PluginDir "${exec_prefix}/lib/collectd"
+#TypesDB "/usr/share/collectd/types.db"
+
+#----------------------------------------------------------------------------#
+# When enabled, plugins are loaded automatically with the default options #
+# when an appropriate <Plugin ...> block is encountered. #
+# Disabled by default. #
+#----------------------------------------------------------------------------#
+#AutoLoadPlugin false
+
+#----------------------------------------------------------------------------#
+# When enabled, internal statistics are collected, using "collectd" as the #
+# plugin name. #
+# Disabled by default. #
+#----------------------------------------------------------------------------#
+#CollectInternalStats false
+
+#----------------------------------------------------------------------------#
+# Interval at which to query values. This may be overwritten on a per-plugin #
+# base by using the 'Interval' option of the LoadPlugin block: #
+# <LoadPlugin foo> #
+# Interval 60 #
+# </LoadPlugin> #
+#----------------------------------------------------------------------------#
+#Interval 10
+
+#MaxReadInterval 86400
+#Timeout 2
+#ReadThreads 5
+#WriteThreads 5
+
+# Limit the size of the write queue. Default is no limit. Setting up a limit is
+# recommended for servers handling a high volume of traffic.
+#WriteQueueLimitHigh 1000000
+#WriteQueueLimitLow 800000
+
+##############################################################################
+# Logging #
+#----------------------------------------------------------------------------#
+# Plugins which provide logging functions should be loaded first, so log #
+# messages generated when loading or configuring other plugins can be #
+# accessed. #
+##############################################################################
+
+LoadPlugin syslog
+#<Plugin syslog>
+# LogLevel info
+#</Plugin>
+
+##############################################################################
+# LoadPlugin section #
+#----------------------------------------------------------------------------#
+# Lines beginning with a single `#' belong to plugins which have been built #
+# but are disabled by default. #
+# #
+# Lines begnning with `##' belong to plugins which have not been built due #
+# to missing dependencies or because they have been deactivated explicitly. #
+##############################################################################
+
+LoadPlugin cpu
+LoadPlugin interface
+LoadPlugin memory
+LoadPlugin network
+LoadPlugin rrdtool
+LoadPlugin write_http
+
+##############################################################################
+# Plugin configuration #
+#----------------------------------------------------------------------------#
+# In this section configuration stubs for each plugin are provided. A desc- #
+# ription of those options is available in the collectd.conf(5) manual page. #
+##############################################################################
+
+#<Plugin cpu>
+# ReportByCpu true
+# ReportByState true
+# ValuesPercentage false
+#</Plugin>
+
+#<Plugin interface>
+# Interface "eth0"
+# IgnoreSelected false
+#</Plugin>
+
+#<Plugin memory>
+# ValuesAbsolute true
+# ValuesPercentage false
+#</Plugin>
+
+<Plugin network>
+ Server "192.168.121.2" "25826"
+</Plugin>
+
+#<Plugin rrdtool>
+# DataDir "${prefix}/var/lib/collectd/rrd"
+# CreateFilesAsync false
+# CacheTimeout 120
+# CacheFlush 900
+# WritesPerSecond 50
+#</Plugin>
+
+#<Plugin write_http>
+# <Node "collectd_exporter">
+# URL "http://192.168.121.2:9103/collectd-post"
+# Format "JSON"
+# StoreRates false
+# </Node>
+#</Plugin>
+
diff --git a/monitor/config/collectd.conf b/monitor/config/collectd.conf
index 62be9fbb..6be610e5 100644
--- a/monitor/config/collectd.conf
+++ b/monitor/config/collectd.conf
@@ -751,7 +751,7 @@ LoadPlugin write_http
#</Plugin>
<Plugin network>
- Server "192.168.104.2" "25826"
+ Listen "192.168.121.2" "25826"
</Plugin>
#<Plugin network>
@@ -1021,13 +1021,13 @@ LoadPlugin write_http
# CollectStatistics true
#</Plugin>
-#<Plugin rrdtool>
-# DataDir "${prefix}/var/lib/collectd/rrd"
-# CreateFilesAsync false
-# CacheTimeout 120
-# CacheFlush 900
-# WritesPerSecond 50
-#</Plugin>
+<Plugin rrdtool>
+ DataDir "/var/lib/collectd/rrd"
+ CreateFilesAsync false
+ CacheTimeout 120
+ CacheFlush 900
+ WritesPerSecond 50
+</Plugin>
#<Plugin sensors>
# SensorConfigFile "/etc/sensors.conf"
@@ -1325,7 +1325,7 @@ LoadPlugin write_http
<Plugin write_http>
<Node "collectd_exporter">
- URL "http://192.168.104.2:9103/collectd-post"
+ URL "http://192.168.121.2:9103/collectd-post"
Format "JSON"
StoreRates false
</Node>
diff --git a/monitor/install-collectd-client.sh b/monitor/install-collectd-client.sh
new file mode 100644
index 00000000..00fa4c88
--- /dev/null
+++ b/monitor/install-collectd-client.sh
@@ -0,0 +1,8 @@
+MONITOR_CONFIG="/etc/collectd-config"
+
+# Collectd
+sudo docker run --name bottlenecks-automated-collectd -d \
+ --privileged \
+ -v ${MONITOR_CONFIG}:/etc/collectd:ro \
+ -v /proc:/mnt/proc:ro \
+ fr3nd/collectd:5.5.0-1
diff --git a/monitor/monitoring.sh b/monitor/monitoring.sh
index a4d404ce..b8409d47 100644
--- a/monitor/monitoring.sh
+++ b/monitor/monitoring.sh
@@ -18,7 +18,7 @@ sudo docker run --name bottlenecks-node-exporter \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
--net="host" \
- quay.io/prometheus/node-exporter \
+ quay.io/prometheus/node-exporter:v0.14.0 \
-collector.procfs /host/proc \
-collector.sysfs /host/sys \
-collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
@@ -28,22 +28,23 @@ sudo docker run --name bottlenecks-collectd -d \
--privileged \
-v ${MONITOR_CONFIG}:/etc/collectd:ro \
-v /proc:/mnt/proc:ro \
- fr3nd/collectd
+ fr3nd/collectd:5.5.0-1
# Collectd-Exporter
sudo docker run --name bottlenecks-collectd-exporter \
-d -p 9103:9103 \
- -p 25826:25826/udp prom/collectd-exporter \
+ -p 25826:25826/udp prom/collectd-exporter:0.3.1 \
-collectd.listen-address=":25826"
# Prometheus
sudo docker run --name bottlenecks-prometheus \
-d -p 9090:9090 \
-v ${MONITOR_CONFIG}/prometheus.yaml:/etc/prometheus/prometheus.yml \
- prom/prometheus
+ prom/prometheus:v1.7.1
# Grafana
sudo docker run --name bottlenecks-grafana \
-d -p 3000:3000 \
-v ${GRAFANA}/config/grafana.ini:/etc/grafana/grafana.ini \
- grafana/grafana
+ grafana/grafana:4.5.0
+