The grafana-cloud-integrator charm can be configured to forward telemetry to not only Grafana cloud, but also to any Prometheus- (or Loki-) compatible endpoint. This is generally useful when running the stack on-premise isn’t desired, or when an additional off-premise storage is used for redundancy.
MetricBeat is an Elasticsearch component that collects and ships metrics; it can be used as an intermediary to ship metrics to an Elastic cloud.
Using the grafana-cloud-integrator charm, we can have grafana-agent send metrics to MetricBeat with a simple setup!
Deployment scenario and setup configuration
You’ll need to have the grafana-agent machine charm up and running, with a subordinate relation to the charm you’re observing. If you don’t know how, you can find more information on the linked charm’s documentation.
When setting up MetricBeat, you should configure it to expose a Prometheus’ remote-write endpoint; as shown in the docs, this is achieved by enabling the prometheus
module and modifying it to enable the remote write endpoint (e.g, http://10.0.1.123:9201/write
).
Once that is set up, you’ll simply need to deploy grafana-cloud-integrator, configure the aforementioned endpoint in the charm, and relate it to grafana-agent:
juju deploy grafana-cloud-integrator
juju config grafana-cloud-integrator prometheus-url=http://10.0.1.123:9201/write
juju relate grafana-agent:grafana-cloud-config grafana-cloud-integrator
The metrics will then start to seamlessly appear in your Elastic cloud!