diff --git a/htroot/Network.html b/htroot/Network.html index 9ef9e94d4..675a43df1 100644 --- a/htroot/Network.html +++ b/htroot/Network.html @@ -62,6 +62,7 @@
  • Active Principal and Senior Peers
  • Passive Senior Peers
  • Junior (fragment) Peers
  • +
  • Network History
  • #(/menu)# @@ -85,6 +86,8 @@ document.getElementById("apilink").setAttribute("href", "Network.xml?" + window.

    Junior Peers (a fragment) in '#[networkName]#' Network

    ::

    Manually contacting Peer

    + :: +

    Network History

    #(/page)# #(regexerror)# :: @@ -319,8 +322,8 @@ document.getElementById("apilink").setAttribute("href", "Network.xml?" + window. - - :: +:: +:: #(comment)# ::

    @@ -369,6 +372,29 @@ document.getElementById("apilink").setAttribute("href", "Network.xml?" + window. +:: + +

    Count of Connected Senior Peers in the last two days, scale = 1h

    + +

    Count of all Active Peers Per Day in the last week, scale = 1d

    + +

    Count of all Active Peers Per Week in the last 30d, scale = 7d

    + +

    Count of all Active Peers Per Month in the last 365d, scale = 30d

    + #(/table)# #%env/templates/footer.template%# diff --git a/htroot/Network.java b/htroot/Network.java index ca0142650..23377ed76 100644 --- a/htroot/Network.java +++ b/htroot/Network.java @@ -199,7 +199,7 @@ public class Network { prop.put("table", 2); // triggers overview prop.put("page", 0); } else if (post != null && post.getInt("page", 1) == 4) { - prop.put("table", 4); // triggers overview + prop.put("table", 4); // triggers "Manually contacting Peer" prop.put("page", 4); if (sb.peers.mySeed() != null) { @@ -258,6 +258,9 @@ public class Network { prop.put("table_comment",0); } + } else if (post != null && post.getInt("page", 1) == 5) { + prop.put("page", 5); // triggers stats page + prop.put("table", 5); } else { // generate table final int page = (post == null ? 1 : post.getInt("page", 1)); diff --git a/htroot/NetworkHistory.java b/htroot/NetworkHistory.java index 495db9eaf..56e16b72d 100644 --- a/htroot/NetworkHistory.java +++ b/htroot/NetworkHistory.java @@ -24,8 +24,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Set; import net.yacy.cora.date.GenericFormatter; import net.yacy.cora.document.encoding.ASCII; @@ -49,7 +51,7 @@ public class NetworkHistory { final int maxtime = post.getInt("maxtime", 48); // hours final int bottomscale = post.getInt("scale", 1); // 1h - final String[] columns = post.get("columns", "cC").split("\\|"); // new String[]{"aM", "aW", "aD", "aH", "cC", "cD", "cP", "cR", "cI"}; + final String[] columnsx = post.get("columns", "cC").split("\\|"); // new String[]{"aM", "aW", "aD", "aH", "cC", "cD", "cP", "cR", "cI"}; /* aM activeLastMonth aW activeLastWeek @@ -61,11 +63,12 @@ public class NetworkHistory { cR count of the RWI entries cI size of the index (number of documents) */ - + final Set columns = new LinkedHashSet<>(); + for (String col: columnsx) columns.add(col); // scan the database and put in values List> rows = new ArrayList<>(maxtime * 2); long now = System.currentTimeMillis(); - long timelimit = now - maxtime * 60 * 60 * 1000; + long timelimit = now - maxtime * 3600000L; try { // BEncodedHeap statTable = sb.tables.getHeap("stats"); // Iterator i = statTable.keys(false, false); @@ -105,8 +108,22 @@ public class NetworkHistory { final int topborder = 20; final int bottomborder = 20; final int vspace = height - topborder - bottomborder; - final int leftscale = (maxpeers / 100) * 10; - ChartPlotter chart = new ChartPlotter(width, height, 0xFFFFFFl, 0x000000l, 0xAAAAAAl, leftborder, rightborder, topborder, bottomborder, "YACY NETWORK HISTORY", "IN THE LAST 48 HOURS"); + final int leftscale = maxpeers / 10; + String timestr = maxtime + " HOURS"; + if (maxtime > 24 && maxtime % 24 == 0) timestr = (maxtime / 24) + " DAYS"; + if (maxtime == 168) timestr = "WEEK"; + if (maxtime > 168 && maxtime % 168 == 0) timestr = (maxtime / 168) + " WEEKS"; + String headline = "YACY NETWORK HISTORY"; + if (columns.contains("aM")) headline += ", ACTIVE PEERS WITHIN THE LAST MONTH"; + if (columns.contains("aW")) headline += ", ACTIVE PEERS WITHIN THE LAST WEEK"; + if (columns.contains("aD")) headline += ", ACTIVE PEERS WITHIN THE LAST DAY"; + if (columns.contains("aH")) headline += ", ACTIVE PEERS WITHIN THE LAST HOUR"; + if (columns.contains("cC")) headline += ", ACTIVE SENIOR PEERS"; + if (columns.contains("cD")) headline += ", PASSIVE SENIOR PEERS"; + if (columns.contains("cP")) headline += ", POTENTIAL JUNIOR PEERS"; + if (columns.contains("cI")) headline = "YACY INDEX SIZE HISTORY: NUMBER OF DOCUMENTS"; + if (columns.contains("cR")) headline = "YACY INDEX SIZE HISTORY: NUMBER OF RWI ENTRIES"; + ChartPlotter chart = new ChartPlotter(width, height, 0xFFFFFFl, 0x000000l, 0xAAAAAAl, leftborder, rightborder, topborder, bottomborder, headline, "IN THE LAST " + timestr); chart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, 0x000000l, 0xCCCCCCl, "TIME/HOURS"); chart.declareDimension(ChartPlotter.DIMENSION_LEFT, leftscale, vspace * leftscale / maxpeers, 0, 0x008800l, null , "PEERS"); diff --git a/htroot/Tables_p.java b/htroot/Tables_p.java index d2c3cc5ee..1f6a5ac05 100644 --- a/htroot/Tables_p.java +++ b/htroot/Tables_p.java @@ -190,7 +190,7 @@ public class Tables_p { } // adding the peer address - prop.put("address", sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP())); + //prop.put("address", sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP())); // return rewrite properties return prop;