You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ak...@apache.org on 2007/10/24 02:24:04 UTC
svn commit: r587714 - in /geronimo/sandbox/monitoring: ./
client/client-ear/src/main/resources/ client/client-war/
client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/
client/client-war/src/main/java/org/apache/geronimo/plugin...
Author: akulshreshtha
Date: Tue Oct 23 17:24:03 2007
New Revision: 587714
URL: http://svn.apache.org/viewvc?rev=587714&view=rev
Log:
GERONIMO-3547 Monitoring Client, Connect via MEJB instead of JMX, Patch by Erik B. Craig
Modified:
geronimo/sandbox/monitoring/client/client-ear/src/main/resources/MonitoringClientDB.sql
geronimo/sandbox/monitoring/client/client-war/pom.xml
geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/GraphsBuilder.java
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/MonitoringPortlet.java
geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/StatsGraph.java
geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/util/DBManager.java
geronimo/sandbox/monitoring/pom.xml
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=587714&r1=587713&r2=587714&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 Tue Oct 23 17:24:03 2007
@@ -100,7 +100,7 @@
DEFAULT,
'geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.configs/tomcat6/2.1-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebConnector',
'D',
- 'BytesSent',
+ 'Bytes Sent',
'/1024/',
'D',
'time',
@@ -123,7 +123,7 @@
DEFAULT,
'geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.configs/tomcat6/2.1-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebConnector',
'D',
- 'BytesReceived',
+ 'Bytes Received',
'/1024/',
'D',
'time',
@@ -146,7 +146,7 @@
DEFAULT,
'geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.configs/tomcat6/2.1-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebConnector',
'D',
- 'RequestTimeCurrentTime',
+ 'Request Time CurrentTime',
'/',
'D',
'time',
@@ -169,7 +169,7 @@
DEFAULT,
'geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.configs/tomcat6/2.1-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebConnector',
'D',
- 'ErrorCount',
+ 'Error Count',
'/',
'D',
'time',
@@ -193,4 +193,5 @@
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
);
+
Modified: geronimo/sandbox/monitoring/client/client-war/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/pom.xml?rev=587714&r1=587713&r2=587714&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/pom.xml (original)
+++ geronimo/sandbox/monitoring/client/client-war/pom.xml Tue Oct 23 17:24:03 2007
@@ -73,6 +73,12 @@
</dependency>
<dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_2.5_spec</artifactId>
<scope>provided</scope>
@@ -82,6 +88,13 @@
<groupId>org.apache.geronimo.modules</groupId>
<artifactId>geronimo-j2ee</artifactId>
<scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.plugins.mrc</groupId>
+ <artifactId>mrc-server-ejb</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <type>jar</type>
</dependency>
</dependencies>
Modified: geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/GraphsBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/GraphsBuilder.java?rev=587714&r1=587713&r2=587714&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/GraphsBuilder.java (original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/GraphsBuilder.java Tue Oct 23 17:24:03 2007
@@ -32,7 +32,6 @@
public class GraphsBuilder
{
-
private String ServerIP = new String();
private final HashMap<String, ArrayList<String>> DataNameList = new HashMap<String, ArrayList<String>>();
private int timeFrame;
@@ -103,7 +102,7 @@
Vector<Object> snapshot_date = new Vector<Object>();
Vector<Object> snapshot_time = new Vector<Object>();
- ;
+
Vector<Object> PrettyTime = new Vector<Object>();
String prettyTimeFrame = new String();
@@ -128,7 +127,6 @@
// TODO: Call the fetching thing here
ArrayList<HashMap<String, HashMap<String, Object>>> snapshotList = MRCConnection
.getSnapshots(snapCount, skipCount);
-
// Check if snapshotList is 0
// TODO: Return a buncha null datas
if (snapshotList.size() == 0)
@@ -287,7 +285,6 @@
{
e.printStackTrace();
}
-
return (new StatsGraph(graph_id, ServerIP + " - "
+ rs.getString("xlabel") + " - " + prettyTimeFrame, rs
.getString("description"), "Time - " + prettyTimeFrame, rs
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=587714&r1=587713&r2=587714&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 Tue Oct 23 17:24:03 2007
@@ -18,21 +18,22 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.Iterator;
+import java.util.Properties;
import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.geronimo.monitor.MasterRemoteControlRemote;
public class MRCConnector
{
- private static final String PATH = "geronimo:ServiceModule=org.apache.geronimo.monitor/MRC/1.0/car,J2EEServer=geronimo,name=MasterRemoteControl,j2eeType=GBean";
- private static MBeanServerConnection mbServerConn;
- private static Long SnapshotDuration = new Long(0);
+ private static final String PATH = "geronimo:ServiceModule=org.apache.geronimo.monitor/MRC/1.0/car,J2EEServer=geronimo,name=MasterRemoteControl,j2eeType=GBean";
+ private static MBeanServerConnection mbServerConn;
+ private static Long SnapshotDuration = new Long(0);
+ private static MasterRemoteControlRemote mrc = null;
MRCConnector()
{
@@ -52,16 +53,17 @@
public MRCConnector(String ServerIP, String userName, String password)
throws Exception
{
- JMXServiceURL serviceURL = new JMXServiceURL(
- "service:jmx:rmi:///jndi/rmi://" + ServerIP
- + ":1099/JMXConnector");
- Hashtable<String, Object> env = new Hashtable<String, Object>();
- String[] credentials = new String[2];
- credentials[0] = userName;
- credentials[1] = password;
- env.put(JMXConnector.CREDENTIALS, credentials);
- JMXConnector connector = JMXConnectorFactory.connect(serviceURL, env);
- mbServerConn = connector.getMBeanServerConnection();
+ Properties props = new Properties();
+ props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
+ "org.openejb.client.RemoteInitialContextFactory");
+ props.setProperty(Context.PROVIDER_URL, "ejbd://" + ServerIP + ":4201");
+ props.setProperty(Context.SECURITY_PRINCIPAL, userName);
+ props.setProperty(Context.SECURITY_CREDENTIALS, password);
+ props.setProperty("openejb.authentication.realmName", "geronimo-admin");
+ Context ic = new InitialContext(props);
+ mrc = (MasterRemoteControlRemote) ic.lookup("ejb/mgmt/MRCRemote");
+ mrc.setUpMEJB(userName, password);
+
}
/**
@@ -74,10 +76,10 @@
{
if (SnapshotDuration == 0)
{
- SnapshotDuration = (Long) mbServerConn.invoke(new ObjectName(PATH),
- "getSnapshotDuration", new Object[] {}, new String[] {});
+ SnapshotDuration = mrc.getSnapshotDuration();
}
return SnapshotDuration;
+
}
/**
@@ -92,12 +94,10 @@
{
HashMap<String, ArrayList<String>> DataNameList = new HashMap<String, ArrayList<String>>();
+
try
{
- DataNameList = (HashMap<String, ArrayList<String>>) mbServerConn
- .invoke(new ObjectName(PATH),
- "getAllSnapshotStatAttributes", new Object[] {},
- new String[] {});
+ DataNameList = mrc.getAllSnapshotStatAttributes();
}
catch (Exception e)
{
@@ -128,11 +128,7 @@
public ArrayList<HashMap<String, HashMap<String, Object>>> getSnapshots(
int snapCount, int skipCount) throws Exception
{
- ArrayList<HashMap<String, HashMap<String, Object>>> list = (ArrayList<HashMap<String, HashMap<String, Object>>>) mbServerConn
- .invoke(new ObjectName(PATH), "fetchSnapshotData",
- new Object[] { snapCount, skipCount }, new String[] {
- "java.lang.Integer", "java.lang.Integer" });
- return list;
+ return mrc.fetchSnapshotData(snapCount, skipCount);
}
/**
@@ -142,9 +138,7 @@
*/
public boolean stopSnapshotThread() throws Exception
{
- mbServerConn.invoke(new ObjectName(PATH), "stopSnapshot",
- new Object[] {}, new String[] {});
- return true;
+ return mrc.stopSnapshot();
}
/**
@@ -154,23 +148,11 @@
*/
public boolean startSnapshotThread(long time) throws Exception
{
- try
- {
- mbServerConn.invoke(new ObjectName(PATH), "startSnapshot",
- new Object[] { new Long(time) },
- new String[] { "java.lang.Long" });
- }
- catch (Exception e)
- {
- e.printStackTrace();
- return false;
- }
- return true;
+ return mrc.startSnapshot(time);
}
public boolean isSnapshotRunning() throws Exception
{
- return Boolean.TRUE.equals(mbServerConn.invoke(new ObjectName(PATH),
- "isSnapshotRunning", new Object[] {}, new String[] {}));
+ return mrc.isSnapshotRunning();
}
}
Modified: geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java?rev=587714&r1=587713&r2=587714&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java (original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java Tue Oct 23 17:24:03 2007
@@ -246,7 +246,8 @@
try
{
- if (MRCConnection.startSnapshotThread(new Long(snapshotDuration)))
+ if (MRCConnection
+ .startSnapshotThread(new Long(snapshotDuration)))
{
request.setAttribute("message",
"<b>Snapshot thread started on server "
Modified: geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/StatsGraph.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/StatsGraph.java?rev=587714&r1=587713&r2=587714&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/StatsGraph.java (original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/StatsGraph.java Tue Oct 23 17:24:03 2007
@@ -60,7 +60,6 @@
DivImplement = "<div id=\"" + DivName + "\"></div>" + "\n";
GraphJS = "var " + "graph" + graph_id + "Data = \n" + "[\n";
-
for (int i = 1; i < dataSet1.size(); i++)
{
if (((Long) dataSet1.get(i) - (Long) dataSet1.get(i - 1)) < 0)
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=587714&r1=587713&r2=587714&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 Tue Oct 23 17:24:03 2007
@@ -166,7 +166,7 @@
+ "'KiloBytes sent per second from the Tomcat Web Connector',"
+ "DEFAULT,"
+ "'geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.configs/tomcat6/2.1-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebConnector',"
- + "'D'," + "'BytesSent'," + "'/1024/'," + "'D',"
+ + "'D'," + "'Bytes Sent'," + "'/1024/'," + "'D',"
+ "'time'," + "'Tomcat Web KBytes/Sec Sent',"
+ "'KBps'," + "500.0," + "1024.0," + "DEFAULT,"
+ "DEFAULT," + "CURRENT_TIMESTAMP,"
@@ -181,7 +181,7 @@
+ "'KiloBytes received per second from the Tomcat Web Connector',"
+ "DEFAULT,"
+ "'geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.configs/tomcat6/2.1-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebConnector',"
- + "'D'," + "'BytesReceived'," + "'/1024/',"
+ + "'D'," + "'Bytes Received'," + "'/1024/',"
+ "'D'," + "'time',"
+ "'Tomcat Web KBytes/Sec Received'," + "'KBps',"
+ "500.0," + "1024.0," + "DEFAULT," + "DEFAULT,"
@@ -197,7 +197,7 @@
+ "'Request processing time over time from the Tomcat Web Connector',"
+ "DEFAULT,"
+ "'geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.configs/tomcat6/2.1-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebConnector',"
- + "'D'," + "'RequestTimeCurrentTime'," + "'/',"
+ + "'D'," + "'Request Time CurrentTime'," + "'/',"
+ "'D'," + "'time',"
+ "'Tomcat Request Time/Second',"
+ "'RequestTime'," + "500.0," + "1024.0,"
@@ -213,7 +213,7 @@
+ "'Error count over time from the Tomcat Web Connector',"
+ "DEFAULT,"
+ "'geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.configs/tomcat6/2.1-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebConnector',"
- + "'D'," + "'ErrorCount'," + "'/'," + "'D',"
+ + "'D'," + "'Error Count'," + "'/'," + "'D',"
+ "'time'," + "'Error Count/Sec'," + "'Errors',"
+ "500.0," + "1024.0," + "DEFAULT," + "DEFAULT,"
+ "CURRENT_TIMESTAMP," + "CURRENT_TIMESTAMP,"
Modified: geronimo/sandbox/monitoring/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/pom.xml?rev=587714&r1=587713&r2=587714&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/pom.xml (original)
+++ geronimo/sandbox/monitoring/pom.xml Tue Oct 23 17:24:03 2007
@@ -226,8 +226,8 @@
<activeByDefault>true</activeByDefault>
</activation>
<modules>
- <module>client</module>
<module>mrc-server</module>
+ <module>client</module>
</modules>
</profile>
</profiles>