# Configure Prometheus to monitor EMQX cluster

# Task target

  • How to monitor EMQX cluster through Prometheus.

# Deploy Prometheus

Prometheus deployment documentation can refer to: Prometheus (opens new window)

# Deploy EMQX cluster

Save the above content as: emqx.yaml and deploy the EMQX cluster

The output is similar to:

emqx.apps.emqx.io/emqx created
1
  • Check whether the EMQX cluster is ready

# Configure Prometheus Monitor

Save the above content as: monitor.yaml and execute the following command:

kubectl apply -f monitor.yaml
1

Use basicAuth to provide Monitor with password and account information for accessing EMQX interface

apiVersion: v1
kind: Secret
metadata:
   name: emqx-basic-auth
   namespace: default
type: kubernetes.io/basic-auth
stringData:
   username: admin
   password: public
1
2
3
4
5
6
7
8
9

Save the above content as: secret.yaml and create Secret

kubectl apply -f secret.yaml
1

# Visit Prometheus to view the indicators of EMQX cluster

Open the Prometheus interface, switch to the Graph page, and enter emqx to display as shown in the following figure:

Switch to the Status → Targets page, the following figure is displayed, and you can see all monitored EMQX Pod information in the cluster: