Centralized collect server. Functionality to add and remove monitiring servers on the fly.

182 views
Skip to first unread message

max.se...@gmail.com

unread,
Dec 12, 2016, 3:46:32 AM12/12/16
to javamelody
Hi,
I have a centralized collect server, and bunch of monitoring servers in aws ec2 container service. The thing is that a container service can dynamically start and stop monitoring instances. So I need API which allows me to dynamically add and remove monitoring nodes.

Do you have plans to implement that?

If not, I can implement it myself. But I need some guidance.

Thanks.
Regards Max.

evernat

unread,
Dec 12, 2016, 1:33:50 PM12/12/16
to javamelody, max.se...@gmail.com
Hi Max,

There is currently no official api to do that, but I think that it would be good to have one, for the aws use case for example.
For guidance:
As you can see in the collector servlet, the collector server currently expects a http post request with parameters "appName" and "appUrls":
https://github.com/javamelody/javamelody/blob/master/javamelody-core/src/main/java/net/bull/javamelody/CollectorServlet.java#L108

appName should contain a name of the app, for example "HelloWorld".
And appUrls should contain the url(s) of webapp(s) monitored by javamelody, for example "http://server1/helloworld" or "http://server1/helloworld,http://server2/helloworld" (note the comma for 2 urls).
The response contains a OK message if success.

To remove an application, the collector server expects a http get request with parameters like this "?application=HelloWorld&action=remove_application".

So javamelody-core in the monitored webapp can notify the collector servers that it wants to be monitored, based on some javamelody configuration giving the collector server url.
It should probably be somewhere in the FilterContext class during initialization and shutdown:
https://github.com/javamelody/javamelody/blob/master/javamelody-core/src/main/java/net/bull/javamelody/FilterContext.java#L60

(Note: I suppose that we don't want to send an UDP broadcast to notify the collector server.)

bye,
Emeric

max.se...@gmail.com

unread,
Dec 13, 2016, 4:29:09 PM12/13/16
to javamelody, max.se...@gmail.com
Hi Emeric
I'll fork the project, then I'll try to implement this feature. And finally I'll create a pull request.
I have another job, so I will code only on weekends. Anyway I'll try to do my best ).

Shiv Chandra Pathak

unread,
Jul 15, 2022, 9:36:58 AM7/15/22
to javamelody
It's possible now to do.

evernat

unread,
Jul 15, 2022, 9:42:40 AM7/15/22
to javamelody
Hi Shiv Chandra Pathak,

Yes. I suppose that you are speaking of

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