MongoDB

Channel Revision Published Runs on
6/stable 199 04 Oct 2024
Ubuntu 22.04
6/candidate 199 04 Oct 2024
Ubuntu 22.04
6/beta 199 04 Oct 2024
Ubuntu 22.04
6/edge 204 12 Nov 2024
Ubuntu 22.04
5/stable 117 20 Apr 2023
Ubuntu 22.04
5/candidate 117 20 Apr 2023
Ubuntu 22.04
5/edge 139 21 Nov 2023
Ubuntu 22.04 Ubuntu 20.04
5/edge 109 06 Mar 2023
Ubuntu 22.04 Ubuntu 20.04
3.6/stable 100 28 Apr 2023
Ubuntu 20.04 Ubuntu 18.04
3.6/candidate 100 13 Apr 2023
Ubuntu 20.04 Ubuntu 18.04
3.6/edge 100 03 Feb 2023
Ubuntu 20.04 Ubuntu 18.04
juju deploy mongodb --channel 6/beta
Show information

Platform:

Ubuntu
22.04 20.04 18.04

How to view metrics

You can view Charmed MongoDB metrics in two ways:

Query the metric endpoint

Charmed MongoDB comes with MongoDB Exporter and provides replication and cluster metrics. The metrics can be queried by accessing the http://<unit-ip>:9216/metrics endpoint.

To quickly view them you can do the following:

1. Identify the unit you would like to query by entering juju status. Choose a unit to gather metrics from and copy its “Public Address” 2. curl the metrics endpoint for your unit of interest with curl http://<unit-ip>:9216/metrics. This should show a long set of metrics.

Access metrics with Grafana

Charmed MongoDB provides integration with the Canonical Observability Stack (COS) - which allows you to view the metrics in a GUI. The Observability stack integrates with VM charm deployments via the grafana-agent sidecar charm. This sidecar charm integrates with all the relevant relations in a COS deployment.

To view the GUI:

1. Deploy the cos-lite bundle in a Kubernetes environment. This can be done by following the deployment tutorial. Wait for the cos-lite bundle to become active and idle with juju status.

2. Switch back to your model which hosts Charmed MongoDB, deploy the grafana-agent sidecar charm, and relate it to Charmed MongoDB:

juju switch <VM-controller>
juju deploy  grafana-agent
juju integrate grafana-agent mongodb

Watch juju status and wait for the model to become idle, grafana-agent should eventually go into the error state since it requires relations from the COS bundle.

3. Consume offers from the COS bundle and relate COS bundle to the grafana-agent:

juju consume <k8s-controller-name>:admin/cos.prometheus-scrape
juju consume <k8s-controller-name>:admin/cos.alertmanager-karma-dashboard
juju consume <k8s-controller-name>:admin/cos.grafana-dashboards
juju consume <k8s-controller-name>:admin/cos.loki-logging
juju consume <k8s-controller-name>:admin/cos.prometheus-receive-remote-write

juju integrate grafana-agent prometheus-receive-remote-write
juju integrate grafana-agent loki-logging
juju integrate grafana-agent grafana-dashboards

4. Wait for grafana-agent to show active and idle status in juju status

5. To view the dashboard we need to find the URL of grafana along with the password for the dashboard. Switch to the k8s model hosting the COS-lite bundle and show all applications:

juju switch <K8s-controller>
juju status

Under the report of juju status, the IP address of the grafana GUI should be listed as the “Public Address” for the application grafana. Copy this address and navigate to it in your browser. In your browser you should see a login. Use the username admin, to retrieve the password go back to your terminal and run the action: juju run grafana/0 get-admin-password - use this password to access the grafana Dashboard.


Help improve this document in the forum (guidelines). Last updated 18 hours ago.