Javamelody+spring beans/methods monitoring

475 views
Skip to first unread message

fjpe...@gmail.com

unread,
Dec 31, 2012, 6:36:43 AM12/31/12
to javam...@googlegroups.com
Hi,

I need to monitor the number of executions and mean execution times of certain methods inside spring managed beans (annotated with @MonitoredWithSpring).
I figured I have 2 options, but both have the same problem.
1. Use the external API. The problem is I can't get the last value for a specific bean/method. Whant i need is something like calling http://localhost:8081/javamelody?part=lastValue&graph=springb1ba05eb99b3e298f976e48e730a7d99a9e3c1ff The problem here is that I have no idea to what bean/method springb1ba05eb99b3e298f976e48e730a7d99a9e3c1ff refers. And I'm not sure what info I'll get when doing this call. I need to get the mean execution time and the number of hits.
2. Read the RRD files much like https://github.com/sbower/nagios_javamelody_plugin I have the same problem here, there's no "dictionary" telling me which rrd repository corresponds to my beans/methods.

If I could get these values it'd be very easy to monitor applications using nagios.

Thank you!

Vernat Emeric

unread,
Jan 5, 2013, 8:00:50 PM1/5/13
to javam...@googlegroups.com
Hi,

1. Using the external api with "lastValue", you can get the last mean execution time. In general, for the last minute.
You can know what value to use for the "graph" parameter (such as springb1ba05eb99b3e298f976e48e730a7d99a9e3c1ff), by opening the detail of the bean.method in the report and then look at the URL in your browser.
For example, in the demo for the week period:
http://demo.javamelody.cloudbees.net/monitoring?part=graph&graph=servicesef5fdd5528af358b89ff4dc7860af53143cf560c&period=semaine
And the lastValue:
http://demo.javamelody.cloudbees.net/monitoring?part=lastValue&graph=servicesef5fdd5528af358b89ff4dc7860af53143cf560c

2. By reading the RRD file which have the same name, you could probably get the same last value.


But if you want the number of executions and the mean executions times of a method, I suggest that you use the json or xml external API.
You will need xstream dependency for json and also xpp3 for xml: https://code.google.com/p/javamelody/wiki/ExternalAPI#XML
Once you get the data as xml or json, I suppose that you can parse it and do whatever you want with it.
 
For example, in the demo you can get the statistics for all the requests for the week:
http://demo.javamelody.cloudbees.net/monitoring?period=semaine&format=json
http://demo.javamelody.cloudbees.net/monitoring?period=semaine&format=xml

You could also get the data for your single request. (Note that mean time = durationsSum / hits)
For example:
http://demo.javamelody.cloudbees.net/monitoring?part=graph&graph=servicesef5fdd5528af358b89ff4dc7860af53143cf560c&format=xml&period=week
http://demo.javamelody.cloudbees.net/monitoring?part=graph&graph=servicesef5fdd5528af358b89ff4dc7860af53143cf560c&format=json&period=week
But for a single request, you need to wait for the next release (1.43) or to download the latest jar file from the continuous build at cloudbees:
https://javamelody.ci.cloudbees.com/job/javamelody%20ant/lastSuccessfulBuild/artifact/javamelody.jar

bye,
Emeric

Vernat Emeric

unread,
Jan 5, 2013, 8:05:53 PM1/5/13
to javam...@googlegroups.com
Hi,
(I send again without my error in the last demo URLs)


1. Using the external api with "lastValue", you can get the last mean execution time. In general, for the last minute.
You can know what value to use for the "graph" parameter (such as springb1ba05eb99b3e298f976e48e730a7d99a9e3c1ff), by opening the detail of the bean.method in the report and then look at the URL in your browser.
For example, in the demo for the week period:
http://demo.javamelody.cloudbees.net/monitoring?part=graph&graph=servicesef5fdd5528af358b89ff4dc7860af53143cf560c&period=semaine
And the lastValue:
http://demo.javamelody.cloudbees.net/monitoring?part=lastValue&graph=servicesef5fdd5528af358b89ff4dc7860af53143cf560c

2. By reading the RRD file which have the same name, you could probably get the same last value.


But if you want the number of executions and the mean executions times of a method, I suggest that you use the json or xml external API.
You will need xstream dependency for json and also xpp3 for xml: https://code.google.com/p/javamelody/wiki/ExternalAPI#XML
Once you get the data as xml or json, I suppose that you can parse it and do whatever you want with it.
 
For example, in the demo you can get the statistics for all the requests for the week:
http://demo.javamelody.cloudbees.net/monitoring?period=semaine&format=json
http://demo.javamelody.cloudbees.net/monitoring?period=semaine&format=xml

You could also get the data for your single request. (Note that mean time = durationsSum / hits)
For example:

But for a single request, you need to wait for the next release (1.43) or to download the latest jar file from the continuous build at cloudbees:
https://javamelody.ci.cloudbees.com/job/javamelody%20ant/lastSuccessfulBuild/artifact/javamelody.jar

bye,
Emeric

Le 31/12/2012 12:36, fjpe...@gmail.com a écrit :
Reply all
Reply to author
Forward
0 new messages