aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Handlers/Web/WebServerConnector.cs37
-rw-r--r--example/web/stats.html22
2 files changed, 56 insertions, 3 deletions
diff --git a/OpenSim/Server/Handlers/Web/WebServerConnector.cs b/OpenSim/Server/Handlers/Web/WebServerConnector.cs
index 0f328d9..f06d4d8 100644
--- a/OpenSim/Server/Handlers/Web/WebServerConnector.cs
+++ b/OpenSim/Server/Handlers/Web/WebServerConnector.cs
@@ -242,14 +242,45 @@ namespace OpenSim.Server.Handlers.Web
242 return reply; 242 return reply;
243 } 243 }
244 244
245 long locIn = m_database.Count("Presence", "RegionID != '00000000-0000-0000-0000-000000000000'"); // Locals online but not HGing, and HGers in world. 245 long locIn = m_database.Count("Presence", "RegionID != '00000000-0000-0000-0000-000000000000'"); // Locals online but not HGing, and HGers in world.
246 long HGin = m_database.Count("Presence", "UserID NOT IN (SELECT PrincipalID FROM UserAccounts)"); // HGers in world. 246 long HGin = m_database.Count("Presence", "UserID NOT IN (SELECT PrincipalID FROM UserAccounts)"); // HGers in world.
247 ssi["hgers"] = HGin.ToString(); 247 ssi["hgers"] = HGin.ToString();
248 ssi["inworld"] = (locIn - HGin).ToString(); 248 ssi["inworld"] = (locIn - HGin).ToString();
249 ssi["outworld"] = m_database.Count("hg_traveling_data", "GridExternalName != '" + ssi["uri"] + "'").ToString(); // Locals that are HGing. 249 ssi["outworld"] = m_database.Count("hg_traveling_data", "GridExternalName != '" + ssi["uri"] + "'").ToString(); // Locals that are HGing.
250 ssi["members"] = m_database.Count("UserAccounts").ToString(); 250 ssi["members"] = m_database.Count("UserAccounts").ToString();
251 ssi["month"] = m_database.Count("GridUser", "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200))").ToString();
252 ssi["sims"] = m_database.Count("regions").ToString(); 251 ssi["sims"] = m_database.Count("regions").ToString();
252 ssi["onlineSims"] = m_database.Count("regions", "sizeX != 0").ToString();
253 ssi["varRegions"] = m_database.Count("regions", "sizeX > 256 or sizeY > 256").ToString();
254 ssi["singleSims"] = m_database.Count("regions", "sizeX = 256 and sizeY = 256").ToString();
255 ssi["offlineSims"] = m_database.Count("regions", "sizeX = 0").ToString();
256
257 // Calculate grid area.
258 long simSize = 0;
259 List< Hashtable > rows = m_database.Select("regions", "sizeX,sizeY", "sizeX != 0", "");
260 foreach (Hashtable row in rows)
261 {
262 simSize = simSize + Convert.ToInt32(row["sizeX"]) * Convert.ToInt32(row["sizeY"]);
263 }
264 ssi["simsSize"] = simSize.ToString();
265
266 // Count local and HG visitors for the last 30 and 60 days.
267 HGin = m_database.Count("GridUser", "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200))");
268 rows = m_database.Join("GridUser", "GridUser.UserID", "INNER JOIN UserAccounts ON GridUser.UserID = UserAccounts.PrincipalID",
269 "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200))", "");
270 locIn = rows.Count;
271 ssi["locDay30"] = locIn.ToString();
272 ssi["day30"] = HGin.ToString();
273 HGin = HGin - locIn;
274 ssi["HGday30"] = HGin.ToString();
275
276 HGin = m_database.Count("GridUser", "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 4838400))");
277 rows = m_database.Join("GridUser", "GridUser.UserID", "INNER JOIN UserAccounts ON GridUser.UserID = UserAccounts.PrincipalID",
278 "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 4838400))", "");
279 locIn = rows.Count;
280 ssi["locDay60"] = locIn.ToString();
281 ssi["day60"] = HGin.ToString();
282 HGin = HGin - locIn;
283 ssi["HGday60"] = HGin.ToString();
253 284
254 foreach (DictionaryEntry h in headers) 285 foreach (DictionaryEntry h in headers)
255 { 286 {
diff --git a/example/web/stats.html b/example/web/stats.html
new file mode 100644
index 0000000..1dce2f3
--- /dev/null
+++ b/example/web/stats.html
@@ -0,0 +1,22 @@
1<html>
2 <title><!--#echo var="grid" --> stats page</title>
3 <head>
4 <meta http-equiv="refresh" content="120">
5 </head>
6 <body>
7 <h1><!--#echo var="grid" --> statistics.</h1>
8 <p>Login URI - <!--#echo var="uri" --></p>
9 <p>Login page - <a href="<!--#echo var="uri" -->web/loginpage.html"><!--#echo var="uri" -->web/loginpage.html</a></p>
10 <p>There are <!--#echo var="members" --> members of this grid.</p>
11 <p>There are <!--#echo var="inworld" --> locals and <!--#echo var="hgers" --> hypergrid visitors in world right now.</p>
12 <p>There are <!--#echo var="outworld" --> locals out on the hypergrid right now.</p>
13 <p>There have been <!--#echo var="locDay30" --> locals and <!--#echo var="HGday30" --> hypergrid visitors on this grid in the last 30 days (<!--#echo var="day30" --> total).</p>
14 <p>There have been <!--#echo var="locDay60" --> locals and <!--#echo var="HGday60" --> hypergrid visitors on this grid in the last 60 days (<!--#echo var="day60" --> total).</p>
15 <p>There are <!--#echo var="sims" --> regions, though <!--#echo var="offlineSims" --> might not be online right now.</p>
16 <p>There may be <!--#echo var="onlineSims" --> regions online, with a total area of perhaps <!--#echo var="simsSize" --> square metres.</p>
17 <p>There are <!--#echo var="varRegions" --> varregions that might be online now.</p>
18 <p>There are <!--#echo var="singleSims" --> normal regions that might be online now.</p>
19 <p><!--#echo var="grid" --> is running <a href="https://sledjhamr.org/mantisbt/project_page.php?project_id=8"><!--#echo var="version" --></a></p>
20 <p>These statistics will update every two minutes.</p>
21 </body>
22</html>