aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/onap-lab-ci/scripts/process-pods.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deployment/onap-lab-ci/scripts/process-pods.sh')
-rwxr-xr-xdeployment/onap-lab-ci/scripts/process-pods.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/deployment/onap-lab-ci/scripts/process-pods.sh b/deployment/onap-lab-ci/scripts/process-pods.sh
new file mode 100755
index 000000000..fada45419
--- /dev/null
+++ b/deployment/onap-lab-ci/scripts/process-pods.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+if [ "$#" -ne 3 ]; then
+ echo "$0 <onap-pods.json> <job> <build>"
+ exit 1
+fi
+JSON_OUTPUT=$1
+JOB=$2
+BUILD=$3
+
+INFLUX_ENDPOINT='http://10.145.123.16:8086/write?db=robot'
+
+
+TIME=$(date -r $JSON_OUTPUT +%s%N)
+
+POINTS_FILE=/tmp/points-$JOB-$BUILD-pods.txt
+rm -f $POINTS_FILE
+
+cat $JSON_OUTPUT | jq -r '.items[] | ( (.status.containerStatuses[] | ( " "+.image + " " + (.restartCount | tostring) + " " + (.ready | tostring) ) ) ) + " " + .metadata.name ' | grep -e 'onap/' -e 'openecomp/' | sort | while read CONTAINER; do
+ IMAGE=$(echo $CONTAINER | cut -d ' ' -f 1 | sed -r 's#.*/(onap|openecomp)/##g')
+ RESTART_COUNT=$(echo $CONTAINER | cut -d ' ' -f 2)
+ READY=$(echo $CONTAINER | cut -d ' ' -f 3)
+ POD=$(echo $CONTAINER | cut -d ' ' -f 4)
+
+ if [ "$READY" = "true" ] && [ "$RESTART_COUNT" -eq 0 ]; then
+ PASS=1
+ FAIL=0
+ else
+ PASS=0
+ FAIL=1
+ fi
+
+ # currently assumes that no onap pod contains multiple containers of with the same image
+ echo container,job=$JOB,image=$IMAGE,pod=$POD build=$BUILD,restartCount=$RESTART_COUNT,ready=$READY,pass=$PASS,fail=$FAIL $TIME | tee -a $POINTS_FILE
+done
+
+curl -i $INFLUX_ENDPOINT --data-binary @$POINTS_FILE