Redone the patch changes from 2413/5 as repo upload had messed up the commit

Change-Id: I711f57d6ef11b863108432235a64fbc68718976f
diff --git a/xos/synchronizer/monitoring_agent/exampleservice_stats.py b/xos/synchronizer/monitoring_agent/exampleservice_stats.py
index 64843fd..896356b 100644
--- a/xos/synchronizer/monitoring_agent/exampleservice_stats.py
+++ b/xos/synchronizer/monitoring_agent/exampleservice_stats.py
@@ -39,30 +39,30 @@
     while line:
         line = line.strip()
         if "Total Accesses:" in line:
-            key = "total.accesses"
+            key = "exampleservice.apache.total.accesses"
             val  = {'val':int(line.strip("Total Accesses:")), 'unit':'accesses', 'metric_type':'gauge'}
         elif "Total kBytes:" in line:
-            key = "total.kBytes"
+            key = "exampleservice.apache.total.kBytes"
             val  = {'val':float(line.strip("Total kBytes:")), 'unit':'kBytes', 'metric_type':'gauge'}
         elif "Uptime:" in line:
-            key = "uptime"
+            key = "exampleservice.apache.uptime"
             val  = {'val':int(line.strip("Uptime:")), 'unit':'seconds', 'metric_type':'gauge'}
         elif "ReqPerSec:" in line:
-            key = "reqpersec"
+            key = "exampleservice.apache.reqpersec"
             val  = {'val':float(line.strip("ReqPerSec:")), 'unit':'rate', 'metric_type':'gauge'}
         elif "BytesPerSec:" in line:
-            key = "bytespersec"
+            key = "exampleservice.apache.bytespersec"
             val  = {'val':float(line.strip("BytesPerSec:")), 'unit':'rate', 'metric_type':'gauge'}
         elif "BytesPerReq:" in line:
-            key = "bytesperreq"
+            key = "exampleservice.apache.bytesperreq"
             val  = {'val':float(line.strip("BytesPerReq:")), 'unit':'rate', 'metric_type':'gauge'}
         elif "BusyWorkers:" in line:
-            key = "busyworkers"
+            key = "exampleservice.apache.busyworkers"
             val  = {'val':int(line.strip("BusyWorkers:")), 'unit':'workers', 'metric_type':'gauge'}
         elif "IdleWorkers:" in line:
-            key = "idleworkers"
+            key = "exampleservice.apache.idleworkers"
             val  = {'val':int(line.strip("IdleWorkers:")), 'unit':'workers', 'metric_type':'gauge'}
-   
+
         dictStatus[key] = val
         counter = counter + 1
         line = file.readline()
diff --git a/xos/synchronizer/monitoring_agent/monitoring_agent.py b/xos/synchronizer/monitoring_agent/monitoring_agent.py
index 1839ed5..19204b1 100644
--- a/xos/synchronizer/monitoring_agent/monitoring_agent.py
+++ b/xos/synchronizer/monitoring_agent/monitoring_agent.py
@@ -28,6 +28,7 @@
 @app.route('/monitoring/agent/exampleservice/start',methods=['POST'])
 def exampleservice_start_monitoring_agent():
     global start_publish, rabbit_user, rabbit_password, rabbit_host, rabbit_exchange
+    global keystone_tenant_id, keystone_user_id, publisher_id
     try:
         # To do validation of user inputs for all the functions
         target = request.json['target']
@@ -83,10 +84,10 @@
                  'publisher_id': publisher_id,
                  'timestamp':datetime.datetime.now().isoformat(),
                  'priority':'INFO',
-                 'payload': {'name':k,
-                             'unit':v['unit'],
-                             'result':v['val'],
-                             'type':v['metric_type'],
+                 'payload': {'counter_name':k,
+                             'counter_unit':v['unit'],
+                             'counter_volume':v['val'],
+                             'counter_type':v['metric_type'],
                              'resource_id':'exampleservice',
                              'user_id':keystone_user_id,
                              'tenant_id':keystone_tenant_id
@@ -103,7 +104,7 @@
     resParse = stats.parse_status_page()
     logging.debug ("publish:%(data)s" % {'data':resParse})
     publish_exampleservice_stats(resParse)
-    threading.Timer(5, periodic_publish).start()
+    threading.Timer(60, periodic_publish).start()
 
 if __name__ == "__main__":
     logging.config.fileConfig('monitoring_agent.conf', disable_existing_loggers=False)