geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akulshresh...@apache.org
Subject svn commit: r588469 - in /geronimo/sandbox/monitoring/client: client-ear/src/main/resources/ client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/ client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/util/ client-war...
Date Fri, 26 Oct 2007 02:12:57 GMT
Author: akulshreshtha
Date: Thu Oct 25 19:12:57 2007
New Revision: 588469

URL: http://svn.apache.org/viewvc?rev=588469&view=rev
Log:
GERONIMO-3527 Monitoring Client: Default Server view, Patch by Erik B. Craig

Modified:
    geronimo/sandbox/monitoring/client/client-ear/src/main/resources/MonitoringClientDB.sql
    geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java
    geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/util/DBManager.java
    geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
    geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp

Modified: geronimo/sandbox/monitoring/client/client-ear/src/main/resources/MonitoringClientDB.sql
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-ear/src/main/resources/MonitoringClientDB.sql?rev=588469&r1=588468&r2=588469&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-ear/src/main/resources/MonitoringClientDB.sql
(original)
+++ geronimo/sandbox/monitoring/client/client-ear/src/main/resources/MonitoringClientDB.sql
Thu Oct 25 19:12:57 2007
@@ -13,7 +13,7 @@
     server_id   INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0,
INCREMENT BY 1),
     enabled SMALLINT DEFAULT 1 NOT NULL,
     name VARCHAR(128) DEFAULT NULL,
-    ip   VARCHAR(15) UNIQUE NOT NULL,
+    ip   VARCHAR(128) UNIQUE NOT NULL,
     username    VARCHAR(128) NOT NULL,
     password    VARCHAR(1024) NOT NULL,
     added       TIMESTAMP NOT NULL,
@@ -90,7 +90,7 @@
     added       TIMESTAMP NOT NULL,
     modified    TIMESTAMP NOT NULL
 );
-INSERT INTO servers VALUES(DEFAULT, DEFAULT, 'localhost', '127.0.0.1', 'system', 'manager',
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
+INSERT INTO servers VALUES(DEFAULT, DEFAULT, 'Local host', '127.0.0.1', 'system', 'manager',
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
 INSERT INTO graphs VALUES(  
     DEFAULT,
     DEFAULT,
@@ -193,5 +193,6 @@
     CURRENT_TIMESTAMP,
     CURRENT_TIMESTAMP
 );
+
 
 

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java?rev=588469&r1=588468&r2=588469&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java
Thu Oct 25 19:12:57 2007
@@ -288,165 +288,20 @@
     }
 
     @SuppressWarnings("unchecked")
-    public ArrayList<HashMap<String, HashMap<String, Object>>> getLatestSnapshots()
+    public HashMap<String, HashMap<String, Object>> getLatestSnapshots()
             throws Exception
     {
-        int snapCount = 2;
+        int snapCount = 1;
         int skipCount = 1;
         ArrayList<HashMap<String, HashMap<String, Object>>> snapshotList
= mrc
                 .fetchSnapshotData(snapCount, skipCount);
         // Check if snapshotList is empty
         if (snapshotList.size() == 0)
         {
-            return snapshotList;
+            return null;
         }
-        /*
-         * If there are not enough snapshots available to fill the requested
-         * number, insert some with values of 0 and the proper times.
-         */
-        while (snapshotList.size() < snapCount)
-        {
-            // Temporary, always is first element (oldest)
-            HashMap<String, HashMap<String, Object>> mapTimeFix = snapshotList
-                    .get(0);
-
-            // Temporary map, used to generate blank data to be added to
-            // the
-            // list at position 0
-            HashMap<String, HashMap<String, Object>> tempMap = new HashMap<String,
HashMap<String, Object>>();
-
-            // Temporary submap, used to store 0 elements to be added to
-            // the
-            // tempmap
-            HashMap<String, Object> subMap = new HashMap<String, Object>();
-
-            // Calculate appropriate time, add it to the submap, then
-            // add
-            // that to the tempMap
-            subMap
-                    .put("snapshot_time", ((Long) mapTimeFix.get("times").get(
-                            "snapshot_time") - (MRCConnector
-                            .getSnapshotDuration() * skipCount)));
-            Format formatter = null;
-            formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            Date date = new Date((Long) subMap.get("snapshot_time"));
-            subMap.put("snapshot_date", formatter.format(date));
-
-            // Add the submap back to the tempmap
-            tempMap.put("times", new HashMap<String, Object>(subMap));
-
-            // Clear out the subMap for use again
-            subMap.clear();
-
-            // Run through the mbeans
-
-            // Run through the mbeans
-            for (Iterator<String> it = mapTimeFix.keySet().iterator(); it
-                    .hasNext();)
-            {
-                // get the mbean name
-                String mbeanName = it.next();
-                HashMap<String, Object> stats = null;
-                // Verify that it's not times
-
-                if (mbeanName.equals(new String("times")))
-                {
-
-                }
-                else
-                {
-                    stats = mapTimeFix.get(mbeanName);
-                    // Run through the stats elements for the particular
-                    // mbean
-                    for (Iterator<String> itt = stats.keySet().iterator(); itt
-                            .hasNext();)
-                    {
-                        String key = itt.next();
-                        // Place faux data into the submap
-                        subMap.put(key, new Long(0));
-                    }
-                    // Add the submap to the tempmap, and clear it
-                    tempMap.put(mbeanName, new HashMap<String, Object>(subMap));
-                }
-            }
-            snapshotList.add(0, new HashMap<String, HashMap<String, Object>>(
-                    tempMap));
-        }
-
-        /*
-         * This is where we will be inserting data to fill 'gaps' in the
-         * snapshots The initial for-loop will travel from the most recent
-         * snapshot to the oldest, checking that the snapshot_time along the
-         * way all align with what they should be
-         */
-        for (int i = snapshotList.size() - 1; i > 0; i--)
-        {
-            if (i > 0)
-            {
-                HashMap<String, HashMap<String, Object>> mapTimeFix = snapshotList
-                        .get(i);
-                HashMap<String, HashMap<String, Object>> mapTimeFix2 = snapshotList
-                        .get(i - 1);
-                // here is where we will in missing data
-                while (((((Long) mapTimeFix.get("times").get("snapshot_time") / 1000) / 60)
-                        - (((Long) mapTimeFix2.get("times")
-                                .get("snapshot_time") / 1000) / 60) > (((MRCConnector
-                        .getSnapshotDuration() / 1000) / 60) * skipCount)))
-                {
-                    HashMap<String, HashMap<String, Object>> tempMap = new HashMap<String,
HashMap<String, Object>>();
-                    HashMap<String, Object> subMap = new HashMap<String, Object>();
-
-                    for (Iterator<String> it = mapTimeFix.keySet().iterator(); it
-                            .hasNext();)
-                    {
-                        // get the mbean name
-                        String mbeanName = it.next();
-                        HashMap<String, Object> stats = null;
-                        // Verify that it's not times
-                        if (!mbeanName.equals("times"))
-                        {
-                            stats = mapTimeFix.get(mbeanName);
-                            // Run through the stats elements for the
-                            // particular
-                            // mbean
-                            for (Iterator<String> itt = stats.keySet()
-                                    .iterator(); itt.hasNext();)
-                            {
-                                String key = itt.next();
-                                // Place faux data into the submap
-                                subMap.put(key, new Long(0));
-                            }
-                            // Add the submap to the tempmap, and clear it
-                            tempMap.put(mbeanName, new HashMap<String, Object>(
-                                    subMap));
-                            subMap.clear();
-                        }
-                    }
-
-                    subMap
-                            .put(
-                                    "snapshot_time",
-                                    new Long(
-                                            (Long) mapTimeFix.get("times").get(
-                                                    "snapshot_time")
-                                                    - (MRCConnector
-                                                            .getSnapshotDuration() * skipCount)));
-                    Format formatter = null;
-                    formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                    Date date = new Date((Long) subMap.get("snapshot_time"));
-                    subMap.put("snapshot_date", formatter.format(date));
-                    tempMap.put("times", new HashMap<String, Object>(subMap));
-                    subMap.clear();
-                    snapshotList.add(i,
-                            new HashMap<String, HashMap<String, Object>>(
-                                    tempMap));
-                    snapshotList.remove(0);
-                    mapTimeFix = tempMap;
-                    mapTimeFix2 = snapshotList.get(i - 1);
-                }
-            }
-        }
-        return snapshotList;
+        else
+            return snapshotList.get(0);
     }
 
     /**
@@ -678,6 +533,12 @@
     {
         mrc.addMBeanForSnapshot(MBean);
         return true;
+    }
+
+    @SuppressWarnings("unchecked")
+    public HashMap<String, Long> getStats(String MBean) throws Exception
+    {
+        return mrc.getStats(MBean);
     }
 
 }

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/util/DBManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/util/DBManager.java?rev=588469&r1=588468&r2=588469&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/util/DBManager.java
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/util/DBManager.java
Thu Oct 25 19:12:57 2007
@@ -112,7 +112,7 @@
                             + "server_id   INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS
AS IDENTITY (START WITH 0, INCREMENT BY 1),"
                             + "enabled SMALLINT DEFAULT 1 NOT NULL,"
                             + "name VARCHAR(128) DEFAULT NULL,"
-                            + "ip   VARCHAR(15) UNIQUE NOT NULL,"
+                            + "ip   VARCHAR(128) UNIQUE NOT NULL,"
                             + "username    VARCHAR(128) NOT NULL,"
                             + "password    VARCHAR(1024) NOT NULL,"
                             + "added       TIMESTAMP NOT NULL,"
@@ -155,7 +155,7 @@
                             + "modified    TIMESTAMP NOT NULL)");
             pStmt.executeUpdate();
             pStmt = con
-                    .prepareStatement("INSERT INTO servers VALUES(DEFAULT, DEFAULT, 'localhost',
'127.0.0.1', 'system', 'manager', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)");
+                    .prepareStatement("INSERT INTO servers VALUES(DEFAULT, DEFAULT, 'Local
host', '127.0.0.1', 'system', 'manager', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)");
             pStmt.executeUpdate();
             pStmt = con
                     .prepareStatement("INSERT INTO graphs VALUES("

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp?rev=588469&r1=588468&r2=588469&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
Thu Oct 25 19:12:57 2007
@@ -78,7 +78,7 @@
  <thead align="center"><strong>Servers</strong></thead>
  <tr>
   <th class="DarkBackground" width="20%">Name</th>
-  <th class="DarkBackground" width="10%">IP</th>
+  <th class="DarkBackground" width="10%">Address</th>
   <th class="DarkBackground" width="10%">Status</th>
   <th class="DarkBackground" width="10%">Stat. Query</th>
   <th class="DarkBackground" width="20%" colspan="2">Actions</th>

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp?rev=588469&r1=588468&r2=588469&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
Thu Oct 25 19:12:57 2007
@@ -21,6 +21,7 @@
 <%@ page import="java.util.Vector" %>
 <%@ page import="java.util.Set" %>
 <%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.HashMap" %>
 <%@ page import="java.util.TreeMap" %>
 <%@ page import="java.lang.String" %>
 <%@ page import="java.sql.Connection" %>
@@ -103,7 +104,9 @@
  if (message != null)
  {
  %>
-<p><%=message %></p><br>
+<div align="left" style="width: 500px">
+<%=message %><br>
+</div>
 <%} %>
 <table>
     <tr>
@@ -116,9 +119,43 @@
             </p>         
             <p><%=rs2.getString("ip")%></p>
             <table>
-            <tr><th>Stat</th><th>Value</th></tr>
-            </tr><td>JVM Memory:</td><td>5</td></tr>
-             </tr><td>JVM Stat:</td><td>2</td></tr>
+            <%
+            Integer counter = 0;
+            for (Iterator <String> it = trackedBeansMap.keySet().iterator(); it.hasNext();)
+            {
+                String prettyBean = it.next().toString();
+                Set<String> statAttributes = MRCConnection.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
+                HashMap<String, Long> beanStats = MRCConnection.getStats(trackedBeansMap.get(prettyBean));
+                if ((counter%3) == 0)
+                {
+                 %>
+                 <tr>
+                <%
+                }
+            %>
+                <td valign="top">
+                <table style="padding-left: 8px; padding-bottom: 10px;">
+                <tr><th colspan="2"><%=prettyBean%></th></tr>
+                <%
+                for (Iterator <String> itt = statAttributes.iterator(); itt.hasNext();)
+                {
+                    String dataName = itt.next().toString();
+                %>
+                    <tr><td><%=dataName%></td><td><%=beanStats.get(dataName)
%></td></tr>
+                <%
+                }
+                %>
+                </table>
+                </td>
+                <%
+                if ((counter%3) == 2)
+                {
+                 %>
+                 </tr>
+                <%
+                }
+                counter = counter + 1;
+             }%>
             </table>
 <% for (StatsGraph graph : GraphVector) 
 {
@@ -166,14 +203,13 @@
 
                         
                         <%
-                        Iterator<String> itTracked = trackedBeansMap.keySet().iterator();

-                        while  ( itTracked.hasNext() )   
+                        for (Iterator <String> it = trackedBeansMap.keySet().iterator();
it.hasNext();)   
                         {
-                            String prettyBean = itTracked.next().toString();
+                            String prettyBean = it.next().toString();
                           %>
                                            <tr>
                     <td width=95% bgcolor="#FFFFFF" nowrap>
-                           <a href="#"><%=prettyBean%></a>
+                           <%=prettyBean%>
                            </td>
                     <td align="right" width=5% bgcolor="#f2f2f2" nowrap>
                     <a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="stopTrackingMbean" /><portlet:param name="server_id" value="<%=server_id%>"
/><portlet:param name="mbean" value="<%=trackedBeansMap.get(prettyBean)%>" /></portlet:actionURL>">X</a><br>
@@ -195,14 +231,13 @@
 
                         
                         <%
-                        Iterator<String> itAvailable = availableBeansMap.keySet().iterator();

-                        while  ( itAvailable.hasNext() )   
+                        for (Iterator <String> it = availableBeansMap.keySet().iterator();
it.hasNext();)   
                         {
-                            String prettyBean = itAvailable.next().toString();
+                            String prettyBean = it.next().toString();
                           %>
                                            <tr>
                     <td width=95% bgcolor="#FFFFFF" nowrap>
-                           <a href="#"><%=prettyBean%></a>
+                           <%=prettyBean%>
                            </td>
                     <td align="right" width=5% bgcolor="#f2f2f2" nowrap>
                     <a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="startTrackingMbean" /><portlet:param name="server_id" value="<%=server_id%>"
/><portlet:param name="mbean" value="<%=availableBeansMap.get(prettyBean)%>" /></portlet:actionURL>">+</a><br>
@@ -261,6 +296,7 @@
     </tr>
 </table>
     <%}%>
+
 
 
 



Mime
View raw message