This example demonstrates publishing metrics from Geode to a monitoring system comprised of Prometheus and Grafana. For more details about how this works, see Publishing Geode Metrics to External Monitoring Systems.
-
From the
geode-examples/micrometerMetricsdirectory, run thestarttask to build the example and start a cluster. The cluster will have one locator, one server, and a single region. The locator and server will expose HTTP endpoints for Prometheus to scrape.$ ../gradlew start -
Run the example to put entries into the region and verify that the HTTP endpoints are working.
$ ../gradlew runThe previous command should produce output like the following:
The entry count for region example-region on the server is 10. A Prometheus endpoint is running at http://localhost:9914. A Prometheus endpoint is running at http://localhost:9915. -
To validate the example, navigate to the endpoints above in a browser. You should see text resembling the Prometheus exposition format.
-
Download and run Prometheus. Go to https://prometheus.io/download to download the latest release. Then, run the commands below to extract and run it:
$ tar xvfz prometheus-*.tar.gz $ cd prometheus-* $ ./prometheus --config.file=../prometheus.ymlThe provided
prometheus.ymlfile configures Prometheus to scrape Geode's Prometheus endpoints at two-second intervals. -
In a browser, navigate to http://localhost:9090/targets. This page shows Geode's Prometheus endpoints, and their state should be "UP" as shown below:
-
Navigate to http://localhost:9090/graph?g0.range_input=30m&g0.expr=geode_cache_entries&g0.tab=0. This page shows the result of the PromQL query
geode_cache_entriesover the last 30 minutes. It should show a value of "10" as the entry count for regionexample-regionon the server: -
Download and run Grafana. Add a new Prometheus data source with the address of the Prometheus server from the previous step. For detailed instructions, see Grafana's Getting Started Guide.
-
Once you have added the Prometheus data source, you can import this dashboard from Grafana.com.
To import, select the "plus" icon on the left-hand side and choose the "Import" option. Use the ID from the link above for the dashboard and specify the Prometheus data source you created in the last step.
-
Shut down the cluster.
$ cd .. $ ../gradlew stop

