blob: 1759569b63edf681a04d3cb9b2da5bd2a0364d70 [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001#!/bin/bash
2
3FILE='/data/logs/docker_stats.out'
4FE_ID=`docker ps|grep sdc-front|awk '{print $1}'`
5BE_ID=`docker ps|grep sdc-back |awk '{print $1}'`
6
7echo `date` >> ${FILE}
8
9if [ ! -z "${FE_ID}" ]; then
10 docker stats ${FE_ID} --no-stream >> /data/logs/docker_stats.out
11else
12 echo "frontend Docker is down!!!" >> /data/logs/docker_stats.out
13fi
14
15if [ ! -z "${BE_ID}" ]; then
16 docker stats ${BE_ID} --no-stream >> /data/logs/docker_stats.out
17else
18 echo "backend Docker is down!!!" >> /data/logs/docker_stats.out
19fi
20
21echo "------------------------------------------" >> ${FILE}
22
23grep -v "^\-" ${FILE} |grep -v ^CONT| awk 'BEGIN {
24 split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec",month)
25 for (i in month) {
26 month_nums[month[i]]=i
27 }
28}
29/UTC/ {
30 d=$6"-"$2"-"substr("00",0,2-length($3))$3"-"substr($4,0,5)
31 next
32}
Grinberg Moti3cac1992017-02-23 16:23:14 +020033/MiB/ {
34 print $1" "d" "$3/1024" "$8
35 next
36}
Michael Lando451a3402017-02-19 10:28:42 +020037/GiB/ {
38 print $1" "d" "$3" "$8
39 next
40}' > `echo ${FILE}|awk -F"." '{ print $1".csv"}'`
ml636r0649e652017-02-20 21:10:54 +020041