---
title: Can I monitor WSO2 running in Docker or Kubernetes? | Nodinite
description: "Can Nodinite monitor WSO2 in Docker or Kubernetes? Yes. Publish the JVM's JMX remote port from the container, and the JMX Monitoring Agent connects to it like any other JVM."
---

# 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.** <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> monitors WSO2 with the [JMX Monitoring Agent][], so a WSO2 container is just another JVM with a JMX remote port to publish.

## <i class="fab fa-docker" aria-hidden="true"></i> Docker

1. 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.port` to the same value as `com.sun.management.jmxremote.port`.
1. Set `-Djava.rmi.server.hostname` to 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.
1. Publish the port, for example `-p 5002:5002`.
1. Add the Docker host and the published port as an Application Host in the [JMX Monitoring Agent configuration][JMX Configuration].

The JMX agent's [Docker Container Monitoring][] guide has the details and common errors.

## <i class="fal fa-dharmachakra" aria-hidden="true"></i> Kubernetes

Expose the same JMX port through a Service that the gateway can reach, for example a NodePort:

```yaml
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.

## <i class="fal fa-shield-check" aria-hidden="true"></i> Firewall

The ports between the [Monitoring Service][], the agent, the gateway, and the WSO2 JVM are in the [JMX firewall section][JMX Firewall].

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

* <i class="fal fa-book" aria-hidden="true"></i> [WSO2 monitoring overview][Overview]  
* <i class="fab fa-docker" aria-hidden="true"></i> [Docker Container Monitoring][]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-list" aria-hidden="true"></i> [Troubleshooting Overview][]  
* <i class="fal fa-code-compare" aria-hidden="true"></i> [FAQ - WSO2 EI vs Micro Integrator][]  
* <i class="fab fa-java" aria-hidden="true"></i> [JMX Monitoring Agent][]  

[Docker Container Monitoring]:https://docs.nodinite.com/logging-and-monitoring/jmx/troubleshooting/docker-container-monitoring/
[Enable JMX Remote Monitoring]:https://docs.nodinite.com/logging-and-monitoring/jmx/troubleshooting/enable-jmx-remote-monitoring/
[FAQ - WSO2 EI vs Micro Integrator]:https://docs.nodinite.com/logging-and-monitoring/wso2-enterprise-integrator-monitoring/troubleshooting/faq-wso2-ei-vs-micro-integrator/
[JMX Configuration]:https://docs.nodinite.com/logging-and-monitoring/jmx/getting-started/configuration/
[JMX Firewall]:https://docs.nodinite.com/logging-and-monitoring/jmx/getting-started/prerequisites/#fa-shield-check-firewall
[JMX Monitoring Agent]:https://docs.nodinite.com/logging-and-monitoring/jmx/overview/
[Monitoring Service]:https://docs.nodinite.com/core-services/monitoring-service/overview/
[Overview]:https://docs.nodinite.com/logging-and-monitoring/wso2-enterprise-integrator-monitoring/overview/
[Troubleshooting Overview]:https://docs.nodinite.com/logging-and-monitoring/wso2-enterprise-integrator-monitoring/troubleshooting/overview/