From 8114f895c2973ac9e2e456ac2aaad8deb23f3852 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 10 Oct 2011 22:17:29 +0100
Subject: Provide a way to turn the MonitorModule on and off
Default is currently on since this is the historical setting
---
.../Framework/Monitoring/MonitorModule.cs | 50 +++++++++++++++-------
1 file changed, 35 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region')
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
{
public class MonitorModule : IRegionModule
{
+ ///
+ /// Is this module enabled?
+ ///
+ public bool Enabled { get; private set; }
+
private Scene m_scene;
private readonly List m_monitors = new List();
private readonly List m_alerts = new List();
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- public void DebugMonitors(string module, string[] args)
- {
- foreach (IMonitor monitor in m_monitors)
- {
- m_log.Info("[MonitorModule] " + m_scene.RegionInfo.RegionName + " reports " + monitor.GetName() + " = " + monitor.GetFriendlyValue());
- }
- }
+ #region Implementation of IRegionModule
- public void TestAlerts()
+ public MonitorModule()
{
- foreach (IAlert alert in m_alerts)
- {
- alert.Test();
- }
+ Enabled = true;
}
- #region Implementation of IRegionModule
-
public void Initialise(Scene scene, IConfigSource source)
{
+ IConfig cnfg = source.Configs["Monitoring"];
+
+ if (cnfg != null)
+ Enabled = cnfg.GetBoolean("Enabled", true);
+
+ if (!Enabled)
+ return;
+
m_scene = scene;
m_scene.AddCommand(this, "monitor report",
@@ -76,6 +78,22 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage);
}
+ public void DebugMonitors(string module, string[] args)
+ {
+ foreach (IMonitor monitor in m_monitors)
+ {
+ m_log.Info("[MonitorModule]: " + m_scene.RegionInfo.RegionName + " reports " + monitor.GetName() + " = " + monitor.GetFriendlyValue());
+ }
+ }
+
+ public void TestAlerts()
+ {
+ foreach (IAlert alert in m_alerts)
+ {
+ alert.Test();
+ }
+ }
+
public Hashtable StatsPage(Hashtable request)
{
// If request was for a specific monitor
@@ -133,6 +151,9 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
public void PostInitialise()
{
+ if (!Enabled)
+ return;
+
m_monitors.Add(new AgentCountMonitor(m_scene));
m_monitors.Add(new ChildAgentCountMonitor(m_scene));
m_monitors.Add(new GCMemoryMonitor());
@@ -161,7 +182,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
public void Close()
{
-
}
public string Name
--
cgit v1.1