aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs50
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