nusenu/ansible-relayor

prometheus alert rule for online key expiry

appliedprivacy opened this issue · 4 comments

https://gitlab.torproject.org/tpo/core/tor/-/issues/40546 is in tor since version 0.4.8.1-alpha:
https://lists.torproject.org/pipermail/tor-announce/2023-June/000271.html

o Minor feature (MetricsPort, relay):

  • Expose time until online keys expires on the MetricsPort. Closes
    ticket 40546.

would be nice to have a default alert rule shipped to alert operators of expiring keys.

nusenu commented

Thanks for working on this.

It fails with the following error:

TASK [ansible-relayor : Ensure prometheus alert rules are in place] ************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleError: An unhandled exception occurred while templating ..... Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: unexpected char '$' at 2. String: {{$labels.id}}'s key certificate will expire in less than 21 days, on {{ .Value | humanizeTimestamp }}. unexpected char '$' at 2"}

it helps to add these around the descriptions

{% raw %}...{% endraw %}

but the {{ .Value | humanizeTimestamp }} displays:

36.7s

it the key expires in 36.7 days.

nusenu commented
nusenu commented

A final improved version is now merged into master. 26d6200