diff --git a/build/build.xml b/build/build.xml
index cdd8e52..a04c149 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -86,8 +86,11 @@
-
+
+
+
+
diff --git a/config/jmx.xml b/config/jmx.xml
index dc8b8e3..cb08ebd 100644
--- a/config/jmx.xml
+++ b/config/jmx.xml
@@ -11,7 +11,7 @@
-->
-
+
diff --git a/config/splunkagent.properties b/config/splunkagent.properties
index 95b2d8d..4dcb2ab 100644
--- a/config/splunkagent.properties
+++ b/config/splunkagent.properties
@@ -4,9 +4,9 @@
# Common Agent options
#---------------------
-agent.app.name=MyTestApp
-agent.app.instance=MyJVM
-agent.userEventTags=key1=value1,key2=value2
+agent.app.name=myapp
+agent.app.instance=myjvm
+#agent.userEventTags=key1=value1,key2=value2
#-------------------------
# Splunk Transport options
@@ -14,7 +14,7 @@ agent.userEventTags=key1=value1,key2=value2
#splunk.transport.internalQueueSize=10000
splunk.transport.impl=com.splunk.javaagent.transport.SplunkTCPTransport
#splunk.transport.impl=com.splunk.javaagent.transport.SplunkStdOutTransport
-splunk.transport.tcp.host=your-splunk-server
+splunk.transport.tcp.host=splunkhost
splunk.transport.tcp.port=5150
splunk.transport.tcp.maxQueueSize=5MB
splunk.transport.tcp.dropEventsOnQueueFull=false
@@ -22,13 +22,14 @@ splunk.transport.tcp.dropEventsOnQueueFull=false
#-----------------------------------
# Class/Method/Error Tracing options
#-----------------------------------
-#trace.whitelist=com/some/package/you/want/to/monitor
+trace.whitelist=com/some/package/you/want/to/monitor
trace.blacklist=com/sun,sun/,java/,javax/,com/splunk/javaagent/
trace.methodEntered=true
trace.methodExited=true
trace.classLoaded=true
trace.errors=true
+
#------------------------------
# HPROF Dump Collection options
#------------------------------
@@ -86,10 +87,10 @@ trace.hprof.frequency=600
#--------------------------------------------------------
#Embedded JMX polling , all other JMX config is in the JMX XML configuration file.
-trace.jmx=false
+trace.jmx=true
#name of XML files(minus the ".xml" suffix) that should reside in the root of splunkagent.jar
trace.jmx.configfiles=jmx
#trace.jmx.configfiles=goo,foo
#in seconds
-trace.jmx.default.frequency=60
+trace.jmx.default.frequency=20
#trace.jmx.goo.frequency=30
\ No newline at end of file
diff --git a/releases/splunkagent.tar.gz b/releases/splunkagent.tar.gz
index 885568d..934a902 100644
Binary files a/releases/splunkagent.tar.gz and b/releases/splunkagent.tar.gz differ
diff --git a/splunkagent.jar b/splunkagent.jar
new file mode 100644
index 0000000..26e0923
Binary files /dev/null and b/splunkagent.jar differ
diff --git a/src/com/splunk/javaagent/SplunkJavaAgent.java b/src/com/splunk/javaagent/SplunkJavaAgent.java
index c8fec7a..a903829 100644
--- a/src/com/splunk/javaagent/SplunkJavaAgent.java
+++ b/src/com/splunk/javaagent/SplunkJavaAgent.java
@@ -1,6 +1,7 @@
package com.splunk.javaagent;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.instrument.Instrumentation;
@@ -57,11 +58,19 @@ public SplunkJavaAgent() {
public static void premain(String agentArgument,
Instrumentation instrumentation) {
-
+
try {
agent = new SplunkJavaAgent();
- if (!agent.loadProperties())
+ File propertiesFile = new File(agentArgument);
+ InputStream properties;
+ if (!propertiesFile.exists()) {
+ properties = agent.getJarPropertiesStream();
+ } else {
+ properties = new FileInputStream(propertiesFile);
+ }
+
+ if (!agent.loadProperties(properties))
return;
if (!agent.initCommonProperties())
return;
@@ -477,12 +486,14 @@ private boolean initTransport() {
return true;
}
-
- private boolean loadProperties() {
-
+
+ private InputStream getJarPropertiesStream() {
+ return ClassLoader.getSystemResourceAsStream("splunkagent.properties");
+ }
+
+ private boolean loadProperties(InputStream in) {
this.props = new Properties();
- InputStream in = ClassLoader
- .getSystemResourceAsStream("splunkagent.properties");
+
try {
this.props.load(in);
} catch (IOException e) {
@@ -536,15 +547,15 @@ public static void methodEntered(String className, String methodName,
event.addPair("methodDesc", desc);
event.addPair("threadID", Thread.currentThread().getId());
event.addPair("threadName", Thread.currentThread().getName());
-
+
try {
StackTraceElement ste = Thread.currentThread().getStackTrace()[3];
- if(ste != null)
- event.addPair("lineNumber", ste.getLineNumber());
- event.addPair("sourceFileName", ste.getFileName());
+ if (ste != null)
+ event.addPair("lineNumber", ste.getLineNumber());
+ event.addPair("sourceFileName", ste.getFileName());
} catch (Exception e1) {
}
-
+
addUserTags(event);
try {
agent.eventQueue.put(event);
diff --git a/src/com/splunk/javaagent/jmx/ProcessServerThread.java b/src/com/splunk/javaagent/jmx/ProcessServerThread.java
index e208ad1..be62ef7 100644
--- a/src/com/splunk/javaagent/jmx/ProcessServerThread.java
+++ b/src/com/splunk/javaagent/jmx/ProcessServerThread.java
@@ -11,9 +11,11 @@
import javax.management.NotificationFilter;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
-import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeData;
+
import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.TabularDataSupport;
+import javax.management.openmbean.TabularData;
+
import com.splunk.javaagent.SplunkLogEvent;
import com.splunk.javaagent.jmx.config.Attribute;
@@ -136,9 +138,10 @@ public void run() {
.getOutputname();
if (outputname != null
&& !outputname.isEmpty())
- mBeanAttributes.put(
- operation.getOutputname(),
- resolveObjectToString(result));
+ //mBeanAttributes.put(operation
+ //.getOutputname(),
+ //resolveObjectToString(result));
+ extractAttributeValue(result,mBeanAttributes,operation.getOutputname());
} catch (Exception e) {
// logger.error("Error : " +
@@ -178,7 +181,7 @@ else if (bean.getAttributes() != null) {
// if the attribute pattern is multi level, loop
// through the levels until the value is found
for (String token : tokens) {
-
+
// get root attribute object the first time
if (attributeValue == null) {
try {
@@ -191,22 +194,25 @@ else if (bean.getAttributes() != null) {
// logger.error("Error : "
// + e.getMessage());
}
- } else if (attributeValue instanceof CompositeDataSupport) {
+ } else if (attributeValue instanceof CompositeData) {
try {
-
- attributeValue = ((CompositeDataSupport) attributeValue)
+
+ attributeValue = ((CompositeData) attributeValue)
.get(token);
+
+
} catch (Exception e) {
+ e.printStackTrace();
// logger.error("Error : "
// + e.getMessage());
}
- } else if (attributeValue instanceof TabularDataSupport) {
+ } else if (attributeValue instanceof TabularData) {
try {
Object[] key = { token };
- attributeValue = ((TabularDataSupport) attributeValue)
+ attributeValue = ((TabularData) attributeValue)
.get(key);
} catch (Exception e) {
@@ -214,11 +220,12 @@ else if (bean.getAttributes() != null) {
// logger.error("Error : "
// + e.getMessage());
}
- } else {
-
+ }
+ else {
+
}
}
-
+
mBeanAttributes.put(singular.getOutputname(),
resolveObjectToString(attributeValue));
@@ -297,10 +304,10 @@ private void extractAttributeValue(Object attributeValue,
// logger.error("Error : " + e.getMessage());
}
- } else if (attributeValue instanceof CompositeDataSupport) {
+ } else if (attributeValue instanceof CompositeData) {
try {
- CompositeDataSupport cds = ((CompositeDataSupport) attributeValue);
+ CompositeData cds = ((CompositeData) attributeValue);
CompositeType ct = cds.getCompositeType();
Set keys = ct.keySet();
@@ -314,10 +321,10 @@ private void extractAttributeValue(Object attributeValue,
// logger.error("Error : " + e.getMessage());
}
- } else if (attributeValue instanceof TabularDataSupport) {
+ } else if (attributeValue instanceof TabularData) {
try {
- TabularDataSupport tds = ((TabularDataSupport) attributeValue);
- Set