26f939f920235df3d0de6fad6fa2672d6a38497c
[osm/vim-emu.git] / utils / ci / test_sdk_monitor.sh
1 #!/bin/bash
2 # test if a vnf can be monitored and deployed
3
4 cpu_load=$(son-emu-cli monitor prometheus -d datacenter1 -vnf vnf1 -q 'sum(rate(container_cpu_usage_seconds_total{id="/docker/<uuid>"}[10s]))')
5
6 # test if prometheus query worked
7 regex="[0-9.]+, [0-9.']+"
8 if [[ $cpu_load =~ $regex ]] ; then
9 echo "OK"
10 exit 0
11 else
12 echo $cpu_load
13 echo "not OK"
14 exit 1
15 fi