diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index 769af8d..11aca99 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -1,7 +1,10 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections; |
2 | using System.Collections.Generic; | ||
2 | using System.Reflection; | 3 | using System.Reflection; |
3 | using log4net; | 4 | using log4net; |
4 | using Nini.Config; | 5 | using Nini.Config; |
6 | using OpenMetaverse; | ||
7 | using OpenSim.Framework; | ||
5 | using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts; | 8 | using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts; |
6 | using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; | 9 | using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; |
7 | using OpenSim.Region.Framework.Interfaces; | 10 | using OpenSim.Region.Framework.Interfaces; |
@@ -43,6 +46,56 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
43 | "monitor report", | 46 | "monitor report", |
44 | "Returns a variety of statistics about the current region and/or simulator", | 47 | "Returns a variety of statistics about the current region and/or simulator", |
45 | DebugMonitors); | 48 | DebugMonitors); |
49 | |||
50 | MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage); | ||
51 | } | ||
52 | |||
53 | public Hashtable StatsPage(Hashtable request) | ||
54 | { | ||
55 | // If request was for a specific monitor | ||
56 | // eg url/?monitor=Monitor.Name | ||
57 | if (request.ContainsKey("monitor")) | ||
58 | { | ||
59 | string monID = (string) request["monitor"]; | ||
60 | |||
61 | foreach (IMonitor monitor in m_monitors) | ||
62 | { | ||
63 | if (monitor.ToString() == monID) | ||
64 | { | ||
65 | Hashtable ereply3 = new Hashtable(); | ||
66 | |||
67 | ereply3["int_response_code"] = 404; // 200 OK | ||
68 | ereply3["str_response_string"] = monitor.GetValue().ToString(); | ||
69 | ereply3["content_type"] = "text/plain"; | ||
70 | |||
71 | return ereply3; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | // No monitor with that name | ||
76 | Hashtable ereply2 = new Hashtable(); | ||
77 | |||
78 | ereply2["int_response_code"] = 404; // 200 OK | ||
79 | ereply2["str_response_string"] = "No such monitor"; | ||
80 | ereply2["content_type"] = "text/plain"; | ||
81 | |||
82 | return ereply2; | ||
83 | } | ||
84 | |||
85 | string xml = "<data>"; | ||
86 | foreach (IMonitor monitor in m_monitors) | ||
87 | { | ||
88 | xml += "<" + monitor.ToString() + ">" + monitor.GetValue() + "</" + monitor.ToString() + ">"; | ||
89 | } | ||
90 | xml += "</data>"; | ||
91 | |||
92 | Hashtable ereply = new Hashtable(); | ||
93 | |||
94 | ereply["int_response_code"] = 200; // 200 OK | ||
95 | ereply["str_response_string"] = xml; | ||
96 | ereply["content_type"] = "text/xml"; | ||
97 | |||
98 | return ereply; | ||
46 | } | 99 | } |
47 | 100 | ||
48 | public void PostInitialise() | 101 | public void PostInitialise() |