Programatically get statistics for deployments on a domain - java

Is there any way to get information specifically about deployments on a glassfish domain? Ideally, heap usage, thread counts, etc. I think this is possible with jconsole and some other visual tools via jmx, but I've never had to attempt such a feat.
Any help would be appreciated.
Thanks in advance.

You can programatically get the server information using JMX. Follow the link below.
http://kalali.me/manage-administrate-and-monitor-glassfish-v3-from-java-code-using-amx-jmx/

I have never had to use this. But there exists a project in Glassfish that provides Java interface to management tools. There is a good article on this here http://kalali.me/manage-administrate-and-monitor-glassfish-v3-from-java-code-using-amx-jmx/
For GlassfishV3 -- the docs are here. http://glassfish.java.net/nonav/v3/admin/planning/V3Changes/V3_AMX_SPI.html
There is some doc available for V2 as well.. I donot find right now.

Related

Suggestions on architecture to monitor services and databases

I am trying to make a monitoring system for JAVA web services. It would be a simple switch kind of system where based on the health of a service it would report 'RUNNING', 'CRITICAL' or 'UNSTABLE'. The challenge is integrating it with existing code. While calling an endpoint with the data would be the easiest, I am not too keen on going down that path because it would require too many changes to the source code. Instead I was looking at run-time injection. Your suggestions on coming up with an architecture would be very helpful. Thanks and let me know if you have questions.
EDIT: Tips on how to extend it to monitor stored procedures in an Oracle DB would be great too.
There is a common answer for such kind of question: just try JMX.
If you already use such frameworks like Spring - feel free to use Spring JMX there.
Aslo you can built your application into OSGi framework if it suits to you (here you can also use JMX layer for that).

Whats about SIGAR jar and how it is used in the application?

i want to developed one web application where
using SIGAR jar concept to fetch the information
about the network machine just like a monitoring on network application.
but i don't know more about SIGAR
plz any body help me to understand about SIGAR
and is really the SIGAR can fetch the information
about machine in the network.
I have used Sigar API in one of my applications to gather information about Java processes running on it. Its really useful and provides accurate and useful information. It is also well documented and easy to use.
Here's the documentation link : http://www.hyperic.com/support/docs/sigar/
Have a look at the classes in the documentation to see if they provide the information you're looking for.
Its ProcessTableQueryLanguage (PTQL) is extremely useful for gathering information, especially on the basis of PIDs. Here's the PTQL guide link : http://support.hyperic.com/display/SIGAR/PTQL
And the download link : http://sourceforge.net/projects/sigar/files/

spring insight with org.codehaus.paranamer

I have a java spring GWT web application. I need to use a profiler to view why is a certain function that slow (on server)... After some searching, seems that insight is a good way... tried it and it works... what I did is create a tc server instance (developer edition) with insight and add the project to it. It works.
The problem here is that I use maven plugin "org.codehaus.paranamer", that is a plugin that I use to get function paramater names... It works post-compilation to add a special private field in the class that holds the parameters names.
This is a problem with insight since it seems that it modifies the code too and that it works on the source code not the compiled version in the target folder.
What I can do to make this work? FYI, all I need is profile the app.. not necessarily with insight....
Edit:
I ended up using visualvm... It can help with profiling the app on the cpu level and the memory level... That is the way I can use the common remote profiling mechanism jerry was talking about.
For profile of JAVA apps(including tomcat instances), I strongly recommend the TPTP(Eclipse Test & Performance Tools Platform). You can read a lot here:
http://www.eclipse.org/articles/Article-TPTP-Profiling-Tool/tptpProfilingArticle.html
Especially for TPTP working with tomcat instance:
http://www.deepakgaikwad.net/index.php/2009/02/10/tutorialprofiling-with-tptp-and-tomcat.html
Some of the information in the above article may be outdated, but main workflow is the same.
For commercial profilers, I will recommend yourkit profiler: http://www.yourkit.com/
I don't know if there is a trial edition available now, but years ago, this profile is more user friendly than TPTP.

projects using Java and MarkLogic

I am new to MarkLogic Server and hence to have some hands on experience on MarkLogic I wished to get some help from the projects already developed using Java and MarkLogic.
On doing google search, I was unable to find suitable examples and hence I am looking forward to all of you.
Please help me.
Have a look at the developer site for resources. This page includes links to a number of java-based projects:
http://developer.marklogic.com/code
You can connect to MarkLogic over HTTP or using XCC, a library that is similar to JDBC. Here's the guide for XCC:
http://developer.marklogic.com/pubs/5.0/books/xcc.pdf
and the javadocs are here:
http://developer.marklogic.com/pubs/5.0/javadoc/index.html
Finally, there's a great archive of discussion from the developer list on MarkMail:
http://marklogic.markmail.org
Kelly
Kelly's answer is good. Drilling into the dev site a little, try some of the interactive tutorials at http://developer.marklogic.com/try/ninja/index
If you are interested in developing a REST-ful interface, try Corona at http://developer.marklogic.com/try/corona/index
For more sample applications, http://developer.marklogic.com/code has a good list: http://developer.marklogic.com/code/boing-boing might be a good one to start with, and its code is on github.

Apache MINA Vysper documentation?

I plan on making an instant messaging app on Android and iOS, where you can chat to other people with the app, along with some custom features.
I’m going to use the XMPP protocol, and make a custom extension for it. I plan on making a Java application running on Amazon Web Services (AWS) so it's scalable.
After researching server options I’ve decided to use Apache Vysper.
However, I’ve never made a proper Java application before, and have never used XMPP, AWS or Vysper – so I’m rather reliant on good documentation :-)
The Apache Vysper project is very new and so the docs are a bit sparse. I was wondering if I was missing something, should I be using the general MINA docs as well? Are there other resources
elsewhere I don’t know about?
“Apache Vysper can run stand-alone or embedded into another
application.”
To be honest I’m just as lost when it comes to working out what to use to make a Java application anyway. Do you know if the AWS Java SDK has everything I need to make an application to use on AWS? And then is it a simple matter of integrating Vysper into this? Or do I need to make a Java application using something such as the Spring framework?
Thanks for taking the time to help me. If you know anything that could clarify the situation I would really appreciate it :-) --and sorry be being a bit useless, but hey, we've all got to start somewhere right ;)
First of all, as the founder of Vysper I apologize that the documentation is lacking completeness.
To answer your question(s).
Most Java applications bring their own ready-to-go start scripts with them.
Vysper is no exception. You get the pre-packaged download here:
http://mina.apache.org/vysper-project/downloads.html
Ok, before running it, you need to have Java installed, whether you're on your own machine, AWS, a server or a virtual machine anywhere else. Get it from Oracle, or use the package management of your Linux distribution. Make sure that after installing Java, you can execute "java -version" on the command line and you are all set.
Then, unpack the Vysper download, change to the bin/ directory and execute "run.sh" or "run.bat", depending on your OS.
Please note that support for Vysper - besides here on StackOverflow - is available on the MINA user mailing list here:
http://mina.apache.org/vysper-project/mailing_lists.html

Categories