Deep dive on Corda node monitoring with Prometheus and Grafana
By: Ashutosh Meher
Tags: Grafana, Monitoring, Prometheus, Blockchain, Corda

Monitoring is an important part of any enterprise application. It helps provide great insights into what's happening behind the scene in your application and gives an idea of the overall health of the application.

Corda is a complex system with multiple moving parts, so it is utterly important to monitor Corda nodes to ensure that they are behaving as expected. To help with that, Corda nodes can be configured to export various metrics using the JMX infrastructure.

Continuing on Neal’s awesome blog, on setting up monitoring on Corda with Prometheus, Grafana, and elk stack, let’s go a little deeper from the perspective of setting up a Grafana dashboard for monitoring different metrics for a single Corda node.

New to Corda? A great way to start with Corda is to take a look at one of our online bootcamp webinars. The recording for one of them is available here: https://www.youtube.com/watch?v=tVE1rKbFA3g You may also consider joining us for one of our in-person or live virtual bootcamps. Keep an eye on the link below to know what events are coming up: https://www.corda.net/blockchain-bootcamp/ You may also want to take a look at the free official Corda training available here: https://training.corda.net/

Getting ready with the setup

First thing first, we need to do some setup and use the right tools for monitoring. In this post, we are going to use Prometheus to read the node metrics and Grafana for visualization. We will set up everything (Corda, Prometheus, and Grafana) using Docker and Docker-Compose.

I explained how to setup Corda on Docker in my previous post: https://www.corda.net/blog/containerizing-corda-with-corda-docker-image-and-docker-compose/.

I would refer you to Neal’s blog for detailed setup instructions. However, I am just going to suggest a few changes to the setup since Neal’s blog looks at monitoring from an entire Corda network perspective, while in this blog we are focusing on monitoring a single node.

Corda Enterprise Node Setup

The setup instruction in Neal’s blog uses the Corda Open Source node. If you want to setup Corda enterprise node for monitoring you could:

Update the Corda Open Source Docker image to Corda Enterprise Docker image in the generated docker-compose.yml file. Corda Enterprise Docker Image (4.5) can be found here. You could replace the corda.jar file in the docker image with enterprise Corda jar, by mounting it in the following location /opt/corda/bin/corda.jar .

Update Prometheus config

We are just monitoring a single node, we do not need multiple targets in Prometheus. We need to remove multiple targets from the Prometheus configuration file, generated after following Neal’s blog.

You could also setup a similar monitoring dashboard as suggested in this blog for monitoring multiple nodes but you would need to do a little update to the metric queries used in the dashboard so that the nodename is included as a parameter in the queries. Having a single target in prometheus helps us to get rid of that.

Just replace prometheus.yml found in the path ./mynetwork/prometheus/prometheus.yml with the content below: