Add 'server' stats information to pCampbot, as used elsewhere in OpenSimulator
This adds the "show stats", "stats record", etc. commands and information on available Threadpool threads, etc. It also adds the Watchdog which logs warnings if time between executions is unexpectedly large.bullet-2.82
parent
f1cec684e2
commit
f1f935ed95
|
@ -82,6 +82,9 @@ namespace OpenSim.Framework.Monitoring
|
||||||
// IRegionModuleBase.Initialize
|
// IRegionModuleBase.Initialize
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
|
if (source == null)
|
||||||
|
return;
|
||||||
|
|
||||||
IConfig cfg = source.Configs["Monitoring"];
|
IConfig cfg = source.Configs["Monitoring"];
|
||||||
|
|
||||||
if (cfg != null)
|
if (cfg != null)
|
||||||
|
|
|
@ -38,6 +38,7 @@ using log4net.Repository;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Framework.Monitoring;
|
||||||
using pCampBot.Interfaces;
|
using pCampBot.Interfaces;
|
||||||
|
|
||||||
namespace pCampBot
|
namespace pCampBot
|
||||||
|
@ -142,6 +143,11 @@ namespace pCampBot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private HashSet<string> m_defaultBehaviourSwitches = new HashSet<string>();
|
private HashSet<string> m_defaultBehaviourSwitches = new HashSet<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Collects general information on this server (which reveals this to be a misnamed class).
|
||||||
|
/// </summary>
|
||||||
|
private ServerStatsCollector m_serverStatsCollector;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
|
/// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -151,6 +157,12 @@ namespace pCampBot
|
||||||
// to multiple regions.
|
// to multiple regions.
|
||||||
Settings.MAX_HTTP_CONNECTIONS = int.MaxValue;
|
Settings.MAX_HTTP_CONNECTIONS = int.MaxValue;
|
||||||
|
|
||||||
|
// System.Threading.ThreadPool.SetMaxThreads(600, 240);
|
||||||
|
//
|
||||||
|
// int workerThreads, iocpThreads;
|
||||||
|
// System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
|
||||||
|
// Console.WriteLine("ThreadPool.GetMaxThreads {0} {1}", workerThreads, iocpThreads);
|
||||||
|
|
||||||
InitBotSendAgentUpdates = true;
|
InitBotSendAgentUpdates = true;
|
||||||
InitBotRequestObjectTextures = true;
|
InitBotRequestObjectTextures = true;
|
||||||
|
|
||||||
|
@ -234,6 +246,14 @@ namespace pCampBot
|
||||||
"Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);
|
"Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);
|
||||||
|
|
||||||
m_bots = new List<Bot>();
|
m_bots = new List<Bot>();
|
||||||
|
|
||||||
|
Watchdog.Enabled = true;
|
||||||
|
StatsManager.RegisterConsoleCommands(m_console);
|
||||||
|
|
||||||
|
m_serverStatsCollector = new ServerStatsCollector();
|
||||||
|
m_serverStatsCollector.Initialise(null);
|
||||||
|
m_serverStatsCollector.Enabled = true;
|
||||||
|
m_serverStatsCollector.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -697,6 +717,8 @@ namespace pCampBot
|
||||||
|
|
||||||
MainConsole.Instance.Output("Shutting down");
|
MainConsole.Instance.Output("Shutting down");
|
||||||
|
|
||||||
|
m_serverStatsCollector.Close();
|
||||||
|
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -10,6 +10,10 @@
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<log4net>
|
<log4net>
|
||||||
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
|
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
|
||||||
|
<filter type="log4net.Filter.LoggerMatchFilter">
|
||||||
|
<loggerToMatch value="special"/>
|
||||||
|
<acceptOnMatch value="false"/>
|
||||||
|
</filter>
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
<conversionPattern value="%date{HH:mm:ss.fff} - %message" />
|
<conversionPattern value="%date{HH:mm:ss.fff} - %message" />
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -17,15 +21,32 @@
|
||||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||||
<file value="pCampBot.log" />
|
<file value="pCampBot.log" />
|
||||||
<appendToFile value="true" />
|
<appendToFile value="true" />
|
||||||
|
<filter type="log4net.Filter.LoggerMatchFilter">
|
||||||
|
<loggerToMatch value="special"/>
|
||||||
|
<acceptOnMatch value="false"/>
|
||||||
|
</filter>
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
<appender name="StatsLogFileAppender" type="log4net.Appender.FileAppender">
|
||||||
|
<file value="pCampBotStats.log"/>
|
||||||
|
<appendToFile value="true" />
|
||||||
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
|
<conversionPattern value="%date - %message%newline" />
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
<root>
|
<root>
|
||||||
<level value="DEBUG" />
|
<level value="DEBUG" />
|
||||||
<appender-ref ref="Console" />
|
<appender-ref ref="Console" />
|
||||||
<appender-ref ref="LogFileAppender" />
|
<appender-ref ref="LogFileAppender" />
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
|
<!-- used for stats recording -->
|
||||||
|
<logger name="special.StatsLogger">
|
||||||
|
<appender-ref ref="StatsLogFileAppender"/>
|
||||||
|
</logger>
|
||||||
</log4net>
|
</log4net>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -2531,6 +2531,7 @@
|
||||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
|
<Reference name="OpenSim.Framework.Monitoring"/>
|
||||||
<Reference name="Nini" path="../../../bin/"/>
|
<Reference name="Nini" path="../../../bin/"/>
|
||||||
<Reference name="log4net" path="../../../bin/"/>
|
<Reference name="log4net" path="../../../bin/"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue