CHUKWA-779. Remove support for JSP pages. (Eric Yang)
Project: http://git-wip-us.apache.org/repos/asf/chukwa/repo Commit: http://git-wip-us.apache.org/repos/asf/chukwa/commit/6e9e7899 Tree: http://git-wip-us.apache.org/repos/asf/chukwa/tree/6e9e7899 Diff: http://git-wip-us.apache.org/repos/asf/chukwa/diff/6e9e7899 Branch: refs/heads/master Commit: 6e9e7899daa1e1621e754875260357a6c398859e Parents: 666dbb9 Author: Eric Yang <[email protected]> Authored: Sat Sep 5 19:46:50 2015 -0700 Committer: Eric Yang <[email protected]> Committed: Sun Sep 13 13:27:30 2015 -0700 ---------------------------------------------------------------------- CHANGES.txt | 2 + conf/chukwa-agent-conf.xml | 4 +- conf/shiro.ini | 4 +- contrib/docker/setup-image.sh | 4 + pom.xml | 59 +--- .../chukwa/datastore/ChukwaHBaseStore.java | 298 ++++++++++++++-- .../chukwa/hicc/rest/HeatmapController.java | 36 ++ .../chukwa/hicc/rest/LoginController.java | 81 +++++ src/main/web/hicc/WEB-INF/jsp2/taglib.tld | 39 --- src/main/web/hicc/WEB-INF/vm/heatmap.vm | 141 ++++++++ src/main/web/hicc/WEB-INF/vm/login.vm | 58 +++ src/main/web/hicc/alerts/index.html | 76 ++++ src/main/web/hicc/apps/pie.js | 2 +- src/main/web/hicc/home/index.html | 2 + src/main/web/hicc/jsp/chart.jsp | 166 --------- src/main/web/hicc/jsp/cluster_selector.jsp | 51 --- src/main/web/hicc/jsp/debug.jsp | 31 -- src/main/web/hicc/jsp/event.jsp | 102 ------ src/main/web/hicc/jsp/event2_viewer.jsp | 75 ---- src/main/web/hicc/jsp/event_viewer.jsp | 29 -- src/main/web/hicc/jsp/event_viewer_data.jsp | 74 ---- src/main/web/hicc/jsp/event_viewer_helper.jsp | 72 ---- src/main/web/hicc/jsp/event_wrapper.jsp | 26 -- src/main/web/hicc/jsp/events-xml.jsp | 93 ----- src/main/web/hicc/jsp/get_data_source.jsp | 36 -- src/main/web/hicc/jsp/get_db_data.jsp | 108 ------ src/main/web/hicc/jsp/get_timezone_list.jsp | 31 -- src/main/web/hicc/jsp/hadoop_activity.jsp | 71 ---- .../web/hicc/jsp/heatmap-datanode-data-js.jsp | 255 -------------- src/main/web/hicc/jsp/heatmap-static.jsp | 71 ---- src/main/web/hicc/jsp/heatmap.jsp | 136 -------- src/main/web/hicc/jsp/heatmap_datanode.jsp | 349 ------------------- src/main/web/hicc/jsp/help.jsp | 48 --- src/main/web/hicc/jsp/host_selector.jsp | 47 --- .../web/hicc/jsp/host_selector_dropdown.jsp | 92 ----- src/main/web/hicc/jsp/host_selector_role.jsp | 90 ----- src/main/web/hicc/jsp/host_selector_user.jsp | 35 -- src/main/web/hicc/jsp/image-viewer.jsp | 195 ----------- src/main/web/hicc/jsp/job_viewer.jsp | 133 ------- src/main/web/hicc/jsp/jobs_viewer.jsp | 130 ------- src/main/web/hicc/jsp/permlink.jsp | 46 --- src/main/web/hicc/jsp/query.jsp | 113 ------ src/main/web/hicc/jsp/session.jsp | 31 -- src/main/web/hicc/jsp/sql_client.jsp | 69 ---- .../web/hicc/jsp/swimlanes-event-data-js.jsp | 302 ---------------- src/main/web/hicc/jsp/swimlanes-static.jsp | 70 ---- src/main/web/hicc/jsp/swimlanes.jsp | 72 ---- src/main/web/hicc/jsp/swimlanes_viewer.jsp | 25 -- src/main/web/hicc/jsp/table.jsp | 71 ---- src/main/web/hicc/jsp/table_viewer.jsp | 85 ----- src/main/web/hicc/jsp/time.jsp | 50 --- src/main/web/hicc/jsp/time_frame.jsp | 61 ---- src/main/web/hicc/jsp/time_range.jsp | 142 -------- src/main/web/hicc/jsp/time_slider.jsp | 155 -------- src/main/web/hicc/jsp/time_slider_wrapper.jsp | 27 -- src/main/web/hicc/jsp/util.jsp | 187 ---------- src/main/web/hicc/jsp/workspace/manage_view.jsp | 132 ------- src/main/web/hicc/jsp/workspace/time_iphone.jsp | 113 ------ src/main/web/hicc/login.jsp | 56 --- src/main/web/hicc/logs/index.html | 76 ++++ 60 files changed, 763 insertions(+), 4472 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index bb0f3f1..ca6b303 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -60,6 +60,8 @@ Trunk (unreleased changes) BUGS + CHUKWA-779. Remove support for JSP pages. (Eric Yang) + CHUKWA-775. Updated Jersey version. (Eric Yang) CHUKWA-774. Fixed resolution of symlinked prefix directory. (Eric Yang) http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/conf/chukwa-agent-conf.xml ---------------------------------------------------------------------- diff --git a/conf/chukwa-agent-conf.xml b/conf/chukwa-agent-conf.xml index 72a0bd3..7572d2a 100644 --- a/conf/chukwa-agent-conf.xml +++ b/conf/chukwa-agent-conf.xml @@ -78,8 +78,8 @@ <property> <name>chukwa.pipeline</name> - <!--<value>org.apache.hadoop.chukwa.datacollection.writer.hbase.HBaseWriter,org.apache.hadoop.chukwa.datacollection.writer.solr.SolrWriter</value>--> - <value>org.apache.hadoop.chukwa.datacollection.writer.hbase.HBaseWriter</value> + <value>org.apache.hadoop.chukwa.datacollection.writer.hbase.HBaseWriter,org.apache.hadoop.chukwa.datacollection.writer.solr.SolrWriter</value> + <!--<value>org.apache.hadoop.chukwa.datacollection.writer.hbase.HBaseWriter</value>--> </property> <property> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/conf/shiro.ini ---------------------------------------------------------------------- diff --git a/conf/shiro.ini b/conf/shiro.ini index a584f7e..e9b6f2d 100644 --- a/conf/shiro.ini +++ b/conf/shiro.ini @@ -21,7 +21,7 @@ # http://shiro.apache.org/web.html for more. [main] -shiro.loginUrl = /login.jsp +shiro.loginUrl = /v1/login/check [users] # format: username = password, role1, role2, ..., roleN @@ -37,7 +37,7 @@ admin = * # the 'authc' filter must still be specified for it so it can process that url's # login submissions. It is 'smart' enough to allow those requests through as specified by the # shiro.loginUrl above. -/login.jsp = authc +/v1/login/check = authc /logout = logout /index.html = authc /home/css/** = anon http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/contrib/docker/setup-image.sh ---------------------------------------------------------------------- diff --git a/contrib/docker/setup-image.sh b/contrib/docker/setup-image.sh index b2b23f5..021468d 100755 --- a/contrib/docker/setup-image.sh +++ b/contrib/docker/setup-image.sh @@ -118,3 +118,7 @@ su - hdfs -c '/opt/apache/hadoop/bin/hadoop fs -chown hbase:hadoop /hbase >/dev/ su - hbase -c '/opt/apache/hbase/bin/start-hbase.sh' sleep 5 su - hbase -c '/opt/apache/hbase/bin/hbase shell < /opt/apache/chukwa/etc/chukwa/hbase.schema' +sleep 5 +su - hbase -c '/opt/apache/hbase/bin/stop-hbase.sh' +su - hdfs -c '/opt/apache/hadoop/sbin/stop-dfs.sh' +su - zookeeper -c '/opt/apache/zookeeper/bin/zkServer.sh stop' http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 5bc3556..3dc2728 100644 --- a/pom.xml +++ b/pom.xml @@ -308,16 +308,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jsp-2.1</artifactId> - <version>6.1.14</version> - </dependency> - <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jsp-api-2.1</artifactId> - <version>6.1.14</version> - </dependency> - <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</artifactId> <version>1.2.3</version> @@ -1005,6 +995,14 @@ <version>${hbase.version}</version> <exclusions> <exclusion> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jsp-2.1</artifactId> + </exclusion> + <exclusion> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jsp-api-2.1</artifactId> + </exclusion> + <exclusion> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> </exclusion> @@ -1086,6 +1084,10 @@ <version>${hadoop.version}</version> <exclusions> <exclusion> + <groupId>javax.servlet.jsp</groupId> + <artifactId>jsp-api</artifactId> + </exclusion> + <exclusion> <groupId>tomcat</groupId> <artifactId>jasper-compiler</artifactId> </exclusion> @@ -1138,43 +1140,6 @@ </dependencies> </profile> <profile> - <id>jspc</id> - <activation> - <property> - <name>jspc</name> - </property> - </activation> - <build> - <plugins> - <plugin> - <groupId>org.mortbay.jetty</groupId> - <artifactId>maven-jetty-jspc-plugin</artifactId> - <version>6.1.26</version> - <executions> - <execution> - <id>jspc</id> - <goals> - <goal>jspc</goal> - </goals> - <configuration> - <webAppSourceDirectory> - src/main/web/hicc - </webAppSourceDirectory> - <generatedClasses> - ${basedir}/target/web - </generatedClasses> - <verbose>true</verbose> - <keepSources>false</keepSources> - <packageRoot>org.apache.jsp</packageRoot> - <ignoreJspFragmentErrors>true</ignoreJspFragmentErrors> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - <profile> <id>docs</id> <activation> <file> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java b/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java index 721f290..4c6ccdb 100644 --- a/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java +++ b/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java @@ -827,6 +827,26 @@ public class ChukwaHBaseStore { namenode.append(":NameNode"); String[] namenodeHeap = { "HadoopMetrics.jvm.JvmMetrics.MemHeapUsedM", "HadoopMetrics.jvm.JvmMetrics.MemHeapMaxM" }; createChart("7", "percent", "Namenode Memory", namenodeHeap, namenode.toString()); + String[] hdfsUsage = { "HadoopMetrics.dfs.FSNamesystem.CapacityUsed", "HadoopMetrics.dfs.FSNamesystem.CapacityTotal" }; + createChart("8", "percent", "HDFS Usage", hdfsUsage, hostname); + + StringBuilder rmnode = new StringBuilder(); + rmnode.append(hostname); + rmnode.append(":ResourceManager"); + String[] rmHeap = { "HadoopMetrics.jvm.JvmMetrics.MemHeapUsedM", "HadoopMetrics.jvm.JvmMetrics.MemHeapMaxM" }; + createChart("9", "percent", "Resource Manager Memory", rmHeap, rmnode.toString()); + + StringBuilder hbaseMaster = new StringBuilder(); + hbaseMaster.append(hostname); + hbaseMaster.append(":Master"); + String[] hbm = { "HBaseMetrics.jvm.JvmMetrics.MemHeapUsedM", "HBaseMetrics.jvm.JvmMetrics.MemHeapMaxM" }; + createChart("10", "percent", "HBase Master Memory", hbm, hbaseMaster.toString()); + + // Demo metrics + String[] trialAbandonRate = { "HadoopMetrics.jvm.JvmMetrics.MemHeapUsedM", "HadoopMetrics.jvm.JvmMetrics.MemHeapMaxM" }; + createChart("11", "percent", "Trial Abandon Rate", trialAbandonRate, namenode.toString()); + createChart("12", "percent", "Unhealthy Clusters", hdfsUsage, hostname); + // Populate default widgets Widget widget = new Widget(); widget.setTitle("System Load Average"); @@ -837,46 +857,200 @@ public class ChukwaHBaseStore { widget.setSize_y(1); createWidget(widget); - // CPU heatmap + // Populate default dashboard + Dashboard dashboard = new Dashboard(); + widget = new Widget(); - widget.setTitle("CPU Heatmap"); - widget.setSrc(new URI("/hicc/jsp/heatmap.jsp")); + widget.setTitle("Trial Downloading"); + widget.setSrc(new URI("/hicc/home/downloads.html")); widget.setCol(1); widget.setRow(1); - widget.setSize_x(5); + widget.setSize_x(2); widget.setSize_y(1); createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Cluster Running"); + widget.setSrc(new URI("/hicc/home/clusters.html")); + widget.setCol(3); + widget.setRow(1); + widget.setSize_x(2); + widget.setSize_y(1); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Users Working"); + widget.setSrc(new URI("/hicc/home/users.html")); + widget.setCol(5); + widget.setRow(1); + widget.setSize_x(2); + widget.setSize_y(1); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Applications Running"); + widget.setSrc(new URI("/hicc/home/apps.html")); + widget.setCol(7); + widget.setRow(1); + widget.setSize_x(2); + widget.setSize_y(1); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Trial Abandon Rate"); + widget.setSrc(new URI("/hicc/v1/circles/draw/11")); + widget.setCol(1); + widget.setRow(2); + widget.setSize_x(2); + widget.setSize_y(2); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Clusters Health"); + widget.setSrc(new URI("/hicc/v1/circles/draw/12")); + widget.setCol(3); + widget.setRow(2); + widget.setSize_x(2); + widget.setSize_y(2); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Top Active Clusters"); + widget.setSrc(new URI("/hicc/clusters/")); + widget.setCol(5); + widget.setRow(2); + widget.setSize_x(2); + widget.setSize_y(2); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Top Applications"); + widget.setSrc(new URI("/hicc/apps/")); + widget.setCol(7); + widget.setRow(2); + widget.setSize_x(2); + widget.setSize_y(2); + createWidget(widget); +// dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Applications Usage"); + widget.setSrc(new URI("/hicc/apps/apps-usage.html")); + widget.setCol(7); + widget.setRow(2); + widget.setSize_x(2); + widget.setSize_y(2); + createWidget(widget); + dashboard.add(widget); + + updateDashboard("default", "", dashboard); + + // Populate user dashboards + dashboard = new Dashboard(); + widget = new Widget(); + widget.setTitle("Top Applications"); + widget.setSrc(new URI("/hicc/apps/")); + widget.setCol(1); + widget.setRow(1); + widget.setSize_x(2); + widget.setSize_y(2); + dashboard.add(widget); - Dashboard dashboard = new Dashboard(); // Log Search widget widget = new Widget(); widget.setTitle("Log Search"); widget.setSrc(new URI("/hicc/ajax-solr/chukwa")); - widget.setCol(1); + widget.setCol(3); widget.setRow(1); - widget.setSize_x(7); - widget.setSize_y(4); + widget.setSize_x(6); + widget.setSize_y(6); createWidget(widget); dashboard.add(widget); - updateDashboard("default", "", dashboard); + + widget = new Widget(); + widget.setTitle("Top Users"); + widget.setSrc(new URI("/hicc/users/")); + widget.setCol(1); + widget.setRow(3); + widget.setSize_x(2); + widget.setSize_y(2); + createWidget(widget); + dashboard.add(widget); + updateDashboard("user", "", dashboard); // Populate system dashboards dashboard = new Dashboard(); widget = new Widget(); - widget.setTitle("CPU Utilization"); - widget.setSrc(new URI("/hicc/v1/chart/draw/2")); + widget.setTitle("Services Running"); + widget.setSrc(new URI("/hicc/services/services.html")); widget.setCol(1); widget.setRow(1); - widget.setSize_x(3); + widget.setSize_x(2); widget.setSize_y(1); createWidget(widget); dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Applications Running"); + widget.setSrc(new URI("/hicc/home/apps.html")); + widget.setCol(3); + widget.setRow(1); + widget.setSize_x(2); + widget.setSize_y(1); + dashboard.add(widget); widget = new Widget(); - widget.setTitle("Memory Utilization"); - widget.setSrc(new URI("/hicc/v1/chart/draw/3")); - widget.setCol(4); + widget.setTitle("HDFS Usage"); + widget.setSrc(new URI("/hicc/v1/circles/draw/8")); + widget.setCol(5); + widget.setRow(1); + widget.setSize_x(1); + widget.setSize_y(1); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Namenode Memory"); + widget.setSrc(new URI("/hicc/v1/circles/draw/7")); + widget.setCol(6); + widget.setRow(1); + widget.setSize_x(1); + widget.setSize_y(1); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Resource Manager Memory"); + widget.setSrc(new URI("/hicc/v1/circles/draw/9")); + widget.setCol(7); widget.setRow(1); + widget.setSize_x(1); + widget.setSize_y(1); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("HBase Master Memory"); + widget.setSrc(new URI("/hicc/v1/circles/draw/10")); + widget.setCol(8); + widget.setRow(1); + widget.setSize_x(1); + widget.setSize_y(1); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("System Load Average"); + widget.setSrc(new URI("/hicc/v1/chart/draw/1")); + widget.setCol(1); + widget.setRow(2); widget.setSize_x(3); widget.setSize_y(1); createWidget(widget); @@ -885,7 +1059,7 @@ public class ChukwaHBaseStore { widget = new Widget(); widget.setTitle("Disk Utilization"); widget.setSrc(new URI("/hicc/v1/chart/draw/4")); - widget.setCol(1); + widget.setCol(4); widget.setRow(2); widget.setSize_x(3); widget.setSize_y(1); @@ -893,43 +1067,111 @@ public class ChukwaHBaseStore { dashboard.add(widget); widget = new Widget(); + widget.setTitle("Timeline"); + widget.setSrc(new URI("/hicc/timeline/")); + widget.setCol(7); + widget.setRow(2); + widget.setSize_x(4); + widget.setSize_y(6); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("CPU Utilization"); + widget.setSrc(new URI("/hicc/v1/chart/draw/2")); + widget.setCol(1); + widget.setRow(3); + widget.setSize_x(3); + widget.setSize_y(1); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); widget.setTitle("Network Utilization"); widget.setSrc(new URI("/hicc/v1/chart/draw/5")); widget.setCol(4); - widget.setRow(2); + widget.setRow(3); widget.setSize_x(3); widget.setSize_y(1); createWidget(widget); dashboard.add(widget); widget = new Widget(); - widget.setTitle("Swap Utilization"); - widget.setSrc(new URI("/hicc/v1/chart/draw/6")); + widget.setTitle("Memory Utilization"); + widget.setSrc(new URI("/hicc/v1/chart/draw/3")); widget.setCol(1); - widget.setRow(3); + widget.setRow(4); widget.setSize_x(3); widget.setSize_y(1); createWidget(widget); dashboard.add(widget); widget = new Widget(); - widget.setTitle("System Load Average"); - widget.setSrc(new URI("/hicc/v1/chart/draw/1")); + widget.setTitle("Swap Utilization"); + widget.setSrc(new URI("/hicc/v1/chart/draw/6")); widget.setCol(4); - widget.setRow(3); + widget.setRow(4); widget.setSize_x(3); widget.setSize_y(1); createWidget(widget); dashboard.add(widget); + // CPU heatmap widget = new Widget(); - widget.setTitle("Namenode Memory"); - widget.setSrc(new URI("/hicc/v1/circles/draw/7")); + widget.setTitle("CPU Heatmap"); + widget.setSrc(new URI("/hicc/v1/heatmap/render/SystemMetrics/cpu.combined.")); widget.setCol(1); - widget.setRow(1); - widget.setSize_x(2); - widget.setSize_y(2); + widget.setRow(5); + widget.setSize_x(6); + widget.setSize_y(5); + createWidget(widget); + dashboard.add(widget); + + widget = new Widget(); + widget.setTitle("Alerts"); + widget.setSrc(new URI("/hicc/alerts/")); + widget.setCol(1); + widget.setRow(5); + widget.setSize_x(6); + widget.setSize_y(5); createWidget(widget); + + widget = new Widget(); + widget.setTitle("Log Errors"); + widget.setSrc(new URI("/hicc/logs/")); + widget.setCol(1); + widget.setRow(5); + widget.setSize_x(6); + widget.setSize_y(5); + createWidget(widget); + + widget = new Widget(); + widget.setTitle("Web Stats"); + widget.setSrc(new URI("https://birepo-internal.svl.ibm.com/awstats/awstats.pl?config=ibm-open-platform&framename=mainright&month=08&year=2015#month")); + widget.setCol(1); + widget.setRow(5); + widget.setSize_x(6); + widget.setSize_y(5); + createWidget(widget); + + widget = new Widget(); + widget.setTitle("Sessions"); + widget.setSrc(new URI("https://birepo-internal.svl.ibm.com/awstats/awstats.pl?config=ibm-open-platform&framename=mainright&month=08&year=2015#sessions")); + widget.setCol(1); + widget.setRow(5); + widget.setSize_x(6); + widget.setSize_y(5); + createWidget(widget); + + widget = new Widget(); + widget.setTitle("Domains"); + widget.setSrc(new URI("https://birepo-internal.svl.ibm.com/awstats/awstats.pl?config=ibm-open-platform&framename=mainright&month=08&year=2015#domains")); + widget.setCol(1); + widget.setRow(5); + widget.setSize_x(6); + widget.setSize_y(5); + createWidget(widget); + updateDashboard("system", "", dashboard); } catch (Throwable ex) { http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java index 621f318..80f7457 100644 --- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java +++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java @@ -17,6 +17,7 @@ */ package org.apache.hadoop.chukwa.hicc.rest; +import java.io.StringWriter; import java.text.SimpleDateFormat; import javax.servlet.http.HttpServletRequest; @@ -34,10 +35,16 @@ import org.apache.hadoop.chukwa.hicc.TimeHandler; import org.apache.hadoop.chukwa.hicc.bean.Heatmap; import org.apache.hadoop.chukwa.util.ExceptionUtil; import org.apache.log4j.Logger; +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; @Path("/heatmap") public class HeatmapController { static Logger log = Logger.getLogger(HeatmapController.class); + + @Context + VelocityEngine velocity; @GET @Path("{metricGroup}/{metric}") @@ -73,4 +80,33 @@ public class HeatmapController { } return heatmap; } + + @GET + @Path("render/{metricGroup}/{metric}") + @Produces(MediaType.TEXT_HTML) + public String heatmapTemplate(@PathParam("metricGroup") @DefaultValue("SystemMetrics") String metricGroup, + @PathParam("metric") @DefaultValue("cpu.combined.") String metric, + @QueryParam("width") @DefaultValue("700px") String width, + @QueryParam("height") @DefaultValue("400px") String height, + @QueryParam("title") @DefaultValue("CPU") String title, + @QueryParam("yLabel") @DefaultValue("device") String yLabel) { + StringBuilder url = new StringBuilder(); + url.append("/hicc/v1/heatmap/").append(metricGroup).append("/").append(metric); + VelocityContext context = new VelocityContext(); + StringWriter sw = null; + try { + context.put("url", url.toString()); + context.put("width", width); + context.put("height", height); + context.put("title", title); + context.put("yLabel", yLabel); + Template template = velocity.getTemplate("heatmap.vm"); + sw = new StringWriter(); + template.merge(context, sw); + } catch (Exception e) { + e.printStackTrace(); + return e.getMessage(); + } + return sw.toString(); + } } http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java new file mode 100644 index 0000000..d3413a4 --- /dev/null +++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.chukwa.hicc.rest; + +import java.io.StringWriter; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; + +import org.apache.hadoop.chukwa.datastore.ChukwaHBaseStore; +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; + +import com.sun.jersey.api.client.ClientResponse.Status; + +@Path("/login") +public class LoginController { + @Context + VelocityEngine velocity; + + static { + ChukwaHBaseStore.populateDefaults(); + } + + @GET + @Path("check") + public String login(String buffer) { + VelocityContext context = new VelocityContext(); + StringWriter sw = null; + try { + Template template = velocity.getTemplate("login.vm"); + sw = new StringWriter(); + template.merge(context, sw); + } catch (Exception e) { + e.printStackTrace(); + return e.getMessage(); + } + return sw.toString(); + } + + @POST + @Path("check") + public Response check(@Context HttpServletRequest request) { + VelocityContext context = new VelocityContext(); + if(request.getRemoteUser()!=null) { + URI location; + try { + location = new URI("/hicc/"); + return Response.temporaryRedirect(location).build(); + } catch (URISyntaxException e) { + } + } + context.put("invalid", true); + Template template = velocity.getTemplate("login.vm"); + StringWriter sw = new StringWriter(); + template.merge(context, sw); + return Response.status(Status.FORBIDDEN).entity(sw.toString()).build(); + } +} http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/WEB-INF/jsp2/taglib.tld ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/WEB-INF/jsp2/taglib.tld b/src/main/web/hicc/WEB-INF/jsp2/taglib.tld deleted file mode 100644 index 71f2d42..0000000 --- a/src/main/web/hicc/WEB-INF/jsp2/taglib.tld +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<taglib xmlns="http://java.sun.com/xml/ns/j2ee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" - version="2.0"> - <description>A tag library exercising SimpleTag handlers.</description> - <tlib-version>1.0</tlib-version> - <short-name>SimpleTagLibrary</short-name> - <uri>/SimpleTagLibrary</uri> - <tag> - <description>Workspace views JSON Coverter</description> - <name>findViews</name> - <tag-class>org.apache.hadoop.chukwa.hicc.ViewsTag</tag-class> - <body-content>scriptless</body-content> - <attribute> - <name>key</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> -</taglib> - http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/WEB-INF/vm/heatmap.vm ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/WEB-INF/vm/heatmap.vm b/src/main/web/hicc/WEB-INF/vm/heatmap.vm new file mode 100644 index 0000000..74f9d29 --- /dev/null +++ b/src/main/web/hicc/WEB-INF/vm/heatmap.vm @@ -0,0 +1,141 @@ +#* + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*# +<!DOCTYPE html> +<html lang="en"> + <head> + <style> + + .outer { + display: table; + position: absolute; + height: 100%; + width: 100%; + } + + .middle { + display: table-cell; + vertical-align: middle; + } + + .inner { + margin-left: auto; + margin-right: auto; + } + + #heatmapArea { + display: block; + position:absolute; + float:left; + top:0; + left: 50px; + } + + #yaxis { + text-align: center; + width: 50px; + height: $height; + line-height: 400px; + } + + p { + border:0px solid red; + writing-mode:lr-tb; + -webkit-transform:rotate(270deg); + -moz-transform:rotate(270deg); + -o-transform: rotate(270deg); + white-space:nowrap; + bottom:0; + } + + #xaxis { + width: $width px; + position: relative; + left: 0px; + height: 20px; + text-align: center; + display: block; + } + + body { + color:#333; + font-family: Oswald, Helvetica, Arial; + font-weight:normal; + } + + </style> + <link href="/hicc/css/default.css" rel="stylesheet" type="text/css"> + </head> + <body onresize="resize()"> + <div class="outer"> + <div class="middle"> + <div class="inner"> + <div id="yaxis"> + <p id="yLabel"></p> + </div> + <div id="heatmapArea"></div> + <div id="xaxis">Time</div> + </div> + </div> + </div> + <script src="/hicc/js/jquery.js" type="text/javascript" charset="utf-8"></script> + <script type="text/javascript" src="/hicc/js/heatmap.js"></script> + <script type="text/javascript"> + function load() { + var x = window.innerWidth - 80; + var y = window.innerHeight - 60; + $.ajax({ + url: "$url", + dataType: "json", + success: function(data) { + $('#yLabel').html(data.series + " $yLabel (s)"); + var config = { + width: x, + height: y, + element: document.getElementById("heatmapArea"), + radius: y / data.radius * 4/3, + opacity: 50, + legend: { + position: 'br', + title: '$title Distribution' + } + }; + $("#heatmapArea").empty(); + var heatmap = h337.create(config); + heatmap.store.setDataSet(data); + setTimeout(load, 5000); + } + }); + } + + function resize() { + var x = window.innerWidth - 80; + var y = window.innerHeight - 60; + $("#heatmapArea").width(x + 'px'); + $("#heatmapArea").height(y + 'px'); + } + + window.onload = function() { + document.body.style.overflow = 'hidden'; + window.addEventListener("resize", resize, false); + setTimeout(load, 5000); + }; + </script> + </body> +</html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/WEB-INF/vm/login.vm ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/WEB-INF/vm/login.vm b/src/main/web/hicc/WEB-INF/vm/login.vm new file mode 100644 index 0000000..aeb9f08 --- /dev/null +++ b/src/main/web/hicc/WEB-INF/vm/login.vm @@ -0,0 +1,58 @@ +#* + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + *# +<html> +<head> + <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> + <meta http-equiv="Pragma" content="no-cache" /> + <meta http-equiv="Expires" content="0" /> + <link type="text/css" rel="stylesheet" href="/hicc/css/login.css"/> + <link href="/hicc/css/bootstrap.min.css" type="text/css" rel="stylesheet" /> + <link href="/hicc/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" /> + <script src="/hicc/js/jquery.js" type="text/javascript"></script> + <script src="/hicc/js/bootstrap.min.js" type="text/javascript"></script> +</head> +<body> + +<div class="container"> + <form class="form-signin" name="loginform" action="" method="post"> + <h2 class="form-signin-heading">Sign in to Chukwa</h2> + <label for="inputEmail" class="sr-only">Username</label> + <input type="text" class="form-control" name="username" placeholder="Username" required autofocus> + <label for="inputPassword" class="sr-only">Password:</label> + <input type="password" class="form-control" name="password" placeholder="Password" required> + <div class="checkbox"> + <label> + <input type="checkbox" name="rememberMe"> Keep me signed in + </label> + </div> + <input type="submit" class="btn btn-lg btn-primary btn-block" name="submit" value="Login"> + #if ($invalid) + <br> + <div class="alert alert-danger alert-dismissible" role="alert"> + Invalid username or password + </div> + #end + <span class="form-signin-footer"> + Copyright (c) 2008-2015 Apache Software Foundation + </span> + </form> +</div> + +</body> +</html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/alerts/index.html ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/alerts/index.html b/src/main/web/hicc/alerts/index.html new file mode 100644 index 0000000..ce653ec --- /dev/null +++ b/src/main/web/hicc/alerts/index.html @@ -0,0 +1,76 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!DOCTYPE html> +<html lang="en" class="no-js"> + <head> + <title>Tile</title> + <link href="../css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" /> + <link href="../css/bootstrap.min.css" type="text/css" rel="stylesheet" /> + <script src="../js/jquery.js" type="text/javascript"></script> + <script src="../js/bootstrap.min.js" type="text/javascript"></script> + <style> + .tile { + color: #ffffff; + background-color: #5bc0de; + } + .row { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + } + .banner { + background-color: #ffffff; + } + </style> + </head> + <body onResize="resize()"> + <div class="jumbotron"> + <div class="container"> + <div class="row"> + <div class="col-xs-5 col-md-5 text-center tile"> + <h2><span class="glyphicon glyphicon-alert" aria-hidden="true"></span></h2> + Alerts + </div> + <div class="col-xs-7 col-md-7 text-center banner"> + <p><h1>7</h1> Notifications</p> + </div> + </div> + </div> + </div> + + <script src="js/jquery.js"></script> + <script> + var tracker; + + function resize() { + clearTimeout(tracker); + tracker = setTimeout(render, 50); + } + + function render() { + document.body.style.overflow = 'hidden'; + tracker = setTimeout(render, 3000); + } + + $( document ).ready(function() { + render(); + }); + </script> + </body> +</html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/apps/pie.js ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/apps/pie.js b/src/main/web/hicc/apps/pie.js index 9f4d72c..dc575f6 100644 --- a/src/main/web/hicc/apps/pie.js +++ b/src/main/web/hicc/apps/pie.js @@ -1,6 +1,6 @@ var data = { labels: ['Mapreduce', 'HBase', 'Hive', 'Spark', 'BigSQL', 'R'], - series: [45, 29, 21,3, 2, 1] + series: [25, 19, 21,13, 12, 11] }; var options = { http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/home/index.html ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/home/index.html b/src/main/web/hicc/home/index.html index 37656cc..112c2a1 100755 --- a/src/main/web/hicc/home/index.html +++ b/src/main/web/hicc/home/index.html @@ -269,6 +269,8 @@ $(function(){ //DOM Ready cache: false }).done(function( html ) { $('#username').append(html); + }).fail(function() { + window.location = "/hicc/"; }); $.getJSON('/hicc/v1/session/key/dashboard', http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/chart.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/chart.jsp b/src/main/web/hicc/jsp/chart.jsp deleted file mode 100644 index 84f39a3..0000000 --- a/src/main/web/hicc/jsp/chart.jsp +++ /dev/null @@ -1,166 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.sql.*" %> -<%@ page import = "java.io.*" %> -<%@ page import = "java.util.Calendar" %> -<%@ page import = "java.util.Date" %> -<%@ page import = "java.text.SimpleDateFormat" %> -<%@ page import = "java.util.*" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.ClusterConfig" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.Chart" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.DatasetMapper" %> -<%@ page import = "org.apache.hadoop.chukwa.database.DatabaseConfig" %> -<%@ page import = "org.apache.hadoop.chukwa.database.Macro" %> -<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - //String boxId=xf.getParameter("boxId"); - //response.setHeader("boxId", xf.getParameter("boxId")); - response.setContentType("text/html; chartset=UTF-8//IGNORE"); - - /* - * Set chart title, and output type. - */ - String title = xf.getParameter("title"); - String graphType = xf.getParameter("graph_type"); - - /* - * Set chart width. - */ - int width=300; - if(request.getParameter("width")!=null) { - width=Integer.parseInt(request.getParameter("width")); - } - - /* - * Set chart height. - */ - int height=200; - if(request.getParameter("height")!=null) { - height=Integer.parseInt(request.getParameter("height")); - } - - /* - * Set series data source. - */ - String[] seriesName = xf.getParameterValues("series_name"); - String[] data = xf.getParameterValues("data"); - if(xf.getParameterValues("data").length==1 && xf.getParameterValues("data")[0].indexOf(",")!=-1) { - data = xf.getParameterValues("data")[0].split(","); - } - - /* - * Set series render format. - */ - String[] render = null; - if(request.getParameter("render")!=null) { - render=xf.getParameterValues("render"); - } - if(render==null || render.length!=data.length) { - render = new String[data.length]; - for(int i=0;i<data.length;i++) { - render[i] = "line"; - } - } - - Chart c = new Chart(request); - - /* - * Setup x axis display. - */ - if(request.getParameter("x_label")!=null && xf.getParameter("x_label").equals("on")) { - c.setXAxisLabels(true); - } else { - c.setXAxisLabels(false); - } - if(request.getParameter("x_axis_label")!=null) { - c.setXAxisLabel(xf.getParameter("x_axis_label")); - } else { - c.setXAxisLabel("Time"); - } - - // set ymin and ymax - // TODO: check that these are numbers - if (request.getParameter("ymin") != null && - request.getParameter("ymin").length() != 0) { - c.setYMin(new Double(xf.getParameter("ymin"))); - } - if (request.getParameter("ymax") != null && - request.getParameter("ymax").length() != 0) { - c.setYMax(new Double(xf.getParameter("ymax"))); - } - - /* - * Setup y axis display. - */ - if(request.getParameter("y_label")!=null && xf.getParameter("y_label").equals("on")) { - c.setYAxisLabels(true); - c.setYAxisLabel(xf.getParameter("y_axis_label")); - } else { - c.setYAxisLabels(false); - c.setYAxisLabel(""); - } - if(request.getParameter("y_axis_max")!=null) { - double max = Double.parseDouble(xf.getParameter("y_axis_max")); - c.setYMax(max); - } - if(request.getParameter("display_percentage")!=null) { - c.setDisplayPercentage(true); - } - - /* - * Setup title. - */ - if(title!=null) { - c.setTitle(title); - } - - /* - * Setup legend display. - */ - if(request.getParameter("legend")!=null && xf.getParameter("legend").equals("off")) { - c.setLegend(false); - } - - /* - * Setup series display. - */ - c.setGraphType(graphType); - c.setSize(width,height); - - /* - * Setup data structure. - */ - if(seriesName!=null && data.length==seriesName.length) { - for(int i=0;i<data.length;i++) { - c.setDataSet(render[i],seriesName[i],data[i]); - } - } else { - for(int i=0;i<data.length;i++) { - c.setDataSet(render[i],"",data[i]); - } - } - - /* - * Render graph - */ - out.println(c.plot()); -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/cluster_selector.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/cluster_selector.jsp b/src/main/web/hicc/jsp/cluster_selector.jsp deleted file mode 100644 index 5d28768..0000000 --- a/src/main/web/hicc/jsp/cluster_selector.jsp +++ /dev/null @@ -1,51 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "javax.servlet.http.*, java.io.*, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setContentType("text/html; chartset=UTF-8//IGNORE"); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<% String boxId = xf.getParameter("boxId"); %> -Cluster -<select id="<%= boxId %>cluster" name="<%= boxId %>cluster" class="formSelect"> -<% - String cluster=xf.getParameter("cluster"); - if(cluster!=null && !cluster.equals("null")) { - session.setAttribute("cluster",cluster); - } else { - cluster = (String) session.getAttribute("cluster"); - if(cluster==null || cluster.equals("null")) { - cluster="demo"; - session.setAttribute("cluster",cluster); - } - } - ClusterConfig cc = new ClusterConfig(); - Iterator i = cc.getClusters(); - while(i.hasNext()) { - String label = i.next().toString(); - if(label.equals(cluster)) { - out.println("<option selected>"+label+"</option>"); - } else { - out.println("<option>"+label+"</option>"); - } - } %> -</select> -<input type="button" onClick="save_cluster('<%= boxId %>');" name="Apply" value="Apply"> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/debug.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/debug.jsp b/src/main/web/hicc/jsp/debug.jsp deleted file mode 100644 index 9cd8f1d..0000000 --- a/src/main/web/hicc/jsp/debug.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "javax.servlet.http.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setContentType("text/html; chartset=UTF-8//IGNORE"); - response.setHeader("boxId", xf.getParameter("boxId")); - - for (Enumeration e = session.getAttributeNames() ; e.hasMoreElements() ;) { - String name = (String) e.nextElement(); - out.println(name+":"+session.getAttribute(name).toString()); - out.println("<br>"); - } -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/event.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/event.jsp b/src/main/web/hicc/jsp/event.jsp deleted file mode 100644 index b186f1f..0000000 --- a/src/main/web/hicc/jsp/event.jsp +++ /dev/null @@ -1,102 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.io.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, org.apache.hadoop.chukwa.hicc.TimeHandler" %> -<% TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); - long start = time.getStartTime(); - long end = time.getEndTime(); - long midpoint = (end+start)/2; - SimpleDateFormat formatter = new SimpleDateFormat("MMM dd yyyy HH:mm:ss"); - String startDate = formatter.format(midpoint); - String endDate = formatter.format(end); - String intervalUnit1="MINUTE"; - String intervalUnit2="HOUR"; - int intervalPixels = 10; - if(((end-start)/1000)>=(60*60*24*3)) { - intervalUnit1 = "DAY"; - intervalUnit2 = "WEEK"; - intervalPixels = 600; - if(((end-start)/1000)>(60*60*24*15)) { - intervalPixels = 300; - } - } else if(((end-start)/1000)>(60*60*6)) { - intervalUnit1 = "HOUR"; - intervalUnit2 = "DAY"; - intervalPixels = 600; - } else { - intervalUnit1 = "MINUTE"; - intervalUnit2 = "HOUR"; - intervalPixels = 600; - if(((end-start)/1000)>(60*60*3)) { - intervalPixels = 250; - } - } -%> -<html> - <head> - <link rel='stylesheet' href='/hicc/lib/timeline/bundle.css' type='text/css' /> - <link href="/hicc/css/default.css" rel="stylesheet" type="text/css"> - <link href="/hicc/css/formalize.css" rel="stylesheet" type="text/css" /> - <script src="/hicc/js/jquery.formalize.js"></script> - <script src="/hicc/lib/timeline/timeline-api.js?bundle=true" type="text/javascript"></script> - <script src="/hicc/lib/timeline/search.js" type="text/javascript"></script> - <script type="text/javascript"> - var theme = Timeline.ClassicTheme.create(); - theme.event.label.width = 220; // px - theme.event.bubble.width = 400; - theme.event.bubble.height = 80; - function onLoad() { - var eventSource = new Timeline.DefaultEventSource(); - var bandInfos = [ - Timeline.createBandInfo({ - eventSource: eventSource, - showEventText: false, - trackHeight: 0.5, - trackGap: 0.2, - date: "<%= startDate %> GMT", - width: "100%", - intervalUnit: Timeline.DateTime.<%= intervalUnit2 %>, - intervalPixels: <%= intervalPixels %>, - theme: theme, - }) - ]; - bandInfos[0].highlight = true; - - tl = Timeline.create(document.getElementById("my-timeline"), bandInfos); - Timeline.loadXML("events-xml.jsp", function(xml, url) { eventSource.loadXML(xml, url); }); - setupFilterHighlightControls(document.getElementById("controls"), tl, [0], theme); - - } - var resizeTimerID = null; - function onResize() { - if (resizeTimerID == null) { - resizeTimerID = window.setTimeout(function() { - resizeTimerID = null; - tl.layout(); - }, 500); - } - } - </script> - </head> - <body onload="onLoad();" onresize="onResize();"> - <div id="my-timeline" style="height: 500px; border: 1px solid #aaa"></div> - <div class="controls" id="controls"> - </div> - </body> -</html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/event2_viewer.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/event2_viewer.jsp b/src/main/web/hicc/jsp/event2_viewer.jsp deleted file mode 100644 index 109dd11..0000000 --- a/src/main/web/hicc/jsp/event2_viewer.jsp +++ /dev/null @@ -1,75 +0,0 @@ -<%/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */%> -<%@ page import = "java.util.Calendar,java.util.Date,java.text.SimpleDateFormat,java.util.*,java.sql.*,java.io.*,java.util.Calendar, java.util.Date,org.apache.hadoop.chukwa.hicc.ClusterConfig,org.apache.hadoop.chukwa.dao.*,org.apache.hadoop.chukwa.dao.database.*,org.apache.hadoop.chukwa.dao.hdfs.*,org.apache.hadoop.chukwa.util.XssFilter" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.*,org.apache.hadoop.chukwa.extraction.engine.*" %> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<% - String filter = (String) session.getAttribute("filter"); - if (filter == null) { - filter = ""; - } -%> -<div style="height:300px;overflow:auto;"> -Filter: <input type="text" id="<%=XssFilter.filter(request.getParameter("boxId"))%>filter" name="<%=XssFilter.filter(request.getParameter("boxId"))%>filter" value="<%=filter%>"> -<input type="button" name="apply_filter" value="Filter" onClick="filter_event_viewer('<%=XssFilter.filter(request.getParameter("boxId"))%>');"> -<table class="simple" width="100%"> -<tr> -<th>Time</th> -<th>Event</th> -</tr> -<% - String cluster = (String) session.getAttribute("cluster"); - ClusterConfig cc = new ClusterConfig(); - String boxId = XssFilter.filter(request.getParameter("boxId")); - TimeHandler time = new TimeHandler(request); - String startdate = time.getStartTimeText(); - String enddate = time.getEndTimeText(); - String[] timefield = new String[3]; - String[] database = new String[3]; - database[0] = "MRJob"; - database[1] = "HodJob"; - database[2] = "QueueInfo"; - timefield[0] = "LAUNCH_TIME"; - timefield[1] = "StartTime"; - timefield[2] = "timestamp"; - long startDate = time.getStartTime(); - long endDate = time.getEndTime(); - - ChukwaSearchService se = new ChukwaSearchService(); - SearchResult result = se.search(cluster, database, startDate, endDate, - filter, (Token) null); - TreeMap events = result.getRecords(); - - Iterator ei = ( events.keySet() ).iterator(); - while (ei.hasNext()) { - long timestamp = (Long) ei.next(); - List<Record> tEvents = (List) events.get(timestamp); - SimpleDateFormat sdf = new java.text.SimpleDateFormat( - "yyyy-MM-dd HH:mm:ss"); - for (Record event : tEvents) { - String cell = event.toString(); - out.println("<tr><td>" + sdf.format(event.getTime()) + "</td><td>" - + cell + "</td></tr>"); - } - } -%> -</table> -</div> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/event_viewer.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/event_viewer.jsp b/src/main/web/hicc/jsp/event_viewer.jsp deleted file mode 100644 index a6144d7..0000000 --- a/src/main/web/hicc/jsp/event_viewer.jsp +++ /dev/null @@ -1,29 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = " org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); - if(xf.getParameter("type").equals("list")) { -%> -<IFRAME id="<%= xf.getParameter("boxId") %>iframe" src="/hicc/jsp/job_viewer.jsp?<%= xf.filter(request.getQueryString()) %>" width="100%" frameborder="0" height="400" scrolling="no"></IFRAME> -<% } else { %> -<IFRAME id="<%= xf.getParameter("boxId") %>iframe" src="/hicc/jsp/event.jsp" width="100%" frameborder="0" height="600"></IFRAME> -<% } %> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/event_viewer_data.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/event_viewer_data.jsp b/src/main/web/hicc/jsp/event_viewer_data.jsp deleted file mode 100644 index 923d720..0000000 --- a/src/main/web/hicc/jsp/event_viewer_data.jsp +++ /dev/null @@ -1,74 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.extraction.engine.*, org.apache.hadoop.chukwa.hicc.TimeHandler, org.json.*, org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<% String filter=xf.getParameter("query"); - if(filter==null) { - filter=""; - } - TimeHandler th = new TimeHandler(request, (String)session.getAttribute("time_zone")); - long startDate = th.getStartTime(); - long endDate = th.getEndTime(); - - Calendar now = Calendar.getInstance(); - long start = 0; - long end = now.getTimeInMillis(); - String[] database = xf.getParameterValues("database"); - String[] timefield = new String[3]; - timefield[0]="LAUNCH_TIME"; - timefield[1]="StartTime"; - timefield[2]="timestamp"; - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss"); - - ChukwaSearchService se = new ChukwaSearchService(); - String cluster = (String) session.getAttribute("cluster"); - if (cluster == null) - { cluster = "unknown"; } - Token token = (Token) session.getAttribute(database+"_token"); - SearchResult result = se.search(cluster,database,startDate,endDate,filter,token); - TreeMap events = result.getRecords(); - session.setAttribute(database+"_token",result.getToken()); - - SimpleDateFormat sdf= new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - JSONArray array = new JSONArray(); - Iterator ei = (events.keySet()).iterator(); - while(ei.hasNext()) { - long time = (Long) ei.next(); - List<Record> tEvents = (List) events.get(time); - for(Record event : tEvents) { - JSONObject eventRecord = new JSONObject(); - eventRecord.put("id",event.getTime()); - JSONArray cells = new JSONArray(); -// cells.put(sdf.format(event.getTime())); - cells.put(event.toString()); - eventRecord.put("cell",cells); - array.put(eventRecord); - } - } - - JSONObject hash = new JSONObject(); - hash.put("page","1"); - hash.put("total","1"); - hash.put("rows", array); - out.println(hash.toString()); -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/event_viewer_helper.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/event_viewer_helper.jsp b/src/main/web/hicc/jsp/event_viewer_helper.jsp deleted file mode 100644 index 2519cc0..0000000 --- a/src/main/web/hicc/jsp/event_viewer_helper.jsp +++ /dev/null @@ -1,72 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<%@ page import = "java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.extraction.engine.*, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.XssFilter" %> -<% String filter=(String)session.getAttribute("filter"); - if(filter==null) { - filter=""; - } %> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> -<link href="/hicc/css/flexigrid/flexigrid.css" rel="stylesheet" type="text/css"/> -<script type="text/javascript" src="/hicc/js/jquery-1.3.2.min.js"></script> -<script type="text/javascript" src="/hicc/js/flexigrid.js"></script> -</head> -<body> -<div class="flexigrid"> -<table class="flexme1"> - <thead> - <tr> - <th width="100%">Event</th> - </tr> - </thead> -<% - String[] database = xf.getParameterValues("database"); -%> - <tbody> - </tbody> -</table> -</div> -<script type="text/javascript"> -$('.flexme1').flexigrid( - { - url: '/hicc/jsp/event_viewer_data.jsp?<% for(int i=0;i<database.length;i++) { out.print("database="+xf.filter(database[i])+"&"); } %>', - dataType: 'json', - searchitems : [ - {display: 'Event', name : 'event', isdefault: true} - ], - sortorder: "asc", - usepager: true, - useRp: true, - rp: 15, - striped:false, - showTableToggleBtn: true, - width: 'auto', - height: 300 - } -); -</script> -</body> -</html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/event_wrapper.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/event_wrapper.jsp b/src/main/web/hicc/jsp/event_wrapper.jsp deleted file mode 100644 index d091b45..0000000 --- a/src/main/web/hicc/jsp/event_wrapper.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@page import = "org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<IFRAME id="<%= xf.getParameter("boxId") %>iframe" src="/hicc/jsp/event.jsp" width="100%" frameborder="0" height="600"></IFRAME> - http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/events-xml.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/events-xml.jsp b/src/main/web/hicc/jsp/events-xml.jsp deleted file mode 100644 index 9afa5fc..0000000 --- a/src/main/web/hicc/jsp/events-xml.jsp +++ /dev/null @@ -1,93 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%><?xml version="1.0" encoding="UTF-8"?> -<%@ page import = "java.util.Calendar, java.util.Date, java.sql.*, java.text.SimpleDateFormat, java.util.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro, org.apache.hadoop.chukwa.database.DatabaseConfig, org.apache.hadoop.chukwa.util.XssFilter, org.apache.hadoop.hbase.HBaseConfiguration, org.apache.hadoop.hbase.client.HTableInterface, org.apache.hadoop.hbase.client.HTablePool, org.apache.hadoop.hbase.client.Result, org.apache.hadoop.hbase.client.ResultScanner, org.apache.hadoop.hbase.client.Scan, org.apache.hadoop.conf.Configuration" %> -<%! final static private Configuration hconf = HBaseConfiguration.create(); %> -<%! final static private HTablePool pool = new HTablePool(hconf, 60); %> -<% - response.setContentType("text/xml"); - XssFilter xf = new XssFilter(request); - TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); - long start = time.getStartTime(); - long end = time.getEndTime(); - String cluster = (String) session.getAttribute("cluster"); - - HTableInterface table = pool.getTable("Jobs"); - - String family = "summary"; - - Scan scan = new Scan(); - scan.addColumn(family.getBytes(), "jobId".getBytes()); - scan.addColumn(family.getBytes(), "user".getBytes()); - scan.addColumn(family.getBytes(), "submitTime".getBytes()); - scan.addColumn(family.getBytes(), "launchTime".getBytes()); - scan.addColumn(family.getBytes(), "finishTime".getBytes()); - scan.addColumn(family.getBytes(), "status".getBytes()); - scan.setTimeRange(start, end); - scan.setMaxVersions(); - - ResultScanner results = table.getScanner(scan); - Iterator<Result> it = results.iterator(); - ArrayList<HashMap<String, Object>> events = new ArrayList<HashMap<String, Object>>(); - - while(it.hasNext()) { - Result result = it.next(); - HashMap<String, Object> event = new HashMap<String, Object>(); - event.put("jobId", new String(result.getValue(family.getBytes(), "jobId".getBytes()))); - event.put("user", new String(result.getValue(family.getBytes(), "user".getBytes()))); - event.put("submitTime", Long.parseLong(new String(result.getValue(family.getBytes(), "submitTime".getBytes())))); - event.put("launchTime", Long.parseLong(new String(result.getValue(family.getBytes(), "launchTime".getBytes())))); - event.put("finishTime", Long.parseLong(new String(result.getValue(family.getBytes(), "finishTime".getBytes())))); - event.put("status", new String(result.getValue(family.getBytes(), "status".getBytes()))); - events.add(event); - } - results.close(); - table.close(); - -%> -<data> -<% - SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mm:ss"); - for(int i=0;i<events.size();i++) { - HashMap<String, Object> event = events.get(i); - start=(Long)event.get("submitTime"); - end=(Long)event.get("finishTime"); - String event_time = format.format(start); - String launch_time = format.format((Long)event.get("launchTime")); - String event_end_time = format.format(end); - String cell = (String) event.get("_event"); - if(!event.get("status").toString().equals("SUCCEEDED")) { -%> - <event start="<%= event_time %> GMT" latestStart="<%= launch_time %> GMT" end="<%= event_end_time %> GMT" title="Job ID: <%= event.get("jobId") %>" link="/hicc/jsp/job_viewer.jsp?job_id=<%= event.get("jobId") %>" isDuration="true" color="#f00"> - Job ID: <%= event.get("jobId") %> - User: <%= event.get("user") %> - Status: <%= event.get("status") %> - </event> -<% - } else { -%> - <event start="<%= event_time %> GMT" latestStart="<%= launch_time %> GMT" end="<%= event_end_time %> GMT" title="Job ID: <%= event.get("jobId") %>" link="/hicc/jsp/job_viewer.jsp?job_id=<%= event.get("jobId") %>" isDuration="true"> - Job ID: <%= event.get("jobId") %> - User: <%= event.get("user") %> - Status: <%= event.get("status") %> - </event> -<% - } - } %> -</data> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/get_data_source.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/get_data_source.jsp b/src/main/web/hicc/jsp/get_data_source.jsp deleted file mode 100644 index e069f26..0000000 --- a/src/main/web/hicc/jsp/get_data_source.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "org.apache.hadoop.chukwa.extraction.engine.datasource.DsDirectory, org.json.*" %> -<% - String cluster = (String) session.getAttribute("cluster"); - if(cluster==null) { - cluster="unknown"; - } - JSONArray array = new JSONArray(); - DsDirectory ds = DsDirectory.getInstance(); - String[] list = ds.list(cluster); - for(String dataSource : list) { - JSONObject hash = new JSONObject(); - hash.put("label", dataSource); - hash.put("value", dataSource); - array.put(hash); - } - out.println(array.toString()); -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/get_db_data.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/get_db_data.jsp b/src/main/web/hicc/jsp/get_db_data.jsp deleted file mode 100644 index fdf6c36..0000000 --- a/src/main/web/hicc/jsp/get_db_data.jsp +++ /dev/null @@ -1,108 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.text.DecimalFormat" %> -<%@ page import = "java.text.NumberFormat" %> -<%@ page import = "java.sql.*" %> -<%@ page import = "java.io.*" %> -<%@ page import = "org.json.*" %> -<%@ page import = "java.util.Calendar" %> -<%@ page import = "java.util.Date" %> -<%@ page import = "java.text.SimpleDateFormat" %> -<%@ page import = "java.util.*" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.ClusterConfig" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %> -<%@ page import = "org.apache.hadoop.chukwa.util.DatabaseWriter" %> -<%@ page import = "org.apache.hadoop.chukwa.database.Macro" %> -<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %> -<%@ page import = "org.apache.hadoop.chukwa.database.DatabaseConfig" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.DatasetMapper" %> -<% - /* get the passed in parameters */ - String table=request.getParameter("table"); - String startDate=request.getParameter("start"); // in long format - String endDate=request.getParameter("end"); // in long format - - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Date startDateObj=new Date(Long.parseLong(startDate)); - String startDateString = sdf.format(startDateObj); - - Date endDateObj=new Date(Long.parseLong(endDate)); - String endDateString = sdf.format(endDateObj); - - /* get the query result */ - - /* handle special case for other tables: mr_job, mr_task */ - String timeField="timestamp"; - if (table.compareToIgnoreCase("mr_job")==0) { - timeField="finish_time"; - } else if (table.compareToIgnoreCase("mr_task")==0) { - timeField="finish_time"; - } - String query="select * from ["+table+"] where "+timeField+" between '" - +startDateString+"' and '"+endDateString+"'"; - - Macro m=new Macro(Long.parseLong(startDate),Long.parseLong(endDate),query); - - String cluster="demo"; - DatabaseWriter db = new DatabaseWriter(cluster); - - String jsonString="[]"; - - try { - // first get the table - DatabaseMetaData meta = db.getConnection().getMetaData(); - String tableName = m.computeMacro(table); - - ResultSet rsColumns = meta.getColumns(null, null, tableName, null); - ResultSet rs = db.query(m.toString()); - - JSONArray ja = new JSONArray(); - - while (rs.next()) { - rsColumns.beforeFirst(); - JSONObject jo = new JSONObject(); - while (rsColumns.next()) { - String columnName=rsColumns.getString("COLUMN_NAME"); - String data_type=rsColumns.getString("TYPE_NAME"); - String value=""; - if (data_type.compareToIgnoreCase("timestamp")==0) { - java.sql.Timestamp ts=rs.getTimestamp(columnName); - value=Long.toString(ts.getTime()); - } else { - value=rs.getString(columnName); - } - //out.println(columnName+":"+value+"<br/>"); - jo.put(columnName, value); - } - ja.put(jo); - } - db.close(); - - /* convert the result set to JSON */ - jsonString=ja.toString(); - - } catch (Exception e) { - // cannot execute the query - } - - out.println(jsonString); - -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/get_timezone_list.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/get_timezone_list.jsp b/src/main/web/hicc/jsp/get_timezone_list.jsp deleted file mode 100644 index a0ee034..0000000 --- a/src/main/web/hicc/jsp/get_timezone_list.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.util.TimeZone, org.json.*" %> -<% -String[] tzs = TimeZone.getAvailableIDs(); -JSONArray array = new JSONArray(); -for(String tz : tzs) { - JSONObject hash = new JSONObject(); - hash.put("label", tz); - hash.put("value", tz); - array.put(hash); -} -out.println(array.toString()); -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/hadoop_activity.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/hadoop_activity.jsp b/src/main/web/hicc/jsp/hadoop_activity.jsp deleted file mode 100644 index 15c0d9b..0000000 --- a/src/main/web/hicc/jsp/hadoop_activity.jsp +++ /dev/null @@ -1,71 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> - <title>Activity</title> - <script src="/hicc/js/processing.js" type="text/javascript" charset="utf-8"></script> - <script src="/hicc/js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> - <script src="/hicc/js/activity.js" type="text/javascript" charset="utf-8"></script> - - <style type="text/css" media="screen"> - body { - background: #000; - color: #aaa; - font-family: Helvetica, sans-serif; - } - h1 { - font-size: 2.5em; - margin: 0; - margin-top: .5em; - text-align: center; - color: #eee; - font-weight: bold; - } - #glow { - margin: 1em auto; - width: 1000px; - display: block; - } - #date { - text-align: center; - font-size: 1.5em; - } - #footer { - position: absolute; - bottom: 1em; - right: 1em; - font-size: 12px; - } - #footer a { - color: #eee; - } - </style> -</head> -<body> -<h1>Hadoop activity</h1> -<canvas id="glow" width="1000" height="500"></canvas> -<p id="date"></p> -</body> -</html> -
