From 90b15aa440a6a7d8ddae6df6006aff8010d21405 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 11 Nov 2009 00:22:06 +1100 Subject: * Added HTTP polling for Statistics Monitor Module (access via http://sim.com:httpport/monitorstats/regionUUID/) * Returns simple formatted XML document containing statistical data on the current sim. * Example: 5.0000 ... --- .../Framework/Monitoring/MonitorModule.cs | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index 769af8d..b6a2025 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs @@ -1,7 +1,10 @@ -using System.Collections.Generic; +using System.Collections; +using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts; using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; using OpenSim.Region.Framework.Interfaces; @@ -43,6 +46,26 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring "monitor report", "Returns a variety of statistics about the current region and/or simulator", DebugMonitors); + + MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage); + } + + public Hashtable StatsPage(Hashtable request) + { + string xml = ""; + foreach (IMonitor monitor in m_monitors) + { + xml += "<" + monitor.ToString() + ">" + monitor.GetValue() + ""; + } + xml += ""; + + Hashtable ereply = new Hashtable(); + + ereply["int_response_code"] = 200; // 200 OK + ereply["str_response_string"] = xml; + ereply["content_type"] = "text/xml"; + + return ereply; } public void PostInitialise() -- cgit v1.1