Provide a way to turn the MonitorModule on and off
Default is currently on since this is the historical setting0.7.2-post-fixes
							parent
							
								
									21e3f8e53a
								
							
						
					
					
						commit
						31ef2f9a2e
					
				| 
						 | 
				
			
			@ -41,16 +41,48 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
 | 
			
		|||
{
 | 
			
		||||
    public class MonitorModule : IRegionModule 
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Is this module enabled?
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public bool Enabled { get; private set; }
 | 
			
		||||
 | 
			
		||||
        private Scene m_scene;
 | 
			
		||||
        private readonly List<IMonitor> m_monitors = new List<IMonitor>();
 | 
			
		||||
        private readonly List<IAlert> m_alerts = new List<IAlert>();
 | 
			
		||||
        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 | 
			
		||||
 | 
			
		||||
        #region Implementation of IRegionModule
 | 
			
		||||
 | 
			
		||||
        public MonitorModule()
 | 
			
		||||
        {
 | 
			
		||||
            Enabled = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        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",
 | 
			
		||||
                               "monitor report",
 | 
			
		||||
                               "Returns a variety of statistics about the current region and/or simulator",
 | 
			
		||||
                               DebugMonitors);
 | 
			
		||||
 | 
			
		||||
            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());
 | 
			
		||||
                m_log.Info("[MonitorModule]: " + m_scene.RegionInfo.RegionName + " reports " + monitor.GetName() + " = " + monitor.GetFriendlyValue());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -62,20 +94,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region Implementation of IRegionModule
 | 
			
		||||
 | 
			
		||||
        public void Initialise(Scene scene, IConfigSource source)
 | 
			
		||||
        {
 | 
			
		||||
            m_scene = scene;
 | 
			
		||||
 | 
			
		||||
            m_scene.AddCommand(this, "monitor report",
 | 
			
		||||
                               "monitor report",
 | 
			
		||||
                               "Returns a variety of statistics about the current region and/or simulator",
 | 
			
		||||
                               DebugMonitors);
 | 
			
		||||
 | 
			
		||||
            MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1400,6 +1400,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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue