make instance label optional
This commit is contained in:
parent
527ab60069
commit
c1e1501649
1 changed files with 6 additions and 5 deletions
11
bot.py
11
bot.py
|
@ -27,8 +27,9 @@ TEMPLATE_TEXT = (
|
||||||
"{% elif labels.severity == 'warning' %}"
|
"{% elif labels.severity == 'warning' %}"
|
||||||
"ATTENTION "
|
"ATTENTION "
|
||||||
"{% endif %}"
|
"{% endif %}"
|
||||||
"{{ labels.alertname }} {{ labels.instance }}"
|
"{{ labels.alertname }}"
|
||||||
"{% if annotations.summary %}"
|
"{% if labels.instance is defined %} {{ labels.instance }}{% endif %}"
|
||||||
|
"{% if annotations.summary is defined %}"
|
||||||
"\n{{ annotations.summary }}"
|
"\n{{ annotations.summary }}"
|
||||||
"{% else %}"
|
"{% else %}"
|
||||||
"{% for key, value in annotations.items() %}"
|
"{% for key, value in annotations.items() %}"
|
||||||
|
@ -45,9 +46,9 @@ TEMPLATE_HTML = (
|
||||||
"{% elif labels.severity == 'warning' %}"
|
"{% elif labels.severity == 'warning' %}"
|
||||||
"<b><font color='orange'>ATTENTION</font></b> "
|
"<b><font color='orange'>ATTENTION</font></b> "
|
||||||
"{% endif %}"
|
"{% endif %}"
|
||||||
"<b>{{ labels.alertname }}</b> "
|
"<b>{{ labels.alertname }}</b>"
|
||||||
"{{ labels.instance }}"
|
"{% if labels.instance is defined %} {{ labels.instance }}{% endif %}"
|
||||||
"{% if annotations.summary %}"
|
"{% if annotations.summary is defined %}"
|
||||||
"<br/>"
|
"<br/>"
|
||||||
"<blockquote>{{ annotations.summary }}</blockquote>"
|
"<blockquote>{{ annotations.summary }}</blockquote>"
|
||||||
"{% else %}"
|
"{% else %}"
|
||||||
|
|
Loading…
Reference in a new issue