webhooks/zabbix: Improve message formatting and punctuation.

This commit is contained in:
Eeshan Garg
2019-04-16 21:23:42 -02:30
committed by Tim Abbott
parent 73e7d97a35
commit 0a0df3bc58
2 changed files with 6 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ class ZabbixHookTests(WebhookTestCase):
Tests if zabbix alert is handled correctly
"""
expected_topic = u"www.example.com"
expected_message = u"PROBLEM (Average) alert on [www.example.com](https://zabbix.example.com/tr_events.php?triggerid=14032&eventid=10528).\nZabbix agent on www.example.com is unreachable for 5 minutes\nAgent ping is Up (1)"
expected_message = u"PROBLEM (Average) alert on [www.example.com](https://zabbix.example.com/tr_events.php?triggerid=14032&eventid=10528):\n* Zabbix agent on www.example.com is unreachable for 5 minutes\n* Agent ping is Up (1)"
self.send_and_test_stream_message('zabbix_alert', expected_topic, expected_message)
def test_zabbix_invalid_payload_with_missing_data(self) -> None:

View File

@@ -20,7 +20,11 @@ need further help!
"""
ZABBIX_TOPIC_TEMPLATE = '{hostname}'
ZABBIX_MESSAGE_TEMPLATE = '{status} ({severity}) alert on [{hostname}]({link}).\n{trigger}\n{item}'
ZABBIX_MESSAGE_TEMPLATE = """
{status} ({severity}) alert on [{hostname}]({link}):
* {trigger}
* {item}
""".strip()
@api_key_only_webhook_view('Zabbix')
@has_request_variables