<%@ page import="org.apache.solr.core.SolrCore, org.apache.solr.core.SolrInfoMBean, org.apache.solr.core.SolrInfoRegistry, org.apache.solr.schema.IndexSchema, org.apache.solr.util.NamedList, java.io.File"%> <%@ page import="java.net.InetAddress"%> <%@ page import="java.net.UnknownHostException"%> <%@ page import="java.util.Date"%> <%@ page import="java.util.Map"%> <%@ page contentType="text/xml;charset=UTF-8" language="java" %> <% SolrCore core = SolrCore.getSolrCore(); Integer port = new Integer(request.getServerPort()); IndexSchema schema = core.getSchema(); String collectionName = schema!=null ? schema.getName():"unknown"; Map reg = SolrInfoRegistry.getRegistry(); String rootdir = "/var/opt/resin3/"+port.toString(); File pidFile = new File(rootdir + "/logs/resin.pid"); String startTime = ""; try { startTime = (pidFile.lastModified() > 0) ? new Date(pidFile.lastModified()).toString() : "No Resin Pid found (logs/resin.pid)"; } catch (Exception e) { out.println(""); out.println("Couldn't open Solr pid file:" + e.toString()); out.println(""); } String hostname="localhost"; try { InetAddress addr = InetAddress.getLocalHost(); // Get IP Address byte[] ipAddr = addr.getAddress(); // Get hostname // hostname = addr.getHostName(); hostname = addr.getCanonicalHostName(); } catch (UnknownHostException e) {} %> <%= collectionName %> <%= hostname %> <%= new Date().toString() %> <%= startTime %> <% for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) { %> <<%= cat.toString() %>> <% synchronized(reg) { for (Map.Entry entry : reg.entrySet()) { String key = entry.getKey(); SolrInfoMBean m = entry.getValue(); if (m.getCategory() != cat) continue; NamedList nl = m.getStatistics(); if ((nl != null) && (nl.size() != 0)) { String na = "None Provided"; String name = (m.getName()!=null ? m.getName() : na); String vers = (m.getVersion()!=null ? m.getVersion() : na); String desc = (m.getDescription()!=null ? m.getDescription() : na); %> <%= key %> <%= name %> <%= vers %> <%= desc %> <% for (int i = 0; i < nl.size() ; i++) { %> <%= nl.getVal(i).toString() %> <% } %> <% } %> <% } } %> > <% } %>