2006-03-16 jrandom

* Integrate basic hooks for jrobin (http://jrobin.org) into the router
      console.  Selected stats can be harvested automatically and fed into
      in-memory RRD databases, and those databases can be served up either as
      PNG images or as RRDtool compatible XML dumps (see oldstats.jsp for
      details).  A base set of stats are harvested by default, but an
      alternate list can be specified by setting the 'stat.summaries' list on
      the advanced config.  For instance:
      stat.summaries=bw.recvRate.60000,bw.sendRate.60000
    * HTML tweaking for the general config page (thanks void!)
    * Odd NPE fix (thanks Complication!)
This commit is contained in:
jrandom
2006-03-16 21:45:17 +00:00
committed by zzz
parent 349adf6690
commit 65dc803fb7
19 changed files with 468 additions and 32 deletions

View File

@ -44,6 +44,7 @@
Bandwidth share percentage:
<jsp:getProperty name="nethelper" property="sharePercentageBox" /><br />
Sharing a higher percentage will improve your anonymity and help the network
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /><br />
<hr />
<b>Enable load testing: </b>
<input type="checkbox" name="enableloadtesting" value="true" <jsp:getProperty name="nethelper" property="enableLoadTesting" /> />

View File

@ -0,0 +1,37 @@
<%
net.i2p.stat.Rate rate = null;
String stat = request.getParameter("stat");
String period = request.getParameter("period");
net.i2p.stat.RateStat rs = net.i2p.I2PAppContext.getGlobalContext().statManager().getRate(stat);
boolean rendered = false;
if (rs != null) {
long per = -1;
try {
per = Long.parseLong(period);
rate = rs.getRate(per);
if (rate != null) {
java.io.OutputStream cout = response.getOutputStream();
String format = request.getParameter("format");
if ("xml".equals(format)) {
response.setContentType("text/xml");
rendered = net.i2p.router.web.StatSummarizer.instance().getXML(rate, cout);
} else {
response.setContentType("image/png");
int width = -1;
int height = -1;
String str = request.getParameter("width");
if (str != null) try { width = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
str = request.getParameter("height");
if (str != null) try { height = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
rendered = net.i2p.router.web.StatSummarizer.instance().renderPng(rate, cout, width, height);
}
if (rendered)
cout.close();
//System.out.println("Rendered period " + per + " for the stat " + stat + "? " + rendered);
}
} catch (NumberFormatException nfe) {}
}
if (!rendered) {
response.sendError(404, "That stat is not available");
}
%>