Prometheus Docker Setup

The Prometheus Docker image is going to install the Prometheus server. It is the one responsible for aggregating and storing time series metrics. The configuration files and the data directories are going to be stored on the local host filesystem. You can add the command line option -f to follow the logs. If you want to get a shell in the container to look at configs, check processes, etc, you can do: sudo docker exec -it /bin/sh. If you want to stop the container for some reason. Sudo docker stop prometheus. If you want to start the container. Sudo docker start prometheus. Collect Docker metrics with Prometheus. Estimated reading time: 8 minutes. Prometheus is an open-source systems monitoring and alerting toolkit. You can configure Docker as a Prometheus target. This topic shows you how to configure Docker, set up Prometheus to run as a Docker container, and monitor your Docker instance using Prometheus. Before we get started installing the Prometheus stack. Ensure you install docker-compose on your Docker host machine. Installation & Configuration. Clone the project Prometheus Monitoring Project locally to your Docker host. If you would like to change which targets should be monitored or make configuration changes edit the /prom/prometheus.yml. 1, prometheus This document is all built based on docker and k8s will be improved later 1. Introduction It is very simple to build and difficult to useThe configuration file needs to be specified for building in the prometheus container, otherwise.

Setup

Step 0: Install Docker

  • If you haven’t already, install docker and the git client of your choice.

If you aren’t familiar with these tools, check out these docker and git tutorials.

Step 1: Pull cardano-node docker container and repository

  • Open a terminal and run the following commands:

Step 2: Download Cardano network config files

  • Download the config files for the desired network you’d like to connect to (testnet, mainnet, etc). You can use the download script we provide in our GitLab repository. You will need to rename the desired set of config files as follows:
    • config.json
    • mainnet-shelley-genesis.json
    • mainnet-byron-genesis.json
    • topology.json
  • If you would like to use Prometheus to monitor your cardano-node, open config.json and make sure the following lines are present (IP address must be 0.0.0.0):
Prometheus grafana docker setup

Step 3: Run cardano-node docker container

  • The following commands will set the command parameters to run cardano-node as a relay in the docker container and then run the container:

If you get an error about docker permissions, try the fix outlined here

  • If the previous commands were successful, you should see output messages like this, which confirm you have connected to the Cardano network and are fetching the latest blocks:

Step 4: (Optional) Monitor the cardano-node using Prometheus

  • Download the Prometheus docker container using the following command:
  • Get the IP address of your running cardano-node docker container with the following command:
  • Modify prometheus.yml from the cardano-node repository and change localhost to the container’s IP address.

  • Run the Prometheus container (make sure you are in the cardano-node repository):

  • Make sure Prometheus has connected to the cardano target by going to http://localhost:9090/targets (if docker port forwarding is setup) or http://<prometheus_container_IP>:9090/targets in a browser.
  • Your cardano-node can now be monitored via http://localhost:9090/graph or http://<prometheus_container_IP>:9090/graph!

Step 5: (Optional) Setup a Grafana dashboard for Prometheus

  • Download the Grafana docker container using the following command:
  • Start up the Grafana container:
Prometheus Docker Setup
  • Open the Grafana web interface by going to localhost:3000 or <grafana_container_IP>:3000

  • Login with the default username/password: admin / admin:

Docker
  • On the home screen, select “Add your first data source” and then select “Prometheus”:
  • Enter the IP of the Prometheus docker image and then select “Save & Test” (the rest of the settings can be left to the defaults):
  • Return to the home page and select “Dashboards > Manage”:
  • Select “Import” and then paste the JSON for the example dashboard.

More usage examples

Prometheus Docker Setup Windows 10

For mode examples, see the README in our cardano-node GitLab repository.

Prometheus Install Docker-compose


Prometheus Docker Setup


Prometheus Docker Setup

If you find our tools helpful and would like to support future development, please consider buying us a beer! Contribute