2012-02-02 23:37:21 +00:00
|
|
|
<%--
|
|
|
|
Copyright (c) 2012, Andy Janata
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification, are permitted
|
|
|
|
provided that the following conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
|
|
|
and the following disclaimer.
|
|
|
|
* Redistributions in binary form must reproduce the above copyright notice, this list of
|
|
|
|
conditions and the following disclaimer in the documentation and/or other materials provided
|
|
|
|
with the distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
|
|
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
|
|
|
|
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
--%>
|
|
|
|
<%--
|
|
|
|
A simple stats page. Outputs the number of connected users and active game lobbies. This is intended
|
|
|
|
to be used with a script for munin. This is instantaneous usage, so it will not necessarily be the
|
|
|
|
most useful graph if it is only updated every 15 minutes, but it is still nice to have.
|
2012-02-06 22:00:24 +00:00
|
|
|
|
|
|
|
@author Andy Janata (ajanata@socialgamer.net)
|
2012-02-02 23:37:21 +00:00
|
|
|
--%>
|
|
|
|
<%@ page language="java" contentType="text/plain; charset=UTF-8" pageEncoding="UTF-8" %>
|
2013-12-01 06:09:55 +00:00
|
|
|
<%@ page import="java.util.Properties" %>
|
2012-02-02 23:37:21 +00:00
|
|
|
<%@ page import="com.google.inject.Injector" %>
|
|
|
|
<%@ page import="net.socialgamer.cah.data.ConnectedUsers" %>
|
|
|
|
<%@ page import="net.socialgamer.cah.data.GameManager" %>
|
|
|
|
<%@ page import="net.socialgamer.cah.StartupUtils" %>
|
|
|
|
<%
|
|
|
|
ServletContext servletContext = pageContext.getServletContext();
|
|
|
|
Injector injector = (Injector) servletContext.getAttribute(StartupUtils.INJECTOR);
|
|
|
|
|
|
|
|
ConnectedUsers users = injector.getInstance(ConnectedUsers.class);
|
|
|
|
GameManager games = injector.getInstance(GameManager.class);
|
2013-12-01 06:09:55 +00:00
|
|
|
Properties props = injector.getInstance(Properties.class);
|
2012-02-02 23:37:21 +00:00
|
|
|
|
|
|
|
out.clear();
|
|
|
|
out.println("USERS " + users.getUsers().size());
|
|
|
|
out.println("GAMES " + games.getGameList().size());
|
2013-12-01 06:09:55 +00:00
|
|
|
out.println("MAX_USERS " + props.get("pyx.server.max_users"));
|
|
|
|
out.println("MAX_GAMES " + props.get("pyx.server.max_games"));
|
2012-02-06 22:00:24 +00:00
|
|
|
%>
|