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 +++++++++++++++------- bin/OpenSimDefaults.ini | 5 +++ 2 files changed, 40 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 { 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 diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 8660f4f..9cedd98 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1417,6 +1417,11 @@ RootReprioritizationDistance = 10.0 ChildReprioritizationDistance = 20.0 +[Monitoring] + ; Enable region monitoring + ; If true, this will print out an error if more than a minute has passed since the last simulator frame + ; Also is another source of region statistics provided via the regionstats URL + Enabled = true ; View region statistics via a web page ; See http://opensimulator.org/wiki/FAQ#Region_Statistics_on_a_Web_Page -- cgit v1.1