Comments (4)
This seems to be possible by calling ManagementFactory.getPlatformMBeanServer();
to get a MBeanServer
, and calling the queryMBeans
method, passing in the null argument:
When the object name is null or no domain and key properties are specified, all objects are to be selected (and filtered if a query is specified). It returns the set of ObjectInstance objects (containing the ObjectName and the Java Class name) for the selected MBeans.
Then we can iterate through to generate the sample XML configuration entries.
from jmxetric.
@dpocock this issue can probably be closed, thanks!
from jmxetric.
I try to run the MBeanScanner
like this:
$ mvn exec:java -Dexec.mainClass=info.ganglia.jmxetric.MBeanScanner
and it fails like this:
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.management.RuntimeMBeanException: java.lang.UnsupportedOperationException: Usage threshold is not supported
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrow(DefaultMBeanServerInterceptor.java:839)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrowMaybeMBeanException(DefaultMBeanServerInterceptor.java:852)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:651)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
at info.ganglia.jmxetric.MBeanScanner.makeConfigMBeanAttribute(MBeanScanner.java:145)
at info.ganglia.jmxetric.MBeanScanner.scanMBeanAttributes(MBeanScanner.java:119)
at info.ganglia.jmxetric.MBeanScanner.scanOneMBeanObject(MBeanScanner.java:99)
at info.ganglia.jmxetric.MBeanScanner.getConfigForAllMBeans(MBeanScanner.java:80)
at info.ganglia.jmxetric.MBeanScanner.scan(MBeanScanner.java:67)
at info.ganglia.jmxetric.MBeanScanner.main(MBeanScanner.java:55)
... 6 more
Caused by: java.lang.UnsupportedOperationException: Usage threshold is not supported
at sun.management.MemoryPoolImpl.getUsageThreshold(MemoryPoolImpl.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:193)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:175)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:117)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:54)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
at com.sun.jmx.mbeanserver.PerInterface.getAttribute(PerInterface.java:83)
at com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(MBeanSupport.java:206)
at javax.management.StandardMBean.getAttribute(StandardMBean.java:372)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
... 13 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.975s
[INFO] Finished at: Sun Aug 17 13:34:02 CEST 2014
[INFO] Final Memory: 14M/362M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project jmxetric: An exception occured while executing the Java class. null: InvocationTargetException: java.lang.UnsupportedOperationException: Usage threshold is not supported -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
from jmxetric.
I added a catch block for that exception in commit de4f717
from jmxetric.
Related Issues (20)
- Use of patterns in mbean parameter name doesn't work HOT 6
- should not initialise logging when loaded early, breaks other logging systems HOT 2
- support for deriving rates from counters HOT 1
- delayed mbean initialisation HOT 1
- Scaling metrics
- calls ManagementFactory.getPlatformMBeanServer too early HOT 2
- the value of TMAX in the gmond output XML is always 60, no matter what delay is configured
- need a way to specify DMAX HOT 3
- Using slope=positive does not work for gmond 3.0.x
- support for including configuration from multiple files HOT 2
- better CPU metric support HOT 7
- reloading jmxetric XML configuration at runtime HOT 3
- Private MyPublisher class in MBeanSamplerTest.java does not implement all methods of Publisher interface
- JMXetricAgentIT fails with NumberFormatException HOT 3
- Standardize formatting for source files HOT 1
- jmxetric 1.0.6 fails to honor <ganglia> element in xml config
- Feature request: Read ganglia configuration from gmond.conf, or allow multiple <ganglia> config elements to be specified
- Can't monitor webapp's JVM in JBoss EAP 6.2 (Domain mode) HOT 2
- configuration of jmx
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jmxetric.