diff options
author | Melanie | 2011-10-12 07:23:54 +0100 |
---|---|---|
committer | Melanie | 2011-10-12 07:23:54 +0100 |
commit | ad46ad1ab2ce3afe1649f0c58fa2066bc689b340 (patch) | |
tree | bdeca8c94e76f83553b9e1f155670a4ea66839f3 /OpenSim/Region | |
parent | Merge commit '2b290793ab7153c956db5637dd27dfbbd0a1cf98' into bigmerge (diff) | |
parent | Provide a way to turn the MonitorModule on and off (diff) | |
download | opensim-SC_OLD-ad46ad1ab2ce3afe1649f0c58fa2066bc689b340.zip opensim-SC_OLD-ad46ad1ab2ce3afe1649f0c58fa2066bc689b340.tar.gz opensim-SC_OLD-ad46ad1ab2ce3afe1649f0c58fa2066bc689b340.tar.bz2 opensim-SC_OLD-ad46ad1ab2ce3afe1649f0c58fa2066bc689b340.tar.xz |
Merge commit '8114f895c2973ac9e2e456ac2aaad8deb23f3852' into bigmerge
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index 09095c2..057ed6f 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -41,31 +41,33 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
41 | { | 41 | { |
42 | public class MonitorModule : IRegionModule | 42 | public class MonitorModule : IRegionModule |
43 | { | 43 | { |
44 | /// <summary> | ||
45 | /// Is this module enabled? | ||
46 | /// </summary> | ||
47 | public bool Enabled { get; private set; } | ||
48 | |||
44 | private Scene m_scene; | 49 | private Scene m_scene; |
45 | private readonly List<IMonitor> m_monitors = new List<IMonitor>(); | 50 | private readonly List<IMonitor> m_monitors = new List<IMonitor>(); |
46 | private readonly List<IAlert> m_alerts = new List<IAlert>(); | 51 | private readonly List<IAlert> m_alerts = new List<IAlert>(); |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 53 | ||
49 | public void DebugMonitors(string module, string[] args) | 54 | #region Implementation of IRegionModule |
50 | { | ||
51 | foreach (IMonitor monitor in m_monitors) | ||
52 | { | ||
53 | m_log.Info("[MonitorModule] " + m_scene.RegionInfo.RegionName + " reports " + monitor.GetName() + " = " + monitor.GetFriendlyValue()); | ||
54 | } | ||
55 | } | ||
56 | 55 | ||
57 | public void TestAlerts() | 56 | public MonitorModule() |
58 | { | 57 | { |
59 | foreach (IAlert alert in m_alerts) | 58 | Enabled = true; |
60 | { | ||
61 | alert.Test(); | ||
62 | } | ||
63 | } | 59 | } |
64 | 60 | ||
65 | #region Implementation of IRegionModule | ||
66 | |||
67 | public void Initialise(Scene scene, IConfigSource source) | 61 | public void Initialise(Scene scene, IConfigSource source) |
68 | { | 62 | { |
63 | IConfig cnfg = source.Configs["Monitoring"]; | ||
64 | |||
65 | if (cnfg != null) | ||
66 | Enabled = cnfg.GetBoolean("Enabled", true); | ||
67 | |||
68 | if (!Enabled) | ||
69 | return; | ||
70 | |||
69 | m_scene = scene; | 71 | m_scene = scene; |
70 | 72 | ||
71 | m_scene.AddCommand(this, "monitor report", | 73 | m_scene.AddCommand(this, "monitor report", |
@@ -76,6 +78,22 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
76 | MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage); | 78 | MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage); |
77 | } | 79 | } |
78 | 80 | ||
81 | public void DebugMonitors(string module, string[] args) | ||
82 | { | ||
83 | foreach (IMonitor monitor in m_monitors) | ||
84 | { | ||
85 | m_log.Info("[MonitorModule]: " + m_scene.RegionInfo.RegionName + " reports " + monitor.GetName() + " = " + monitor.GetFriendlyValue()); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | public void TestAlerts() | ||
90 | { | ||
91 | foreach (IAlert alert in m_alerts) | ||
92 | { | ||
93 | alert.Test(); | ||
94 | } | ||
95 | } | ||
96 | |||
79 | public Hashtable StatsPage(Hashtable request) | 97 | public Hashtable StatsPage(Hashtable request) |
80 | { | 98 | { |
81 | // If request was for a specific monitor | 99 | // If request was for a specific monitor |
@@ -133,6 +151,9 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
133 | 151 | ||
134 | public void PostInitialise() | 152 | public void PostInitialise() |
135 | { | 153 | { |
154 | if (!Enabled) | ||
155 | return; | ||
156 | |||
136 | m_monitors.Add(new AgentCountMonitor(m_scene)); | 157 | m_monitors.Add(new AgentCountMonitor(m_scene)); |
137 | m_monitors.Add(new ChildAgentCountMonitor(m_scene)); | 158 | m_monitors.Add(new ChildAgentCountMonitor(m_scene)); |
138 | m_monitors.Add(new GCMemoryMonitor()); | 159 | m_monitors.Add(new GCMemoryMonitor()); |
@@ -161,7 +182,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
161 | 182 | ||
162 | public void Close() | 183 | public void Close() |
163 | { | 184 | { |
164 | |||
165 | } | 185 | } |
166 | 186 | ||
167 | public string Name | 187 | public string Name |