summaryrefslogtreecommitdiffstats
path: root/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2016-10-19 16:04:58 -0700
committerBryan Sullivan <bryan.sullivan@att.com>2016-10-19 16:04:58 -0700
commit8e4aa0f3e446f672ebe159d08ebe025b74d996c8 (patch)
tree278c8bda805f7662db4fbef9d1aa508adfd74665 /tests/blueprints/tosca-vnfd-hello-ves/monitor.py
parentc8769dca7f3ffb7add8fb50e0eafb4139d68529b (diff)
Working version with collectd installed on bare metal host
JIRA: VES-1 Change-Id: Ib789b72a42bdd731c0fd0da4863cccc5462cf0b9 Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
Diffstat (limited to 'tests/blueprints/tosca-vnfd-hello-ves/monitor.py')
-rw-r--r--tests/blueprints/tosca-vnfd-hello-ves/monitor.py41
1 files changed, 17 insertions, 24 deletions
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
index 5cc9a09..a9e1b65 100644
--- a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
+++ b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
@@ -37,9 +37,8 @@ import select
report_time = ''
requestRate = ''
monitor_mode = "f"
-summary = ['***** Summary of key stats *****','','','']
-status = ['','unknown','unknown','unknown']
-vdu = 0
+summary = ['***** Summary of key stats *****','','','','']
+status = ['','unknown','unknown','unknown','unknown']
base_url = ''
template_404 = b'''POST {0}'''
columns = 0
@@ -53,10 +52,6 @@ class NoLoggingWSGIRequestHandler(WSGIRequestHandler):
def log_message(self, format, *args):
pass
-def print_there(x, y, text):
- sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (x, y, text))
- sys.stdout.flush()
-
base_url = ''
template_404 = b'''POST {0}'''
@@ -96,6 +91,7 @@ class PathDispatcher:
def process_event(e):
global status
global summary
+ vdu = 0
epoch = e.event.commonEventHeader.lastEpochMicrosec
@@ -106,29 +102,26 @@ def process_event(e):
if 'VDU1' in host or 'vdu1' in host: vdu = 1
if 'VDU2' in host or 'vdu2' in host: vdu = 2
if 'VDU3' in host or 'vdu3' in host: vdu = 3
-
+
domain = e.event.commonEventHeader.domain
- if e.event.commonEventHeader.functionalRole == 'vHello_VES agent':
- if domain == 'measurementsForVfScaling':
+ if domain == 'measurementsForVfScaling':
+ if vdu >= 1:
aggregateCpuUsage = e.event.measurementsForVfScaling.aggregateCpuUsage
requestRate = e.event.measurementsForVfScaling.requestRate
- summary[vdu] = "VDU" + str(vdu) + " state=" + status[vdu] + ", tps=" + str(requestRate) + ", cpu=" + str(aggregateCpuUsage)
- if monitor_mode == "c": print '{0} *** VDU{1} state={2}, tps={3}'.format(
- report_time, vdu, status[vdu], str(requestRate))
+ summary[vdu] = host + ": state=" + status[vdu] + ", tps=" + str(requestRate) + ", cpu=" + str(aggregateCpuUsage)
+ else:
+ aggregateCpuUsage = e.event.measurementsForVfScalingFields.aggregateCpuUsage
+ summary[4] = host + ": cpu=" + str(aggregateCpuUsage)
+
+ for s in summary:
+ print '{0}'.format(s)
- if domain == 'fault':
- alarmCondition = e.event.faultFields.alarmCondition
- specificProblem = e.event.faultFields.specificProblem
+ if domain == 'fault':
+ alarmCondition = e.event.faultFields.alarmCondition
+ specificProblem = e.event.faultFields.specificProblem
# status[vdu] = e.event.faultFields.vfStatus
- status[vdu] = e.event.faultFields.specificProblem
- if monitor_mode == "c": print '{0} *** VDU{1} state: {2}'.format(
- report_time, vdu, status[vdu])
-
-# print_there only works if SSH'd to the VM manually - need to investigate
-# print_there(1,columns-56,summary)
- for s in summary:
- print '{0}'.format(s)
+ status[vdu] = e.event.faultFields.specificProblem
#--------------------------------------------------------------------------
# Main monitoring and logging procedure