Can I monitor WSO2 running in Docker or Kubernetes?
Yes, when the JMX remote port of the WSO2 JVM is reachable from the Spring Boot JMX Gateway. Nodinite monitors WSO2 with the JMX Monitoring Agent, so a WSO2 container is just another JVM with a JMX remote port to publish.
Docker
- Add the JMX remote options to the WSO2 container's JVM options (Enable JMX Remote Monitoring). Use one fixed port, and set
com.sun.management.jmxremote.rmi.portto the same value ascom.sun.management.jmxremote.port. - Set
-Djava.rmi.server.hostnameto the address the gateway uses, such as the Docker host name. RMI returns this address to the client, so a container-internal address breaks the connection. - Publish the port, for example
-p 5002:5002. - Add the Docker host and the published port as an Application Host in the JMX Monitoring Agent configuration.
The JMX agent's Docker Container Monitoring guide has the details and common errors.
Kubernetes
Expose the same JMX port through a Service that the gateway can reach, for example a NodePort:
apiVersion: v1
kind: Service
metadata:
name: wso2-mi-jmx
spec:
type: NodePort
ports:
- port: 5002
targetPort: 5002
nodePort: 30502
selector:
app: wso2-mi
With a NodePort, the published port differs from the container port, and RMI needs both to match. Either use the same number for the JMX port and the node port, or give each pod its own Service and port. Each pod you want to watch is its own Application Host; a Service that load-balances across several pods returns values from whichever pod answers.
Firewall
The ports between the Monitoring Service, the agent, the gateway, and the WSO2 JVM are in the JMX firewall section.