Kes expiry / cert regenerate - alert

(sorry if this has been answered before, tried searching but didn’t find anything)

i just got my pool up and working and want to setup an alert showing days to expiration, for KES key, so i can regenerate a certificate. i would like to setup an email alert if possible…which is easy (the email part)…but i am having difficulty calculating days to expire.

i would prefer shell commands…that way i would understand it better. i know using grafana/prometheus can do this which i plan to setup in the near future.

any help would be appreciated.

thanks!

1 Like

Hi @chimcentral,

You can use the commands below to calculate KES days remaining. Just copy and paste all the lines at once.

If you’re not using the $NODE_HOME variable, replace it with the path to the folder containing the file mainnet-shelley-genesis.json

kes_remaining=$(curl -s localhost:12798/metrics | grep cardano_node_metrics_remainingKESPeriods_int | awk '{print $2}') ;\
slotsPerKESPeriod=$(cat $NODE_HOME/mainnet-shelley-genesis.json | jq -r '.slotsPerKESPeriod') ;\
echo ;\
echo ● Days left: $((${kes_remaining} * ${slotsPerKESPeriod} / 86400))

You may also find my guide to renew KES keys useful: Maintenance Guide for Cardano Stake Pool

Hope that helps :grinning_face_with_smiling_eyes:

awesome! thanks. bookmarked your site for future reference. :slight_smile: