I have a monitor installed into with my application, JavaMelody. The application is running on 7 different instances in AWS in an auto scaling group behind a load balancer in AWS. When I go to myapp.com/monitoring, I get statistics from JavaMelody. However, it is only giving me specifics for the node that the load balancer happens to direct me. Is there a way I can specify which node I am browsing to in a web browser?
-
Sounds like you have monitoring agent, `JavaMelody` running on the machines right, I guess you have to use metadata (like IP, instance ID) to monitor the instance one by one, that is what we did with Prometheus. What does exactly `instance` mean, `EC2`? What is that load balancer, `ELB` or your own web server? – chenrui Jun 28 '17 at 18:50
-
I think only way to access the instance you want is by using instance public IP directly (assuming you have proper security group configuration to access the instance). – kosa Jun 28 '17 at 18:51
-
Yes, an EC2 instance, sorry about the lack of clarity – Jay Jun 28 '17 at 18:56
3 Answers
The Load Balancer will send you to an Amazon EC2 instance based upon a least open connections algorithm.
It is not possible to specify which instance you wish to sent to.
You will need to connect specifically to each instance, or have the instances push their data to some central store.

- 241,921
- 22
- 380
- 470
You should use CloudWatch Custom Metrics to write data from your instances and their monitoring agent, and then use CloudWatch Dimensions to aggregate this data for the relevant instances

- 1,646
- 12
- 28
I have not tried this myself but you may create several listeners in your load balancer with a different listening port and a different target server for each listener. So the monitoring reports of the instance #1 may be available at http://...:81/monitoring etc for #2, #n
Otherwise, I think that there are other solutions such as:
- host or path based load balancing rules (path based rules would need to add net.bull.javamelody.ReportServlet in your webapp to listen on different paths)
- use a javamelody collector server to collect the data in a separate server and to have monitoring reports for each instance or aggregated for all instances
- send some of the javamelody metrics to AWS CloudWatch or to Graphite

- 1,713
- 13
- 18