Enabling monitoring for Exampleservice as a reference for other services

Change-Id: I67801d07170dea267a22179e4f8a7fb1312b6521
diff --git a/xos/synchronizer/monitoring_agent/exampleservice_stats.py b/xos/synchronizer/monitoring_agent/exampleservice_stats.py
new file mode 100644
index 0000000..64843fd
--- /dev/null
+++ b/xos/synchronizer/monitoring_agent/exampleservice_stats.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+#   Author: Mike Adolphs, 2009
+#   Blog: http://www.matejunkie.com/
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; version 2 of the License only!
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+import sys
+import urllib
+
+def retrieve_status_page():
+    statusPage = "http://localhost/server-status?auto"
+    try:
+        retrPage = urllib.urlretrieve(statusPage, '/tmp/server-status.log')
+        return True
+    except:
+        return False
+
+def parse_status_page():
+    """Main parsing function to put the server-status file's content into
+       a dictionary."""
+
+    file = open('/tmp/server-status.log', 'r')
+    line = file.readline()
+    dictStatus = {}
+    counter = 1
+
+    while line:
+        line = line.strip()
+        if "Total Accesses:" in line:
+            key = "total.accesses"
+            val  = {'val':int(line.strip("Total Accesses:")), 'unit':'accesses', 'metric_type':'gauge'}
+        elif "Total kBytes:" in line:
+            key = "total.kBytes"
+            val  = {'val':float(line.strip("Total kBytes:")), 'unit':'kBytes', 'metric_type':'gauge'}
+        elif "Uptime:" in line:
+            key = "uptime"
+            val  = {'val':int(line.strip("Uptime:")), 'unit':'seconds', 'metric_type':'gauge'}
+        elif "ReqPerSec:" in line:
+            key = "reqpersec"
+            val  = {'val':float(line.strip("ReqPerSec:")), 'unit':'rate', 'metric_type':'gauge'}
+        elif "BytesPerSec:" in line:
+            key = "bytespersec"
+            val  = {'val':float(line.strip("BytesPerSec:")), 'unit':'rate', 'metric_type':'gauge'}
+        elif "BytesPerReq:" in line:
+            key = "bytesperreq"
+            val  = {'val':float(line.strip("BytesPerReq:")), 'unit':'rate', 'metric_type':'gauge'}
+        elif "BusyWorkers:" in line:
+            key = "busyworkers"
+            val  = {'val':int(line.strip("BusyWorkers:")), 'unit':'workers', 'metric_type':'gauge'}
+        elif "IdleWorkers:" in line:
+            key = "idleworkers"
+            val  = {'val':int(line.strip("IdleWorkers:")), 'unit':'workers', 'metric_type':'gauge'}
+   
+        dictStatus[key] = val
+        counter = counter + 1
+        line = file.readline()
+
+    return dictStatus
+