Add disconnected application instances

51 views
Skip to first unread message

Holger Protzek

unread,
Nov 19, 2012, 7:55:46 AM11/19/12
to javam...@googlegroups.com
Hi,

I would like to add live and standby instances of one application to the collector server. But unfortunately if I try to add a application with disconnected instances, I am not able to add this application.

Is there a way to allow also disconnected instances in an application?

Regrads
Holger

evernat

unread,
Nov 19, 2012, 9:55:06 AM11/19/12
to javam...@googlegroups.com
Hi Holger,

Yes, it's possible.
You can edit directly the applications.properties files in the storage directory (probably /tmp/javamelody/applications.properties in your case).
In this file, you can add an application on a new line after the others, and then restart the collector server.

bye,
Emeric

bookit

unread,
Nov 19, 2012, 11:53:33 AM11/19/12
to javam...@googlegroups.com
Hi Emeric,

I tried this, but then if I click on the app link, a error 500 pops up with following stack trace:

java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:529)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:158)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:395)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:234)
        at sun.net.www.http.HttpClient.New(HttpClient.java:307)
        at sun.net.www.http.HttpClient.New(HttpClient.java:324)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
        at net.bull.javamelody.LabradorRetriever.call(LabradorRetriever.java:151)
        at net.bull.javamelody.RemoteCollector.collectForUrl(RemoteCollector.java:325)
        at net.bull.javamelody.RemoteCollector.collectDataWithUrls(RemoteCollector.java:82)
        at net.bull.javamelody.RemoteCollector.collectData(RemoteCollector.java:75)
        at net.bull.javamelody.CollectorServer.collectForApplication(CollectorServer.java:152)
        at net.bull.javamelody.CollectorServer.collectForApplication(CollectorServer.java:126)
        at net.bull.javamelody.CollectorServer.collectWithoutErrors(CollectorServer.java:102)
        at net.bull.javamelody.CollectorServer$1.run(CollectorServer.java:68)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)

bookit

unread,
Nov 21, 2012, 5:05:39 AM11/21/12
to javam...@googlegroups.com
I would like to patch this, what is the best approach? Catch the IOException in LabradorRetriever and only throw a exception when all instances of the application are offline?

Vernat Emeric

unread,
Nov 21, 2012, 6:02:50 PM11/21/12
to javam...@googlegroups.com
Hi,

Ah yes. I did not understood well.
In fact, you want to monitor a single application with multiple server instances, and to display data even if some monitored instances of the application are offline in general.
Of course, it would simply work if you add monitoring only for the instances which are online in general, and ignore the others.

Anyway, if you want to change that for offline instances, you can always catch IOException in the methods "call" and "copyTo" of LabradorRetriever.
So if some or all instances of the application are offline, all the ioexceptions will be ignored and the known data will be displayed.

http://code.google.com/p/javamelody/source/browse/trunk/javamelody-core/src/main/java/net/bull/javamelody/LabradorRetriever.java#138

bye,
Emeric
Reply all
Reply to author
Forward
0 new messages