summaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/scripts/docker_stats.sh
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 10:28:42 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 10:51:01 +0200
commit451a3400b76511393c62a444f588a4ed15f4a549 (patch)
treee4f5873a863d1d3e55618eab48b83262f874719d /sdc-os-chef/scripts/docker_stats.sh
parent5abfe4e1fb5fae4bbd5fbc340519f52075aff3ff (diff)
Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'sdc-os-chef/scripts/docker_stats.sh')
-rw-r--r--sdc-os-chef/scripts/docker_stats.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/sdc-os-chef/scripts/docker_stats.sh b/sdc-os-chef/scripts/docker_stats.sh
new file mode 100644
index 0000000000..9258b3471d
--- /dev/null
+++ b/sdc-os-chef/scripts/docker_stats.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+FILE='/data/logs/docker_stats.out'
+FE_ID=`docker ps|grep sdc-front|awk '{print $1}'`
+BE_ID=`docker ps|grep sdc-back |awk '{print $1}'`
+
+echo `date` >> ${FILE}
+
+if [ ! -z "${FE_ID}" ]; then
+ docker stats ${FE_ID} --no-stream >> /data/logs/docker_stats.out
+else
+ echo "frontend Docker is down!!!" >> /data/logs/docker_stats.out
+fi
+
+if [ ! -z "${BE_ID}" ]; then
+ docker stats ${BE_ID} --no-stream >> /data/logs/docker_stats.out
+else
+ echo "backend Docker is down!!!" >> /data/logs/docker_stats.out
+fi
+
+echo "------------------------------------------" >> ${FILE}
+
+grep -v "^\-" ${FILE} |grep -v ^CONT| awk 'BEGIN {
+ split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec",month)
+ for (i in month) {
+ month_nums[month[i]]=i
+ }
+}
+/UTC/ {
+ d=$6"-"$2"-"substr("00",0,2-length($3))$3"-"substr($4,0,5)
+ next
+}
+/GiB/ {
+ print $1" "d" "$3" "$8
+ next
+}' > `echo ${FILE}|awk -F"." '{ print $1".csv"}'`