aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
diff options
context:
space:
mode:
authoronefang2019-08-06 01:08:51 +1000
committeronefang2019-08-06 01:08:51 +1000
commit659229c0777f381c66462fd7a4f2dfddbe3e1ef6 (patch)
tree2f116e87a2b8f00a29d6f057ef6848ccda78927c /OpenSim/Server/Handlers/Web/WebServerInConnector.cs
parentAdd a more direct MySQL handler. (diff)
downloadopensim-SC-659229c0777f381c66462fd7a4f2dfddbe3e1ef6.zip
opensim-SC-659229c0777f381c66462fd7a4f2dfddbe3e1ef6.tar.gz
opensim-SC-659229c0777f381c66462fd7a4f2dfddbe3e1ef6.tar.bz2
opensim-SC-659229c0777f381c66462fd7a4f2dfddbe3e1ef6.tar.xz
Add actual grid stats to the web page.
Except HGers, still trying to sort that one out.
Diffstat (limited to 'OpenSim/Server/Handlers/Web/WebServerInConnector.cs')
-rw-r--r--OpenSim/Server/Handlers/Web/WebServerInConnector.cs48
1 files changed, 40 insertions, 8 deletions
diff --git a/OpenSim/Server/Handlers/Web/WebServerInConnector.cs b/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
index e7fb2fc..01c74fe 100644
--- a/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
+++ b/OpenSim/Server/Handlers/Web/WebServerInConnector.cs
@@ -38,6 +38,7 @@ using OpenMetaverse;
38using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
39using Nini.Config; 39using Nini.Config;
40using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Data.MySQL;
41using OpenSim.Framework.Servers.HttpServer; 42using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Server.Handlers.Base; 43using OpenSim.Server.Handlers.Base;
43 44
@@ -48,12 +49,39 @@ namespace OpenSim.Server.Handlers.Web
48 // This is all slow and clunky, it's not a real web server, just something to use if you don't want a real one. 49 // This is all slow and clunky, it's not a real web server, just something to use if you don't want a real one.
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private IConfigSource m_Config; 51 private IConfigSource m_Config;
52 protected MySQLGenericHandler m_Database = null;
51 private Hashtable mime = new Hashtable(); 53 private Hashtable mime = new Hashtable();
52 private Hashtable ssi = new Hashtable(); 54 private Hashtable ssi = new Hashtable();
53 55
54 public WebServerInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) 56 public WebServerInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName)
55 { 57 {
56 m_Config = config; 58 m_Config = config;
59
60 string dllName = String.Empty;
61 string connString = String.Empty;
62
63 //
64 // Try reading the [DatabaseService] section, if it exists
65 //
66 IConfig dbConfig = m_Config.Configs["DatabaseService"];
67 if (dbConfig != null)
68 {
69 if (dllName == String.Empty)
70 dllName = dbConfig.GetString("StorageProvider", String.Empty);
71 if (connString == String.Empty)
72 connString = dbConfig.GetString("ConnectionString", String.Empty);
73 }
74
75 if (dllName.Equals(String.Empty))
76 throw new Exception("No StorageProvider configured");
77
78//// TODO - Should do the plugin thing to pick between database backends.
79// m_Database = LoadPlugin<SQLGenericHandler>(dllName, new Object[] { connString });
80 m_Database = new MySQLGenericHandler(connString);
81 if (m_Database == null)
82 throw new Exception("Could not find a storage interface in the given module " + dllName);
83
84
57 mime.Add(".gz", "application/gzip"); 85 mime.Add(".gz", "application/gzip");
58 mime.Add(".js", "application/javascript"); 86 mime.Add(".js", "application/javascript");
59 mime.Add(".json", "application/json"); 87 mime.Add(".json", "application/json");
@@ -90,15 +118,19 @@ namespace OpenSim.Server.Handlers.Web
90 118
91 private Hashtable WebRequestHandler(Hashtable request) 119 private Hashtable WebRequestHandler(Hashtable request)
92 { 120 {
121 long locIn = m_Database.GetCount("Presence", "RegionID != '00000000-0000-0000-0000-000000000000'"); // Locals online but not HGing.
122// long HGin = m_Database.GetCount("hg_traveling_data", "GridExternalName = '" + ssi["uri"] + "'"); // HGers in world, and locals not HGing, sometimes more than once.
123 long locOut = m_Database.GetCount("hg_traveling_data", "GridExternalName != '" + ssi["uri"] + "'"); // Locals that are HGing.
93 Hashtable reply = new Hashtable(); 124 Hashtable reply = new Hashtable();
94 // Looks like we have to jump through hoops to do simple database queries. B-( 125 ssi["members"] = m_Database.GetCount("UserAccounts").ToString();
95 ssi["members"] = "?"; // SELECT COUNT(PrincipalID) FROM UserAccounts 126 ssi["sims"] = m_Database.GetCount("regions").ToString();
96 ssi["inworld"] = "?"; // SELECT COUNT(UserID) FROM presence_culled; Includes locals and HGers in world, but not locals HGing. 127 ssi["inworld"] = locIn.ToString();
97 // SELECT COUNT(UserID) FROM users_online; Includes local online only. 128 ssi["outworld"] = locOut.ToString();
98 ssi["outworld"] = "?"; // SELECT COUNT(UserID) FROM hg_traveling_data WHERE GridExternalName != ssi["uri"]; Includes locals that are HGing. 129// ssi["hgers"] = HGin.ToString();
99// ssi["hgers"] = "?"; // This is complex. 130 ssi["hgers"] = "?";
100 ssi["sims"] = "?"; // SELECT COUNT(uuid) FROM regions 131 ssi["month"] = m_Database.GetCount("GridUser", "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200))").ToString();
101// ssi["month"] = "?"; // SELECT COUNT(UserID) FROM Presence WHERE LastSeen < one month ago 2017-11-28 09:01:51; Includes external HGers, and locals on now. 132 // SELECT COUNT(UserID) FROM Presence WHERE LastSeen < one month ago 2017-11-28 09:01:51; This is not accurate, and never has been.
133 // SELECT COUNT(UserID) FROM {GridUser} WHERE Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200)
102 134
103 string reqpath = (string) request["uri"]; 135 string reqpath = (string) request["uri"];
104 string[] query = (string[]) request["querystringkeys"]; 136 string[] query = (string[]) request["querystringkeys"];