How to access mulesoft application metrics using JMX - spring-boot

I want to expose some custom application metrics like how many records processed to JMX in mulesoft flow.
My application is spring boot application.
Any idea on how to achieve this?
Thanks & Regards,
Vikas Gite

Using the Default JMX Support Agent
You can configure several JMX agents simultaneously using the element. When set, this element registers the following agents:
List item
JMX agent
RMI registry agent (if necessary) on rmi://localhost:1099
Remote JMX access on service:jmx:rmi:///jndi/rmi://localhost:1099/server
(Optional) Log4J JMX agent, which exposes the configuration of the Log4J instance used by Mule for JMX management
JMX notification agent used to receive server notifications using JMX notifications
(Optional) MX4J adapter, which provides web-based JMX management, statistics, and configuration viewing of a Mule instance
Also you can try below which can directly be configured under the MULE's wrapper.conf (under $MULE_HOME/conf/wrapper.conf) to enable JMX connectivity so that we can use tools like JMC (Java Mission Control), VisualVM, JConsole to pull the JMX attribute values from the Mule Server and the deployed applications -
wrapper.java.additional.<n>=-Dcom.sun.management.jmxremote
wrapper.java.additional.<n>=-Dcom.sun.management.jmxremote.port=9999
wrapper.java.additional.<n>=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.<n>=-Dcom.sun.management.jmxremote.local.only=false
wrapper.java.additional.<n>=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional.<n>=-Djava.rmi.server.hostname=<localhost ip>
wrapper.java.additional.<n>=-Djava.rmi.activation.port=9998
Here should be removed with the next incremental value of the java wrapper value and will be the ip of the the Mule runtime host/server
I hope you are looking for this, if not then please post further queries or clarity so that i will help you out.

Related

Access specific JMX metric information on JConsole for a Spring Boot Application

I have a Spring Boot application packaged as a WAR and deployed on a Tomcat 9 server.
It's been configured to expose the following metrics through JMX:
spring.jmx.default-domain: my-app
management.endpoints.jmx.exposure.include: health,info,metrics
I can connect to Tomcat through JConsole and see the my-app MBean that offers those 3 endpoints:
Selecting Metrics -> Operations - listNames I can get the whole list of metrics exposed, invoking the listNames method:
Now I would like to see a specific metric (e.g. jvm.memory.used), going to metrics -> Operations -> metrics:
However the metric(requiredMetricName, tag) method is disabled.
How can I get the value of a specific metric from the mbean in JConsole?
The reason it's disabled is because JConsole won't allow input of parameters of complex types. See https://stackoverflow.com/a/12025340/62667
But if you use an alternative JMX interface (e.g. add Hawtio to your application) then you could use that to invoke the operations.

Spring Cloud Data Flow Remote RabbitMQ Server Config

I am new to SCDF and am trying to get started with a RabbitMQ transport layer and SCDF version 1.2.2. I have setup RabbitMQ in a separate VM and have the SCDF local server and SCDF shell jar in one VM. Can someone suggest how I can specify the server details of my RabbitMQ (which is in a different host in the same network) for SCDF to use as a transport.
For reasons outside my control I need to use the MQ setup in a different machine. Please advise.
SCDF doesn't require RabbitMQ and I think you are trying to use RabbitMQ as the binder for your Spring Cloud Stream applications that are orchestrated via SCDF.
You would need to configure the properties mentioned here
You can find more information here on how to specify these properties at SCDF.

How to make an application like JConsole?

I want to make an application like JConsole. Is it possible? If yes, what are the changes need to done at JVM level? I am planning to use Spring-Boot. As per my knowledge, JMX is enabled by default. Do I need to configure anything extra in my Spring-Boot app in order to access the JMXBeans which are exposed by default?
Here I'm not trying to expose any MBean instead I'm trying to access those beans which are already exposed by JVM. How to achieve it?
JConsole is a JMX compliant monitoring and management application. The architecture is quite simple. It's a client-server architecture. Where the client is the Remote application (Example JConsole or the one that you want to build) and the server is the JMX Agent. In your case, you want to build your own client which is possible.
I want to make an application like JConsole. Is it possible?
Yes, it is possible.
If yes, what are the changes need to done at JVM level?
What do you mean by changes at JVM level? You are simply creating a client application that connects to the server (JMX Agent) using a certain protocol. Remote Method Invocation (RMI) is the protocol used by JConsole for the connection to the JMX Agent. If you want to use RMI for communication, you don't have to do anything on the server side. But if you want to use some other protocol for communication, you can define your own Protocol adapter.
As per my knowledge, JMX is enabled by default.
As of Java SE 6 it is. But you can only monitor it locally. For connection from a remote machine, you need to define an RMI port to start listening for incoming connections.
Here I'm not trying to expose any MBean instead I'm trying to access those beans which are already exposed by JVM. How to achieve it?
Please check out the example from this link - Mimicking Out-of-the-Box Management Using the JMX Remote API. It shows you how to create a simple client application that connects to a remote JMX agent and access the MBeans. This should guide you in the right direction.

Spring integration monitor multiple jvm using same connection

I can monitor individual SPRING INTEGRATION applications via visualvm changing the command line parameters when starting the JVM (-Dcom.sun.....)
My application has components in multiple jvm's, each of which i can name.
I would like my operational console to connect per server to one JMX service via one port. Then as I add JVM's(services) they are discoverable by the operational console(lets assume its visualvm) by name.
Any help is greatly appreciated
Take a look at Jolokia I believe a single client can connect to multiple agents (you install a jolokia agent on each JVM).

Using JMX client to connect to the WebSphere JVM

How I can connect to WebSphere JVM through JMX client? Can JMX client be used to connect to the WebSphere JVM to change logging settings?
Basically you have to use some Websphere-specific jars in order to connect to WAS using a JMX Client.
You may follow this article in order to configure this.

Resources