bundles/icinga2: add notification support via ntfy

This commit is contained in:
Franzi 2023-04-09 17:32:36 +02:00
parent 25aabad865
commit b3e490720e
Signed by: kunsi
GPG key ID: 12E3D2136B818350
5 changed files with 81 additions and 36 deletions

View file

@ -1,16 +1,17 @@
#!/usr/bin/env python3
from json import load
from sys import exit
from requests import get
SIPGATE_USER = '${node.metadata['icinga2']['sipgate_user']}'
SIPGATE_PASS = '${node.metadata['icinga2']['sipgate_pass']}'
with open('/etc/icinga2/notification_config.json') as f:
CONFIG = load(f)
try:
r = get(
'https://api.sipgate.com/v2/balance',
auth=(SIPGATE_USER, SIPGATE_PASS),
auth=(CONFIG['sipgate']['user'], CONFIG['sipgate']['password']),
headers={'Accept': 'application/json'},
)