summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2016-10-15 10:39:39 -0700
committerBryan Sullivan <bryan.sullivan@att.com>2016-10-15 10:39:39 -0700
commit1b40213efc20cfe6b7e03e773aebde07fd196783 (patch)
tree802b187401dcf7e6e6625e1bb527ef6cbaa810ac /tests
parent6a8f06100abf6fcec0ffab5d7c71c4becddb2812 (diff)
Add timestamp and print all info on each event
JIRA: VES-1 Change-Id: I93b83d21706468827a2ce2f174601bbc69d28c02 Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/blueprints/tosca-vnfd-hello-ves/monitor.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
index 24ad557..ec4a00d 100644
--- a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
+++ b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
@@ -19,19 +19,36 @@
#
# Status: this is a work in progress, under test.
+import time
+
+report_time = ""
+request_rate = ""
+app_state = ""
+
with open('/home/ubuntu/ves.log') as f:
while True:
line = f.readline()
if line:
# print line,
+
+ if "lastEpochMicrosec" in line:
+#....5....1....5....2....5....3....5
+# "lastEpochMicrosec": 1476552393091008,
+ report_time = line[34:-2]
+ report_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(1347517370))
+
if "requestRate" in line:
-# print line,
- rate = line[27:-2]
- print 'request rate: {0}'.format(rate)
#....5....1....5....2....5....3....5
# "requestRate": 2264,
+ request_rate = line[27:-2]
+ print '{0} app state: {1}\trequest rate: {2}'.format(
+ report_time, app_state, request_rate)
+
if "\"specificProblem\": \"Started\"" in line:
- print 'app state change: Started'
+ app_state = "Started"
+ print '{0} app state change: Started'.format(report_time)
+
if "\"specificProblem\": \"Stopped\"" in line:
- print 'app state change: Stopped'
+ app_state = "Stopped"
+ print '{0} app state change: Stopped'.format(report_time)