Monitoring with Grafana quick start
Follow these steps to set up monitoring with Grafana for a Vespa instance. For more on monitoring, see monitoring. This guide builds on the Quick Start by adding three more Docker containers and connecting these in the Docker monitoring network:
Run the Quick Start:
Complete steps 1-6 (or 1-9), but skip step 10 removal.
Create a network and add the vespa container to it:
$ cd sample-apps/album-recommendation-monitoring $ docker network create --driver bridge monitoring $ docker network connect monitoring vespa
This creates the monitoring network and attaches the vespa container to it. Find details in docker-compose.yml.
Launch Prometheus and Grafana:
$ docker-compose up --detach prometheus $ docker-compose up --detach grafana
This launches Prometheus and Grafana with configurations defined in docker-compose.yml. Prometheus is a time-series database, which holds a series of values associated with a timestamp. Grafana is a visualisation tool that can be used to easily make representations of important metrics surrounding Vespa. The configuration for both of these include some default values and connects the two of them together.
Check that Grafana and Prometheus are running:
Open http://localhost:3000/ and find the Grafana login screen - log in with admin/admin (skip changing password). From the list on the left, click Manage under Dashboards (the symbol with 4 blocks), then click the Vespa Detailed Monitoring Dashboard. The dashboard displays detailed Vespa metrics. (empty for now).
Now open Prometheus at http://localhost:9090/. One can easily find what data Prometheus has, the input box auto-completes, e.g. enter feed_operations_rate and click Execute. Also explore the Status dropdown.
Start the Random Data Feeder:
$ docker-compose up --detach random-data-feeder
This builds and starts a Random Data Feeder - it generates random sets of data and puts them into the Vespa instance. Also, it repeatedly runs queries, for Grafana visualisation. Compiling the Random Data Feeder takes a few minutes.
Check the updated Grafana metrics:
Graph will now show up in Grafana and Prometheus - it might take a minute or two. The Grafana dashboard is fully customisable. Change the default modes of Grafana and Prometheus by editing the configuration files in album-recommendation-monitoring.
Remove containers and network:
$ docker rm -f vespa; docker-compose down # to remove images as well, add --rmi all