Well, I'm back sooner than I had hoped.
I've upgraded my alertmanager (and prometheus) to their latest version to get the template option in amtool. Now, I'm trying to get it to work...
I am able to query for a specific alert:
```
```
I can view it as json, which I suspect I'll need, in order to find out what fields I can use in the template:
```
/alertmanager $ amtool -o json --alertmanager.url=
http://127.0.0.1:9093 alert query alertname="high_temperature" instance="
10.19.53.4:9100" chip="platform_coretemp_0" sensor="temp2"
[{"annotations":{"description":"Host temperature is 100C. Reported by instance
10.19.53.4:9100 of job syslog_server.","summary":"Server temperature over 75C"},"endsAt":"2021-11-09T12:53:11.340Z","fingerprint":"4e8fa68805104681","receivers":[{"name":"raptor-ssms"}],"startsAt":"2021-11-09T12:45:26.340Z","status":{"inhibitedBy":[],"silencedBy":[],"state":"active"},"updatedAt":"2021-11-09T12:49:11.371Z","generatorURL":"
http://6260171c95c4:9090/graph?g0.expr=node_hwmon_temp_celsius%7Bsend_alerts%3D%22True%22%7D+%3E+75\u0026g0.tab=1","labels":{"alertname":"high_temperature","chip":"platform_coretemp_0","instance":"
10.19.53.4:9100","job":"syslog_server","monitor":"docker-host-alpha","platform":"syslog","production":"True","send_alerts":"True","sensor":"temp2","severity":"warning"}}]
```
Now, simple strings work when rendering a template, and also things like "if":
```
/alertmanager $ amtool --alertmanager.url=
http://127.0.0.1:9093 template render --template.glob=/etc/alertmanager/config/*.tmpl --template.text='This is a test'
This is a test
/alertmanager $ amtool --alertmanager.url=
http://127.0.0.1:9093 template render --template.glob=/etc/alertmanager/config/*.tmpl --template.text='This is a test {{if gt 2 1}} True {{else}} False {{end}}'
This is a test True
```
But how am I supposed to pipe a specific (active) alert through the template rendering? I tried the example, but I'm not sure where I would get the template name from (it's not the file name, I tried that too):
```
/alertmanager $ amtool --alertmanager.url=
http://127.0.0.1:9093 template render --template.glob=/etc/alertmanager/config/*.tmpl --template.text='{{ template "slack.default.markdown.v1" . }}'
amtool: error: template: :1:12: executing "" at <{{template "slack.default.markdown.v1" .}}>: template "slack.default.markdown.v1" not defined
/alertmanager $ amtool --alertmanager.url=
http://127.0.0.1:9093 template render --template.glob=/etc/alertmanager/config/template-email-slack.tmpl --template.text='{{ template "template-email-slack" . }}'
amtool: error: template: :1:12: executing "" at <{{template "template-email-slack" .}}>: template "template-email-slack" not defined
```
Thanks for the pointers!