summaryrefslogtreecommitdiffstats
path: root/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2016-10-18 19:32:21 -0700
committerBryan Sullivan <bryan.sullivan@att.com>2016-10-18 19:32:21 -0700
commitc8769dca7f3ffb7add8fb50e0eafb4139d68529b (patch)
tree7eaa5bdf098741530750b17b41123b9156564552 /tests/blueprints/tosca-vnfd-hello-ves/monitor.py
parentab5a8c211b1ff205ffbd5b5261da14baf2f79794 (diff)
Collectd working on VM version
JIRA: VES-1 Change-Id: If03d8ddaf70c9898b70248de98fbb2974d45dc81 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.py55
1 files changed, 27 insertions, 28 deletions
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
index 5307435..5cc9a09 100644
--- a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
+++ b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
@@ -34,13 +34,12 @@ import json
import jsonschema
import select
-report_time = ""
-requestRate = ""
-vfStatus = ""
+report_time = ''
+requestRate = ''
monitor_mode = "f"
-summary = ""
-status = ""
-vfStatus = ""
+summary = ['***** Summary of key stats *****','','','']
+status = ['','unknown','unknown','unknown']
+vdu = 0
base_url = ''
template_404 = b'''POST {0}'''
columns = 0
@@ -97,39 +96,39 @@ class PathDispatcher:
def process_event(e):
global status
global summary
- global vfStatus
epoch = e.event.commonEventHeader.lastEpochMicrosec
report_time = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(int(epoch)/1000000))
- domain = e.event.commonEventHeader.domain
-
- if domain == 'measurementsForVfScaling':
-
- aggregateCpuUsage = e.event.measurementsForVfScaling.aggregateCpuUsage
- requestRate = e.event.measurementsForVfScaling.requestRate
- summary = report_time + " app state: " + vfStatus + ", request rate: " + str(requestRate)
- if monitor_mode == "c": print '{0} *** app state: {1}\trequest rate: {2}'.format(
- report_time, vfStatus, str(requestRate))
+ host = e.event.commonEventHeader.reportingEntityName
+ 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
- if domain == 'fault':
-
- alarmCondition = e.event.faultFields.alarmCondition
- specificProblem = e.event.faultFields.specificProblem
-# vfStatus = e.event.faultFields.vfStatus
- vfStatus = e.event.faultFields.specificProblem
+ domain = e.event.commonEventHeader.domain
- status = report_time + " app state change: " + specificProblem
- if monitor_mode == "c": print '{0} *** vfStatus change: {1}'.format(report_time,
- specificProblem)
+ if e.event.commonEventHeader.functionalRole == 'vHello_VES agent':
+ if domain == 'measurementsForVfScaling':
+ 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))
+
+ 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)
- print '{0}'.format(summary)
-# print_there(2,columns-56,status)
- print '{0}'.format(status)
+ for s in summary:
+ print '{0}'.format(s)
#--------------------------------------------------------------------------
# Main monitoring and logging procedure