[vlma-devel] commit: Graph incoming traffic too. (Adrien Grand )

git version control git at videolan.org
Sun Nov 2 22:41:27 CET 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Nov  2 22:36:49 2008 +0100| [d763de4d691fbbe38eed9289d72e7e85cfef6c57] | committer: Adrien Grand 

Graph incoming traffic too.

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

 .../java/org/videolan/vlma/VLMaServiceImpl.java    |   19 +++++++++++++------
 .../videolan/vlma/web/servlet/RrdGraphServlet.java |    2 +-
 .../webapp/WEB-INF/jsp/server/servermonitoring.jsp |    2 +-
 .../webapp/WEB-INF/jsp/server/serverview_right.jsp |    2 +-
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
index e2327b0..ba746c7 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
@@ -191,6 +191,11 @@ public class VLMaServiceImpl implements VLMaService {
             } catch (IOException e) {
                 logger.error("Error while creating RRD file of " + rrdR.getPath(), e);
             }
+            // It seems JRobin does not like several modifications of a RRD
+            // file within less than one second
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) { }
         }
         return rrdR.getPath();
     }
@@ -271,26 +276,28 @@ public class VLMaServiceImpl implements VLMaService {
             graphDef.gprint("cpu_load", "AVERAGE", "Average CPU load: @3 at r");
             graphDef.setLowerLimit(0);
             graphDef.setTimePeriod(startTime, endTime);
-            graphDef.setTitle("Load");
+            graphDef.setTitle("CPU load");
             rrdGraph = new RrdGraph(graphDef);
             File rrdGraphFile = new File(rrdDir, server.getName() + "-cpu_load.png");
             rrdGraph.saveAsPNG(rrdGraphFile.getAbsolutePath());
 
             graphDef = new RrdGraphDef();
+            graphDef.datasource("traffic_in", createRrdFileIfNecessary(server), "traffic_in", "AVERAGE");
             graphDef.datasource("traffic_out", createRrdFileIfNecessary(server), "traffic_out", "AVERAGE");
-            graphDef.line("traffic_out", Color.BLUE, "Outgoing traffic at L", 3);
+            graphDef.line("traffic_in", Color.BLUE, "Incoming traffic", 3);
+            graphDef.line("traffic_out", Color.RED, "Outgoing traffic", 3);
             graphDef.setLowerLimit(0);
             graphDef.setTimePeriod(startTime, endTime);
-            graphDef.setTitle("Outgoing traffic");
+            graphDef.setTitle("Traffic");
             rrdGraph = new RrdGraph(graphDef);
-            rrdGraphFile = new File(rrdDir, server.getName() + "-traffic_out.png");
+            rrdGraphFile = new File(rrdDir, server.getName() + "-traffic.png");
             rrdGraph.saveAsPNG(rrdGraphFile.getAbsolutePath());
 
             graphDef = new RrdGraphDef();
             graphDef.datasource("vlc_cpu", createRrdFileIfNecessary(server), "vlc_cpu", "AVERAGE");
             graphDef.datasource("vlc_mem", createRrdFileIfNecessary(server), "vlc_mem", "AVERAGE");
-            graphDef.line("vlc_cpu", Color.RED, "CPU usage for VLC");
-            graphDef.line("vlc_mem", Color.BLUE, "Memory usage for VLC");
+            graphDef.line("vlc_cpu", Color.RED, "CPU usage for VLC", 3);
+            graphDef.line("vlc_mem", Color.BLUE, "Memory usage for VLC", 3);
             graphDef.setLowerLimit(0);
             graphDef.setTimePeriod(startTime, endTime);
             graphDef.setTitle("Resources used for VLC");
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/servlet/RrdGraphServlet.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/servlet/RrdGraphServlet.java
index 84d49f9..e7ec1c4 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/servlet/RrdGraphServlet.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/servlet/RrdGraphServlet.java
@@ -63,7 +63,7 @@ public class RrdGraphServlet extends HttpServlet {
 
         String what = request.getParameter("what");
         Assert.isTrue("vlc".equals(what) || "cpu_load".equals(what)
-                || "traffic_out".equals(what));
+                || "traffic".equals(what));
 
         String basePath = data.getString("vlma.data");
         File rrdDir = new File(basePath, "rrd");
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
index b287a76..6047ec3 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/servermonitoring.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/servermonitoring.jsp
@@ -25,7 +25,7 @@
             <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" />
+            <img alt="<fmt:message key="servers.view.monitoring.traffic-alt" />" src="<c:url value="/" />rrdgraph?server=<c:out value="${server.name}" />&what=traffic" />
         </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" />
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serverview_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serverview_right.jsp
index b20b421..3bb2136 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serverview_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serverview_right.jsp
@@ -47,7 +47,7 @@
         <img alt="<fmt:message key="servers.view.monitoring.load-alt" />" src="<c:url value="/" />rrdgraph?server=<c:out value="${server.name}" />&what=cpu_load" />
     </li>
     <li><fmt:message key="servers.view.monitoring.traffic" /><br />
-        <img alt="<fmt:message key="servers.view.monitoring.traffic-alt" />" src="<c:url value="/" />rrdgraph?server=<c:out value="${server.name}" />&what=traffic_out" />
+        <img alt="<fmt:message key="servers.view.monitoring.traffic-alt" />" src="<c:url value="/" />rrdgraph?server=<c:out value="${server.name}" />&what=traffic" />
     </li>
     <li><fmt:message key="servers.view.monitoring.resources" /><br />
         <img alt="<fmt:message key="servers.view.monitoring.resources-alt" />" src="<c:url value="/" />rrdgraph?server=<c:out value="${server.name}" />&what=vlc" />



More information about the vlma-devel mailing list