Skip to content

A script to monitor cardano versions installed and checks if a new version is available. Output metrics to make a Grafana panel

Notifications You must be signed in to change notification settings

Kirael12/Cardano-Version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

cardano-version

This script checks if the latest cardano-node version is installed, and provides metrics to prometheus node-exporter, allowing to create a nice Grafana panel :

Capture d’écran 2024-04-15 à 15 59 38

It can be useful to monitor cardano version on your nodes.

Pre-requisites

Prometheus Node-Exporter must be installed.

How to install

Note 1 : the scripts exports 2 metric files to the directory : /var/lib/prometheus/node-exporter/. Make sure your prometheus node-exporter is installed with this path. If not, modify the script accordingly to your setup

Note 2 : the script must be used with root privilege in order to write into the prometheus node-exporter protected directory.

  1. Copy cardano-version.sh to the folder of your choice (ex: /root/scripts/cardano-version.sh)

  2. Make the script executable

sudo chmod +x /root/scripts/cardano-version.sh
  1. Create a root cronjob
sudo crontab -e

This line will run the script once a day at 00:00 :

0 0 * * * /root/scripts/cardano-version.sh

How to create the Grafana Panel

Now the tricky part : setting up a Grafana Panel to monitor cardano-version.

Step 1 : create a new panel and the 7 following queries inside

Query A Metric : cardano_current_maj

Query B Metric : cardano_current_mid

Query C Metric : cardano_current_low

Query D Metric : latest

Query E Metric : cardano_latest_maj

Query F Metric : cardano_latest_mid

Query G Metric : cardano_latest_low

Step 2 : change the panel type to "stat"

Capture d’écran 2024-04-15 à 15 27 32

Step 3 : transform the output

You need to apply 5 transformations to the queries output. To do that, go to the tab "Transform". Here are the 5 transformation types you need to apply in that specific order :

Capture d’écran 2024-04-15 à 14 06 00
  • First Transformation : make the metric "latest" a boolean :
Capture d’écran 2024-04-15 à 16 29 42
  • Second Transformation : merge the 3 metrics "cardano_current_X" into 1 row :
Capture d’écran 2024-04-15 à 13 57 55
  • Third Transformation : merge the 3 metrics "cardano_latest_X" into 1 row :
Capture d’écran 2024-04-15 à 14 10 35
  • Fourth Transformation : make the 2 new merged row, text format:
Capture d’écran 2024-04-15 à 15 07 17
  • Fifth Transformation : organize new rows, hide date and old rows, rename:
Capture d’écran 2024-04-15 à 15 08 41

Step 4 : adjust panel settings

  • Display Last Calculation and All Fields
Capture d’écran 2024-04-15 à 15 33 54
  • Display Value and Name, disable Graph Mode
Capture d’écran 2024-04-15 à 15 34 52
  • Value mapping : make a regx to transform coma into dots
Capture d’écran 2024-04-15 à 15 39 30 Capture d’écran 2024-04-15 à 15 36 35

That's it. You can adjust color scheme, text size, etc You can aslo setup an Alerting rule, when the boolean metric "Latest version installed" goes below 1

Changelog

v1.0.0 (april 2024)

  • Initial release

About

A script to monitor cardano versions installed and checks if a new version is available. Output metrics to make a Grafana panel

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages