diff options
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | 103 |
1 files changed, 61 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index f15f8f6..0135d33 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -25,10 +25,12 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections; | 29 | using System.Collections; |
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
32 | using Nini.Config; | 34 | using Nini.Config; |
33 | using OpenMetaverse; | 35 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
@@ -39,7 +41,8 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | 41 | ||
40 | namespace OpenSim.Region.CoreModules.Framework.Monitoring | 42 | namespace OpenSim.Region.CoreModules.Framework.Monitoring |
41 | { | 43 | { |
42 | public class MonitorModule : IRegionModule | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
45 | public class MonitorModule : INonSharedRegionModule | ||
43 | { | 46 | { |
44 | private Scene m_scene; | 47 | private Scene m_scene; |
45 | private readonly List<IMonitor> m_monitors = new List<IMonitor>(); | 48 | private readonly List<IMonitor> m_monitors = new List<IMonitor>(); |
@@ -62,9 +65,19 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
62 | } | 65 | } |
63 | } | 66 | } |
64 | 67 | ||
65 | #region Implementation of IRegionModule | 68 | #region Implementation of INonSharedRegionModule |
66 | 69 | ||
67 | public void Initialise(Scene scene, IConfigSource source) | 70 | public void Initialise(IConfigSource source) |
71 | { | ||
72 | |||
73 | } | ||
74 | |||
75 | public Type ReplaceableInterface | ||
76 | { | ||
77 | get { return null; } | ||
78 | } | ||
79 | |||
80 | public void AddRegion(Scene scene) | ||
68 | { | 81 | { |
69 | m_scene = scene; | 82 | m_scene = scene; |
70 | 83 | ||
@@ -77,6 +90,51 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
77 | MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage); | 90 | MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage); |
78 | } | 91 | } |
79 | 92 | ||
93 | public void RegionLoaded(Scene scene) | ||
94 | { | ||
95 | m_monitors.Add(new AgentCountMonitor(m_scene)); | ||
96 | m_monitors.Add(new ChildAgentCountMonitor(m_scene)); | ||
97 | m_monitors.Add(new GCMemoryMonitor()); | ||
98 | m_monitors.Add(new ObjectCountMonitor(m_scene)); | ||
99 | m_monitors.Add(new PhysicsFrameMonitor(m_scene)); | ||
100 | m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene)); | ||
101 | m_monitors.Add(new PWSMemoryMonitor()); | ||
102 | m_monitors.Add(new ThreadCountMonitor()); | ||
103 | m_monitors.Add(new TotalFrameMonitor(m_scene)); | ||
104 | m_monitors.Add(new EventFrameMonitor(m_scene)); | ||
105 | m_monitors.Add(new LandFrameMonitor(m_scene)); | ||
106 | m_monitors.Add(new LastFrameTimeMonitor(m_scene)); | ||
107 | |||
108 | m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor)); | ||
109 | |||
110 | foreach (IAlert alert in m_alerts) | ||
111 | { | ||
112 | alert.OnTriggerAlert += OnTriggerAlert; | ||
113 | } | ||
114 | } | ||
115 | |||
116 | public void RemoveRegion(Scene scene) | ||
117 | { | ||
118 | MainServer.Instance.RemoveHTTPHandler("", "/monitorstats/" + m_scene.RegionInfo.RegionID + "/"); | ||
119 | m_monitors.Clear(); | ||
120 | |||
121 | foreach (IAlert alert in m_alerts) | ||
122 | { | ||
123 | alert.OnTriggerAlert -= OnTriggerAlert; | ||
124 | } | ||
125 | m_alerts.Clear(); | ||
126 | } | ||
127 | |||
128 | public void Close() | ||
129 | { | ||
130 | |||
131 | } | ||
132 | |||
133 | public string Name | ||
134 | { | ||
135 | get { return "Region Health Monitoring Module"; } | ||
136 | } | ||
137 | |||
80 | public Hashtable StatsPage(Hashtable request) | 138 | public Hashtable StatsPage(Hashtable request) |
81 | { | 139 | { |
82 | // If request was for a specific monitor | 140 | // If request was for a specific monitor |
@@ -132,49 +190,10 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
132 | return ereply; | 190 | return ereply; |
133 | } | 191 | } |
134 | 192 | ||
135 | public void PostInitialise() | ||
136 | { | ||
137 | m_monitors.Add(new AgentCountMonitor(m_scene)); | ||
138 | m_monitors.Add(new ChildAgentCountMonitor(m_scene)); | ||
139 | m_monitors.Add(new GCMemoryMonitor()); | ||
140 | m_monitors.Add(new ObjectCountMonitor(m_scene)); | ||
141 | m_monitors.Add(new PhysicsFrameMonitor(m_scene)); | ||
142 | m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene)); | ||
143 | m_monitors.Add(new PWSMemoryMonitor()); | ||
144 | m_monitors.Add(new ThreadCountMonitor()); | ||
145 | m_monitors.Add(new TotalFrameMonitor(m_scene)); | ||
146 | m_monitors.Add(new EventFrameMonitor(m_scene)); | ||
147 | m_monitors.Add(new LandFrameMonitor(m_scene)); | ||
148 | m_monitors.Add(new LastFrameTimeMonitor(m_scene)); | ||
149 | |||
150 | m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor)); | ||
151 | |||
152 | foreach (IAlert alert in m_alerts) | ||
153 | { | ||
154 | alert.OnTriggerAlert += OnTriggerAlert; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | void OnTriggerAlert(System.Type reporter, string reason, bool fatal) | 193 | void OnTriggerAlert(System.Type reporter, string reason, bool fatal) |
159 | { | 194 | { |
160 | m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); | 195 | m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); |
161 | } | 196 | } |
162 | |||
163 | public void Close() | ||
164 | { | ||
165 | |||
166 | } | ||
167 | |||
168 | public string Name | ||
169 | { | ||
170 | get { return "Region Health Monitoring Module"; } | ||
171 | } | ||
172 | |||
173 | public bool IsSharedModule | ||
174 | { | ||
175 | get { return false; } | ||
176 | } | ||
177 | |||
178 | #endregion | 197 | #endregion |
179 | } | 198 | } |
180 | } | 199 | } |