How to enable monitoring (COS)¶
This guide shows how to integrate Charmed OpenSearch with the Canonical Observability Stack (COS) for metrics, dashboards, alerts, and logs.
For background on monitoring features, see the Monitoring explanation.
Prerequisites¶
A deployed Charmed OpenSearch cluster
A deployed
cos-litebundle in a Kubernetes environment
Offer COS interfaces¶
Switch to the COS K8s controller and offer the required interfaces.
The easiest way is to deploy COS Lite with the
offers overlay,
which creates cross-model offers named grafana-dashboards, loki-logging, and
prometheus-receive-remote-write:
juju switch <k8s-controller>:<cos-model>
curl -L https://raw.githubusercontent.com/canonical/cos-lite-bundle/main/overlays/offers-overlay.yaml -O
juju deploy cos-lite --trust --overlay ./offers-overlay.yaml
If COS Lite is already deployed without the overlay, offer the interfaces manually:
juju offer grafana:grafana-dashboard grafana-dashboards
juju offer loki:logging loki-logging
juju offer prometheus:receive-remote-write prometheus-receive-remote-write
Consume offers from the OpenSearch model¶
Switch to the OpenSearch model and consume the COS offers:
juju switch <opensearch-controller>:<opensearch-model>
juju consume <k8s-controller>:admin/<cos-model>.grafana-dashboards
juju consume <k8s-controller>:admin/<cos-model>.loki-logging
juju consume <k8s-controller>:admin/<cos-model>.prometheus-receive-remote-write
Deploy and integrate Grafana Agent¶
Deploy grafana-agent in the OpenSearch model:
juju deploy grafana-agent
Integrate it with the consumed COS offers:
juju integrate grafana-agent grafana-dashboards
juju integrate grafana-agent loki-logging
juju integrate grafana-agent prometheus-receive-remote-write
Integrate it with OpenSearch:
juju integrate grafana-agent opensearch:cos-agent
After integration, Grafana will display the Charmed OpenSearch dashboard and Loki will receive OpenSearch logs.
Large deployments¶
For multi-application clusters, integrate grafana-agent with each OpenSearch application.
The dashboard aggregates data from all connected units.
Multiple clusters¶
Multiple deployments can share the same COS instance. The dashboard provides selectors to filter by cluster.
Access the Grafana web interface¶
Retrieve the Grafana admin password:
juju run grafana/leader get-admin-password --model <k8s-controller>:<cos-model>
For detailed instructions, see Browse dashboards in the COS tutorial.
In Grafana, select the Charmed OpenSearch dashboard. You can filter by Juju model, application, unit, cluster, and node role.
Note
For exploring and visualising your indexed data (as opposed to cluster health metrics), deploy Charmed OpenSearch Dashboards.
Next steps¶
Perform load testing — benchmark the cluster under load with COS monitoring.
Monitoring explanation — background on monitoring features.