Removed defaults for instance and description

This commit is contained in:
Scott Wallace 2020-10-25 08:41:19 +00:00
parent a8782e43d3
commit 0cb79d734a
2 changed files with 5 additions and 5 deletions

View file

@ -33,8 +33,6 @@ The following environment variables will override any config or default:
* Defaults, if not sent: * Defaults, if not sent:
| Field | Default value | | Field | Default value |
|-------------|---------------| |-------------|---------------|
| Description | `[nodata]` |
| Instance | `[unknown]` |
| Priority | `5` | | Priority | `5` |
| Severity | `Warning` | | Severity | `Warning` |

View file

@ -37,14 +37,16 @@ class MessageHandler:
else: else:
prefix = alert['labels'].get('severity', 'warning') prefix = alert['labels'].get('severity', 'warning')
instance = alert['labels'].get('instance', None)
gotify_msg = { gotify_msg = {
'title': '[{}] {}'.format( 'title': '[{}] {}'.format(
prefix.upper(), prefix.upper(),
alert['annotations'].get('summary'), alert['annotations'].get('summary'),
), ),
'message': '{}: {}'.format( 'message': '{}{}'.format(
alert['labels'].get('instance', '[unknown]'), f'{instance}: ' if instance else '',
alert['annotations'].get('description', '[nodata]'), alert['annotations'].get('description', ''),
), ),
'priority': int(alert['labels'].get('priority', 5)), 'priority': int(alert['labels'].get('priority', 5)),
'extras': { 'extras': {