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 :
It can be useful to monitor cardano version on your nodes.
Prometheus Node-Exporter must be installed.
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.
-
Copy cardano-version.sh to the folder of your choice (ex: /root/scripts/cardano-version.sh)
-
Make the script executable
sudo chmod +x /root/scripts/cardano-version.sh
- 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
Now the tricky part : setting up a Grafana Panel to monitor cardano-version.
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
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 :
- First Transformation : make the metric "latest" a boolean :
- Second Transformation : merge the 3 metrics "cardano_current_X" into 1 row :
- Third Transformation : merge the 3 metrics "cardano_latest_X" into 1 row :
- Fourth Transformation : make the 2 new merged row, text format:
- Fifth Transformation : organize new rows, hide date and old rows, rename:
- Display Last Calculation and All Fields
- Display Value and Name, disable Graph Mode
- Value mapping : make a regx to transform coma into dots
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
v1.0.0 (april 2024)
- Initial release