%@ page import="org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.BufferedReader,
java.io.File,
java.io.FileReader,
java.net.InetAddress,
java.net.UnknownHostException,
java.util.Date"%>
<%
SolrCore core = SolrCore.getSolrCore();
Integer port = new Integer(request.getServerPort());
IndexSchema schema = core.getSchema();
String collectionName = schema!=null ? schema.getName():"unknown";
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) {}
File slaveinfo = new File(rootdir + "/logs/snappuller.status");
StringBuffer buffer = new StringBuffer();
String mode = "";
if (slaveinfo.canRead()) {
// Slave instance
mode = "Slave";
File slavevers = new File(rootdir + "/logs/snapshot.current");
BufferedReader inforeader = new BufferedReader(new FileReader(slaveinfo));
BufferedReader versreader = new BufferedReader(new FileReader(slavevers));
buffer.append("
\n" +
"\n" +
"Version:" +
" | \n" +
"\n")
.append( versreader.readLine())
.append( " | \n" +
" | \n" +
"
\n" +
"\n" +
"\n" +
"Status:" +
" | \n" +
"\n")
.append( inforeader.readLine())
.append( " | \n" +
"
\n");
} else {
// Master instance
mode = "Master";
File masterdir = new File(rootdir + "/logs/clients");
File[] clients = masterdir.listFiles();
if (clients == null) {
buffer.append("\n" +
"\n" +
" | \n" +
"\n" +
"No distribution info present" +
" | \n" +
"
\n");
} else {
int i = 0;
while (i < clients.length) {
BufferedReader reader = new BufferedReader(new FileReader(clients[i]));
buffer.append("\n" +
"\n" +
"Client:" +
" | \n" +
"\n")
.append( clients[i].toString())
.append( " | \n" +
"
\n" +
"\n" +
"\n" +
" | \n" +
"\n")
.append( reader.readLine())
.append( " | \n" +
"
\n" +
"\n" +
"
\n");
i++;
}
}
}
%>
SOLR Distribution Info (<%= collectionName %>)
<%= hostname %> : <%= port.toString() %>
|
Current Time: <%= new Date().toString() %>
|
|
Server Start At: <%= startTime %>
|
<%= mode %> Status
Return to Admin Page