parent
3dff3c9121
commit
3c57c113cd
11
README.md
11
README.md
|
@ -13,11 +13,12 @@ optional arguments:
|
||||||
-H, --healthcheck simply exit with 0 for healthy or 1 when unhealthy
|
-H, --healthcheck simply exit with 0 for healthy or 1 when unhealthy
|
||||||
|
|
||||||
The following environment variables will override any config or default:
|
The following environment variables will override any config or default:
|
||||||
* LISTEN_PORT (default: 8080)
|
* DISABLE_RESOLVED (default: False)
|
||||||
* GOTIFY_SERVER (default: localhost)
|
* GOTIFY_KEY (default: None)
|
||||||
* GOTIFY_PORT (default: 80)
|
* GOTIFY_PORT (default: 80)
|
||||||
* GOTIFY_KEY (default: None)
|
* GOTIFY_SERVER (default: localhost)
|
||||||
* VERBOSE (default: False)
|
* LISTEN_PORT (default: 8080)
|
||||||
|
* VERBOSE (default: False)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
11
alertify.py
11
alertify.py
|
@ -15,10 +15,11 @@ from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
DEFAULTS = {
|
DEFAULTS = {
|
||||||
'listen_port': int(8080),
|
'disable_resolved': bool(False),
|
||||||
'gotify_server': str('localhost'),
|
|
||||||
'gotify_port': int(80),
|
|
||||||
'gotify_key': str(),
|
'gotify_key': str(),
|
||||||
|
'gotify_port': int(80),
|
||||||
|
'gotify_server': str('localhost'),
|
||||||
|
'listen_port': int(8080),
|
||||||
'verbose': bool(False),
|
'verbose': bool(False),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +93,10 @@ class HTTPHandler(SimpleHTTPRequestHandler):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if alert['status'] == 'resolved':
|
if alert['status'] == 'resolved':
|
||||||
|
if self.config.get('disable_resolved'):
|
||||||
|
print('Ignoring resolved messages')
|
||||||
|
self._respond(200, 'Ignored. "resolved" messages are disabled')
|
||||||
|
return
|
||||||
prefix = 'Resolved'
|
prefix = 'Resolved'
|
||||||
else:
|
else:
|
||||||
prefix = alert['commonLabels'].get(
|
prefix = alert['commonLabels'].get(
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
# verbose: true
|
disable_resolved: false
|
||||||
gotify_server: gotifyserver.example.net
|
|
||||||
gotify_key: sOmEsEcReTkEy1
|
gotify_key: sOmEsEcReTkEy1
|
||||||
gotify_port: "80"
|
gotify_port: "80"
|
||||||
|
gotify_server: gotifyserver.example.net
|
||||||
listen_port: "8080"
|
listen_port: "8080"
|
||||||
|
verbose: true
|
||||||
|
|
Loading…
Reference in a new issue