In the previous step, we have explored how to send logs to a centralized server so that activity across multiple services can be viewed on the same screen. In this step, we are going to setup metrics in the pet store to send it to InfluxDB and then subsequently viewed the dashboard from Chronograf UI.
In order to start InfluxDB, Chronograf and Kapacitor, a docker-compose file will be used from light-docker repository.
Now let’s start all services defined in docker-compose-metrics.yml
docker-compose -f docker-compose-metrics.yml up
First let’s make sure that InfluxDB and Chronograf can be accessed.
Make sure Chronograf admin page is shown up and connect to metrics database.
Once both Influxdb and Chronograf are up and running, let’s stop the swagger petstore
container by issuing “docker ps” on another terminal to find out the container_id of
petstore. Note: there are several docker containers running so double check you have
picked the right container_id.
Now run the following command to stop the example-petstore
docker stop [container_id of petstore]
In the next step, we are going to start the same container with externalized metrics
config so that the server can connect to the Influxdb container to report the metrics.
To make is simple, we are going to use docker-compose from light-config-test
There is a folder at ~/networknt/light-config-test/light-example-4j/rest/swagger/petstore/metrics
with security.yml and metrics.yml