Hello everyone,
I’m trying to build a dashboard to monitor the update status of my VMs as well as the last node boot time.
To do that, I use a script that retrive the last use of yum/dnf update command, convert the date in epoch format and store it in a file.
With node_exporter and the textfile collector, I expose this metric in prometheus.
In Prometheus we can see the metric like this :
| rhel_last_update_timestamp{device_type=“UNIX”, instance=“PROMETHEUS-PARIS”, job=“node_exporter”} 1757429520 |
|---|
For the boot time, I use the built-in metric of node_exporter “node_boot_time_seconds”
On Grafana I use a promql request to calculate the difference in days between the present time and the timestamp of the two metrics like below :
(time() - rhel_last_update_timestamp{device_type=“UNIX”}) / 86400
(time() - node_boot_time_seconds{device_type=“UNIX”}) / 86400
the idea is to have a table with 3 columnes, one for the name of the VM, one for the number of days since the last update and one for the number of days since the last boot and that every other VM is added in a line :
VM | Last Update | Last Boot
VM1 | Xday(s) | Xday(s)
VM2 | Xday(s) | Xday(s)
etc.
The problem is that every additional VM add 2 new columnes, one for the value of “time” which is used in the promql request to calculate the number of day and an other for the result.
I’ve tried to use transformation with Labels to fields, join by field and organize but without success.
I’m not able to force the values of each VM to fit into the two columes Last Update and Last Boot.
Can someone help me on this topic ? I don’t find anything about my problem on the web.
I use the version v12.0.2 of Grafana.
Thanks in advance for your help.
Regards,
Louis

