Simple system metrics collection and monitoring using InfuxDB, Telegraf, and Grafana running in Docker using Docker Compose.
- Docker
- Docker Compose
docker-compose up -d
This will create a network called pi-metrics_default
and start 3 containers running on that network.
Run docker ps
to check the container statuses.
Run docker-compose logs
to check container logs.
Grafana might need permission to write to the mounted directory for it's data.
Run sudo chown -R 472:472 /tmp/grafana/
where /tmp/grafana
is the default directory where data is stored on the host machine.
Once the container processes have started, you can access the Grafana dashboard at http://localhost:3000 .
Default Grafana credentials are admin/admin
.
On first run, go to Configuration > Data Sources
and add an InfluxDB datasource and edit the following details:
- url:
http://metricsdb:8086
- database:
telegraf
Save & Test
the connection. Once successful, you can go to Dashboards > Manage
and create a new Dashboard. Select your InfluxDB datasouce and pick some default system metrics being reported like disk
or cpu
to visualize.
Telegraf is also configured to ping the 8.8.8.8
DNS server as well as some common websites like Google and Amazon to poll and record network latencies.
The telegraf.conf
file can be edited to report on many more metrics. You can check the telegraf docs for more information or check the full example conf file.
This was created by roughly following a tutorial here with some enhancements.
The commands used in the original tutorial (which was written specifically to be run on a Raspberry Pi) can be found in the setup.sh
script.