[vlma-devel] commit: Add a monitoring page (which displays all graphs of servers). ( Adrien Grand )

git version control git at videolan.org
Thu Aug 7 23:19:04 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Thu Aug  7 23:20:12 2008 +0200| [a280f5ecffb42b72743e34ff0e12b9d3c8b1a217] | committer: Adrien Grand 

Add a monitoring page (which displays all graphs of servers).

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=a280f5ecffb42b72743e34ff0e12b9d3c8b1a217
---

 .../web/server/ServerMonitoringController.java     |   49 ++++++++++++++++++++
 .../src/main/webapp/WEB-INF/VLMa-servlet.xml       |    4 +-
 .../src/main/webapp/WEB-INF/defs/templates.xml     |    2 +
 .../webapp/WEB-INF/jsp/server/servermonitoring.jsp |   38 +++++++++++++++
 4 files changed, 92 insertions(+), 1 deletions(-)

diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerMonitoringController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerMonitoringController.java
new file mode 100644
index 0000000..520e67d
--- /dev/null
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerMonitoringController.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2008 the VideoLAN team
+ *
+ * This file is part of VLMa.
+ *
+ * VLMa is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * VLMa is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VLMa. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.videolan.vlma.web.server;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.Controller;
+import org.videolan.vlma.Data;
+
+public class ServerMonitoringController implements Controller {
+
+    public ModelAndView handleRequest(HttpServletRequest arg0,
+            HttpServletResponse arg1) throws Exception {
+        ModelAndView mav = new ModelAndView();
+        mav.addObject("servers", data.getServers());
+        return mav;
+    }
+
+    private Data data;
+
+    public Data getData() {
+        return data;
+    }
+
+    public void setData(Data data) {
+        this.data = data;
+    }
+
+}
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/VLMa-servlet.xml b/vlma-webapp/src/main/webapp/WEB-INF/VLMa-servlet.xml
index 8ed7505..eee1837 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/VLMa-servlet.xml
+++ b/vlma-webapp/src/main/webapp/WEB-INF/VLMa-servlet.xml
@@ -112,6 +112,9 @@
         <property name="data" ref="dataImporter" />
     </bean>
 
+    <bean id="serverMonotoringController" class="org.videolan.vlma.web.server.ServerMonitoringController">
+        <property name="data" ref="dataImporter" />
+    </bean>
 
     <!-- Media beans -->
 
@@ -318,7 +321,6 @@
         <property name="data" ref="dataImporter" />
     </bean>
 
-
     <!-- Orders beans -->
 
     <bean id="orderMonitorController" class="org.videolan.vlma.web.order.OrderMonitorController" />
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/defs/templates.xml b/vlma-webapp/src/main/webapp/WEB-INF/defs/templates.xml
index b571c4b..9b3fe5b 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/defs/templates.xml
+++ b/vlma-webapp/src/main/webapp/WEB-INF/defs/templates.xml
@@ -212,6 +212,8 @@
         <put-attribute name="right" value="/WEB-INF/jsp/server/serverview_right.jsp" />
     </definition>
 
+    <definition name="servermonitoring" template="/WEB-INF/jsp/server/servermonitoring.jsp" />
+
     <!-- services -->
 
     <definition name="services/playlist" template="/WEB-INF/jsp/service/playlist.jsp" />
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/servermonitoring.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/servermonitoring.jsp
new file mode 100644
index 0000000..b287a76
--- /dev/null
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/servermonitoring.jsp
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<%@ include file="/WEB-INF/jsp/include.jsp" %>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+    pageEncoding="UTF-8"%>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+        <meta name="author" content="The VideoLAN Team" />
+        <link rel="shortcut icon" type="image/png" href="<c:url value="/img/favicon.png" />" />
+        <title>Monitoring</title>
+    </head>
+<body>
+
+<table>
+    <c:forEach items="${servers}" var="server">
+    <tr>
+        <td>
+            <b><c:out value="${server.name}" /></b>
+        </td>
+        <td>
+            <img alt="<fmt:message key="servers.view.monitoring.load-alt" />" src="<c:url value="/" />rrdgraph?server=<c:out value="${server.name}" />&what=cpu_load" />
+        </td>
+        <td>
+            <img alt="<fmt:message key="servers.view.monitoring.traffic-alt" />" src="<c:url value="/" />rrdgraph?server=<c:out value="${server.name}" />&what=traffic_out" />
+        </td>
+        <td>
+            <img alt="<fmt:message key="servers.view.monitoring.resources-alt" />" src="<c:url value="/" />rrdgraph?server=<c:out value="${server.name}" />&what=vlc" />
+        </td>
+    </tr>
+    </c:forEach>
+</table>
+
+</body>
+</html>
\ No newline at end of file



More information about the vlma-devel mailing list