chaos => slightly less than chaos. pulled out some common stuff into header.jsp, made healthcheck configurable, changed server start time to SolrCore creation time, removed some more CNET links

git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@379696 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2006-02-22 05:53:23 +00:00
parent 3bf2bcef7c
commit ff90d5f2d6
11 changed files with 85 additions and 433 deletions

View File

@ -67,6 +67,9 @@ public final class SolrCore {
private final String dataDir;
private final String index_path;
private final UpdateHandler updateHandler;
private static final long startTime = System.currentTimeMillis();
public long getStartTime() { return startTime; }
public static SolrIndexConfig mainIndexConfig = new SolrIndexConfig("mainIndex");

View File

@ -0,0 +1,28 @@
<%@ page import="org.apache.solr.core.SolrConfig,
org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.File"%>
<%@ page import="java.net.InetAddress"%>
<%
SolrCore core = SolrCore.getSolrCore();
int port = request.getServerPort();
IndexSchema schema = core.getSchema();
// enabled/disabled is purely from the point of a load-balancer
// and has no effect on local server function. If there is no healthcheck
// configured, don't put any status on the admin pages.
String enabledStatus = null;
String enabledFile = SolrConfig.config.get("admin/healthcheck/text()",null);
boolean isEnabled = false;
if (enabledFile!=null) {
isEnabled = new File(enabledFile).exists();
}
String collectionName = schema!=null ? schema.getName():"unknown";
InetAddress addr = InetAddress.getLocalHost();
String hostname = addr.getCanonicalHostName();
String defaultSearch = SolrConfig.config.get("admin/defaultQuery/text()",null);
String cwd=System.getProperty("user.dir");
%>

View File

@ -4,75 +4,20 @@
org.apache.solr.analysis.TokenFilterFactory,
org.apache.solr.analysis.TokenizerChain,
org.apache.solr.analysis.TokenizerFactory,
org.apache.solr.core.SolrConfig,
org.apache.solr.core.SolrCore,
org.apache.solr.schema.FieldType,
org.apache.solr.schema.IndexSchema,org.apache.solr.schema.SchemaField
org.apache.solr.schema.SchemaField,
org.apache.solr.util.XML,
javax.servlet.jsp.JspWriter,java.io.IOException
"%>
<%@ page import="org.apache.solr.util.XML"%>
<%@ page import="javax.servlet.jsp.JspWriter"%>
<%@ page import="java.io.File"%>
<%@ page import="java.io.IOException"%>
<%@ page import="java.io.Reader"%>
<%@ page import="java.io.StringReader"%>
<%@ page import="java.net.InetAddress"%>
<%@ page import="java.net.UnknownHostException"%>
<%@ page import="java.util.*"%>
<!-- $Id: analysis.jsp,v 1.2 2005/09/20 18:23:30 yonik Exp $ -->
<!-- $Source: /cvs/main/searching/org.apache.solrolarServer/resources/admin/analysis.jsp,v $ -->
<!-- $Name: $ -->
<%
SolrCore core = SolrCore.getSolrCore();
IndexSchema schema = core.getSchema();
String rootdir = "/var/opt/resin3/"+request.getServerPort();
File pidFile = new File(rootdir + "/logs/resin.pid");
File enableFile = new File(rootdir + "/logs/server-enabled");
boolean isEnabled = false;
String enabledStatus = "";
String enableActionStatus = "";
String makeEnabled = "";
String action = request.getParameter("action");
String startTime = "";
try {
startTime = (pidFile.lastModified() > 0)
? new Date(pidFile.lastModified()).toString()
: "No Resin Pid found (logs/resin.pid)";
} catch (Exception e) {
out.println("<ERROR>");
out.println("Couldn't open Solr pid file:" + e.toString());
out.println("</ERROR>");
}
try {
isEnabled = (enableFile.lastModified() > 0);
enabledStatus = (isEnabled)
? "Enabled"
: "Disabled";
makeEnabled = (isEnabled)
? "Disable"
: "Enable";
} catch (Exception e) {
out.println("<ERROR>");
out.println("Couldn't check server-enabled file:" + e.toString());
out.println("</ERROR>");
}
String collectionName = schema!=null ? schema.getName():"unknown";
String hostname="localhost";
String defaultSearch= SolrConfig.config.get("admin/defaultQuery","");
try {
InetAddress addr = InetAddress.getLocalHost();
// Get IP Address
byte[] ipAddr = addr.getAddress();
// Get hostname
// hostname = addr.getHostName();
hostname = addr.getCanonicalHostName();
} catch (UnknownHostException e) {}
%>
<%@include file="header.jsp" %>
<%
String name = request.getParameter("name");
@ -89,22 +34,8 @@
boolean highlight = highlightS!=null && highlightS.equalsIgnoreCase("on");
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css">
<link rel="icon" href="favicon.ico" type="image/ico">
<link rel="shortcut icon" href="favicon.ico" type="image/ico">
<title>SOLR Interface</title>
</head>
<body>
<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
<h1>SOLR Interface (<%= collectionName %>) - <%= enabledStatus %></h1>
<%= hostname %> : <%= request.getServerPort() %>
<br clear="all">
<h2>Field Analysis</h2>
<form method="GET" action="analysis.jsp">

View File

@ -1,103 +1,6 @@
<%@ page import="org.apache.solr.core.SolrConfig,
org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.File
"%>
<%@ page import="java.net.InetAddress"%>
<%@ page import="java.net.UnknownHostException"%>
<%@ page import="java.util.Date"%>
<!-- $Id: form.jsp,v 1.6 2005/09/16 21:45:54 yonik Exp $ -->
<%
SolrCore core = SolrCore.getSolrCore();
Integer port = new Integer(request.getServerPort());
IndexSchema schema = core.getSchema();
<%@include file="header.jsp" %>
String rootdir = "/var/opt/resin3/"+port.toString();
File pidFile = new File(rootdir + "/logs/resin.pid");
File enableFile = new File(rootdir + "/logs/server-enabled");
boolean isEnabled = false;
String enabledStatus = "";
String enableActionStatus = "";
String makeEnabled = "";
String action = request.getParameter("action");
String startTime = "";
try {
startTime = (pidFile.lastModified() > 0)
? new Date(pidFile.lastModified()).toString()
: "No Resin Pid found (logs/resin.pid)";
} catch (Exception e) {
out.println("<ERROR>");
out.println("Couldn't open Solr pid file:" + e.toString());
out.println("</ERROR>");
}
try {
if (action != null) {
if ("Enable".compareTo(action) == 0) {
if (enableFile.createNewFile()) {
enableActionStatus += "Enable Succeeded";
} else {
enableActionStatus += "Already Enabled)";
}
}
if ("Disable".compareTo(action) == 0) {
if (enableFile.delete()) {
enableActionStatus = "Disable Succeeded";
} else {
enableActionStatus = "Already Disabled";
}
}
}
} catch (Exception e) {
out.println("<ERROR>");
out.println("Couldn't "+action+" server-enabled file:" + e.toString());
out.println("</ERROR>");
}
try {
isEnabled = (enableFile.lastModified() > 0);
enabledStatus = (isEnabled)
? "Enabled"
: "Disabled";
makeEnabled = (isEnabled)
? "Disable"
: "Enable";
} catch (Exception e) {
out.println("<ERROR>");
out.println("Couldn't check server-enabled file:" + e.toString());
out.println("</ERROR>");
}
String collectionName = schema!=null ? schema.getName():"unknown";
String hostname="localhost";
String defaultSearch= SolrConfig.config.get("admin/defaultQuery","");
try {
InetAddress addr = InetAddress.getLocalHost();
// Get IP Address
byte[] ipAddr = addr.getAddress();
// Get hostname
// hostname = addr.getHostName();
hostname = addr.getCanonicalHostName();
} catch (UnknownHostException e) {}
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css">
<link rel="icon" href="favicon.ico" type="image/ico">
<link rel="shortcut icon" href="favicon.ico" type="image/ico">
<title>SOLR Interface</title>
</head>
<body>
<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
<h1>SOLR Interface (<%= collectionName %>) - <%= enabledStatus %></h1>
<%= hostname %> : <%= port.toString() %>
<br clear="all">
<h2>/select mode</h2>
<form method="GET" action="../select">

View File

@ -1,6 +1,5 @@
<%@ page import="org.apache.solr.core.Config,
org.apache.solr.core.SolrConfig,
java.io.FileInputStream,
java.io.InputStream,
java.io.InputStreamReader,
java.io.Reader,

View File

@ -0,0 +1,17 @@
<%@include file="_info.jsp" %>
<html>
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css">
<link rel="icon" href="favicon.ico" type="image/ico"></link>
<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
<title>Solr admin page</title>
</head>
<body>
<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="Solr"></a>
<h1>Solr Admin (<%= collectionName %>)
<%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> </h1>
<%= hostname %>:<%= port %><br/>
<%= cwd %>

View File

@ -1,108 +1,18 @@
<%@ page import="org.apache.solr.core.SolrConfig,
org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.File"%>
<%@ page import="java.net.InetAddress"%>
<%@ page import="java.net.UnknownHostException"%>
<%@ page import="java.util.Date"%>
<!-- $Id: index.jsp,v 1.26 2005/09/20 18:23:30 yonik Exp $ -->
<!-- $Source: /cvs/main/searching/SolrServer/resources/admin/index.jsp,v $ -->
<!-- $Name: $ -->
<%
SolrCore core = SolrCore.getSolrCore();
Integer port = new Integer(request.getServerPort());
IndexSchema schema = core.getSchema();
<!-- jsp:include page="header.jsp"/ -->
<!-- do a verbatim include so we can use the local vars -->
<%@include file="header.jsp" %>
String rootdir = "/var/opt/resin3/"+port.toString();
File pidFile = new File(rootdir + "/logs/resin.pid");
File enableFile = new File(rootdir + "/logs/server-enabled");
boolean isEnabled = false;
String enabledStatus = "";
String enableActionStatus = "";
String makeEnabled = "";
String action = request.getParameter("action");
String startTime = "";
try {
startTime = (pidFile.lastModified() > 0)
? new Date(pidFile.lastModified()).toString()
: "No Resin Pid found (logs/resin.pid)";
} catch (Exception e) {
out.println("<ERROR>");
out.println("Couldn't open Solr pid file:" + e.toString());
out.println("</ERROR>");
}
try {
if (action != null) {
if ("Enable".compareTo(action) == 0) {
if (enableFile.createNewFile()) {
enableActionStatus += "Enable Succeeded";
} else {
enableActionStatus += "Already Enabled)";
}
}
if ("Disable".compareTo(action) == 0) {
if (enableFile.delete()) {
enableActionStatus = "Disable Succeeded";
} else {
enableActionStatus = "Already Disabled";
}
}
}
} catch (Exception e) {
out.println("<ERROR>");
out.println("Couldn't "+action+" server-enabled file:" + e.toString());
out.println("</ERROR>");
}
try {
isEnabled = (enableFile.lastModified() > 0);
enabledStatus = (isEnabled)
? "Enabled"
: "Disabled";
makeEnabled = (isEnabled)
? "Disable"
: "Enable";
} catch (Exception e) {
out.println("<ERROR>");
out.println("Couldn't check server-enabled file:" + e.toString());
out.println("</ERROR>");
}
String collectionName = schema!=null ? schema.getName():"unknown";
String hostname="localhost";
String defaultSearch= SolrConfig.config.get("admin/defaultQuery","");
try {
InetAddress addr = InetAddress.getLocalHost();
// Get IP Address
byte[] ipAddr = addr.getAddress();
// Get hostname
// hostname = addr.getHostName();
hostname = addr.getCanonicalHostName();
} catch (UnknownHostException e) {}
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css">
<link rel="icon" href="favicon.ico" type="image/ico"></link>
<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
<title>SOLR admin page</title>
</head>
<body>
<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
<h1>SOLR Admin (<%= collectionName %>) - <%= enabledStatus %></h1>
<%= hostname %> : <%= port.toString() %>
<br clear="all">
<table>
<tr>
<td>
<h3>SOLR</h3>
<h3>Solr</h3>
</td>
<td>
[<a href="solar-status">Status</a>]
@ -117,6 +27,7 @@
</td>
</tr>
<tr>
<td>
<strong>App server:</strong><br>
@ -125,6 +36,7 @@
[<a href="get-properties.jsp">Java Properties</a>]
[<a href="threaddump.jsp">Thread Dump</a>]
<%
if (enabledFile!=null)
if (isEnabled) {
%>
[<a href="action.jsp?action=Disable">Disable</a>]
@ -138,6 +50,7 @@
</td>
</tr>
<!-- TODO: make it possible to add links to the admin page via solrconfig.xml
<tr>
<td>
<strong>Hardware:</strong><br>
@ -148,6 +61,7 @@
[<a href="http://monitor.cnet.com/orca_mon/?mgroup=prob&hours=48&hostname=<%= hostname %>">Problems</a>]
</td>
</tr>
-->
</table><P>
@ -203,14 +117,14 @@
<td>
</td>
<td>
Current Time: <%= new Date().toString() %>
Current Time: <%= new Date() %>
</td>
</tr>
<tr>
<td>
</td>
<td>
Server Start At: <%= startTime %>
Server Start At: <%= new Date(core.getStartTime()) %>
</td>
</tr>
</table>

View File

@ -1,59 +1,26 @@
<%@ page import="org.apache.solr.core.SolrCore,
org.apache.solr.core.SolrInfoMBean,
<%@ page import="org.apache.solr.core.SolrInfoMBean,
org.apache.solr.core.SolrInfoRegistry,
org.apache.solr.schema.IndexSchema,
java.io.File,
java.net.InetAddress,
java.net.URL"%>
<%@ page import="java.net.UnknownHostException"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.util.Map"%>
java.net.URL,
java.util.Date,
java.util.Map"%>
<%@ page contentType="text/xml;charset=UTF-8" language="java" %>
<?xml-stylesheet type="text/xsl" href="registry.xsl"?>
<%
SolrCore core = SolrCore.getSolrCore();
IndexSchema schema = core.getSchema();
String collectionName = schema!=null ? schema.getName():"unknown";
Map<String, SolrInfoMBean> reg = SolrInfoRegistry.getRegistry();
String rootdir = "/var/opt/resin3/"+request.getServerPort();
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("<ERROR>");
out.println("Couldn't open Solr pid file:" + e.toString());
out.println("</ERROR>");
}
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) {}
%>
<%@include file="_info.jsp" %>
<solr>
<schema><%= collectionName %></schema>
<host><%= hostname %></host>
<now><%= new Date().toString() %></now>
<start><%= startTime %></start>
<start><%= new Date(core.getStartTime()) %></start>
<solr-info>
<%
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
%>
<<%= cat.toString() %>>
<%
Map<String, SolrInfoMBean> reg = SolrInfoRegistry.getRegistry();
synchronized(reg) {
for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
String key = entry.getKey();

View File

@ -1,8 +1,3 @@
<%@ page import="org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.File,
java.net.InetAddress,
java.net.UnknownHostException"%>
<%@ page import="java.util.Date"%>
<%--
Created by IntelliJ IDEA.
@ -15,40 +10,13 @@
<?xml-stylesheet type="text/xsl" href="status.xsl"?>
<%
SolrCore core = SolrCore.getSolrCore();
IndexSchema schema = core.getSchema();
String collectionName = schema!=null ? schema.getName():"unknown";
<%@include file="_info.jsp" %>
String rootdir = "/var/opt/resin3/"+request.getServerPort();
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("<ERROR>");
out.println("Couldn't open Solr pid file:" + e.toString());
out.println("</ERROR>");
}
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) {}
%>
<solr>
<schema><%= collectionName %></schema>
<host><%= hostname %> : <%= request.getServerPort() %></host>
<now><%= new Date().toString() %></now>
<start><%= startTime %></start>
<start><%= new Date(core.getStartTime()) %></start>
<status>
<cvsId><%= core.cvsId %></cvsId>
<cvsSource><%= core.cvsSource %></cvsSource>

View File

@ -1,60 +1,26 @@
<%@ page import="org.apache.solr.core.SolrCore,
org.apache.solr.core.SolrInfoMBean,
<%@ page import="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"%>
java.util.Date,
java.util.Map"%>
<%@ page contentType="text/xml;charset=UTF-8" language="java" %>
<?xml-stylesheet type="text/xsl" href="stats.xsl"?>
<%@include file="_info.jsp" %>
<%
SolrCore core = SolrCore.getSolrCore();
Integer port = new Integer(request.getServerPort());
IndexSchema schema = core.getSchema();
String collectionName = schema!=null ? schema.getName():"unknown";
Map<String, SolrInfoMBean> 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("<ERROR>");
out.println("Couldn't open Solr pid file:" + e.toString());
out.println("</ERROR>");
}
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) {}
%>
<solr>
<schema><%= collectionName %></schema>
<host><%= hostname %></host>
<now><%= new Date().toString() %></now>
<start><%= startTime %></start>
<start><%= new Date(core.getStartTime()) %></start>
<solr-info>
<%
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
%>
<<%= cat.toString() %>>
<%
Map<String,SolrInfoMBean> reg = SolrInfoRegistry.getRegistry();
synchronized(reg) {
for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
String key = entry.getKey();

View File

@ -1,57 +1,13 @@
<%@ 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"%>
<%@ page import="java.io.BufferedReader,
java.io.FileReader"%>
<%@include file="header.jsp" %>
<%
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("<ERROR>");
out.println("Couldn't open Solr pid file:" + e.toString());
out.println("</ERROR>");
}
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 getinfo = new File(rootdir + "/logs/jvm.log");
File getinfo = new File("logs/jvm.log");
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css">
<link rel="icon" href="favicon.ico" type="image/ico">
<link rel="shortcut icon" href="favicon.ico" type="image/ico">
</head>
<body>
<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
<h1>SOLR Thread Dump (<%= collectionName %>)</h1>
<%= hostname %> : <%= port.toString() %>
<br clear="all">
<%
Runtime rt = Runtime.getRuntime();
Process p = rt.exec(rootdir + "/getinfo");
Process p = rt.exec("./getinfo");
p.waitFor();
%>
<table>