Thorben Günther
b58ce4acb3
Set default header for User-Agent
2023-02-20 13:27:41 +01:00
Thorben Günther
f1dfde6891
Add icon support
...
Implements: https://todo.xenrox.net/~xenrox/ntfy-alertmanager/12
2023-02-20 13:08:59 +01:00
Thorben Günther
1daa751cb2
Move http.Client to receiver struct
2023-02-17 01:45:14 +01:00
Thorben Günther
84c4c45d5b
version: Use linker flag
...
Embedding the version file is slightly annoying for packaging, because
the release tarball is not a git repository and so "go generate" would
fail. Instead a packager would have to manually create the version.txt
file.
With using a linker flag, the version string has a graceful fallback.
2023-02-16 13:06:21 +01:00
Thorben Günther
8a387ff834
Add tags for resolved alerts
...
Implements: https://todo.xenrox.net/~xenrox/ntfy-alertmanager/8
2023-02-12 17:09:23 +01:00
Thorben Günther
df02ee5303
cache: Only cache the alert if it was published successfully
2023-02-12 16:50:18 +01:00
Thorben Günther
4b5c309a3c
Upgrade dependencies
2023-02-12 16:37:03 +01:00
Thorben Günther
a329d4dc52
silence: Fix broken ntfy action
...
A silence action was added even when "base-url" was not set. This action
would of course fail, since there was no valid URL scheme given.
The action button is now removed in that case.
2023-02-12 16:32:34 +01:00
Thorben Günther
38fa5f9f71
silence: Parse Alertmanager API response
2023-02-12 16:07:49 +01:00
Thorben Günther
81ff7bd90e
alertmanger: Add setting to overwrite URL
2023-02-12 14:58:37 +01:00
Thorben Günther
7bb448b5eb
Refactor structs to use map[string]string
2023-02-12 14:40:32 +01:00
Thorben Günther
1b986078f0
silence: Don't add silence action to resolved alerts
2023-02-12 14:32:05 +01:00
Thorben Günther
0a3ead8b6e
silence: Add to multi alert-mode as well
2023-02-12 14:28:24 +01:00
Thorben Günther
1e44ba5694
alertmanager: Support basic auth
2023-02-12 14:15:02 +01:00
Thorben Günther
c919ec9af2
Add ability to silence alerts with ntfy action
...
For now only for the single alert mode.
This is implemented as an action button, that will send an API request
to ntfy-alertmanager itself instead of Alertmanager. Here ntfy-alertmanager
acts as a proxy and will then do the API request for actually creating
the silence in Alertmanager.
This is founded in a limitation of ntfy, that seemingly does not allow a
json body with more than one key.
2023-02-12 03:04:17 +01:00
Thorben Günther
34c0574163
config: Add required settings for silencing alerts
2023-02-11 13:56:06 +01:00
Thorben Günther
7a6b7c9cdb
cache: Take alert status (firing, resolved) into account
...
Otherwise a resolved alert would not trigger a notification, since its
fingerprint - which is a generated hash from the labels - remains the
same.
2023-02-08 20:41:05 +01:00
Thorben Günther
1a4081a312
Log incoming, parsed alert
2023-02-08 20:41:04 +01:00
Thorben Günther
0508f37896
cache: Add config options for duration and cleanup interval
2023-02-08 20:41:03 +01:00
Thorben Günther
d20d76d2b3
single mode: Cache alert fingerprints
...
If ntfy-alertmanager breaks alertmanager's grouping feature, it should
take care of caching alerts on its own.
2023-02-08 20:41:03 +01:00
Thorben Günther
8933ccd825
Support sending grouped alerts on their own
2023-02-08 20:41:02 +01:00
Thorben Günther
46f4590d11
config: Add alert-mode
2023-01-20 15:03:46 +01:00
Thorben Günther
78801c98e4
Add version flag
...
And print version at startup.
2023-01-16 14:35:53 +01:00
Thorben Günther
7548567992
config: Add parsing test
2023-01-16 12:40:24 +01:00
Thorben Günther
549793cb83
config: Load all label settings
...
Until now only the first occurrence of a label type was loaded.
Fixes: https://todo.xenrox.net/~xenrox/ntfy-alertmanager/10
2023-01-16 00:48:11 +01:00
Thorben Günther
9f12f78e9f
CI: Add missing secret for publishing docker images
2023-01-14 21:33:43 +01:00
Thorben Günther
55c58d882c
Publish a dev docker image
...
It is build from the master branch.
2023-01-14 21:31:54 +01:00
Thorben Günther
db01ca2f2f
Move notification creation into new function
2022-11-02 22:43:34 +01:00
Thorben Günther
5f187d1311
Add Dockerfile and publish image
...
Closes: https://todo.xenrox.net/~xenrox/ntfy-alertmanager/4
2022-10-20 14:18:22 +02:00
Thorben Günther
e12116eae9
readme: Add CI status badge
2022-10-19 13:34:35 +02:00
Thorben Günther
5109867f38
Add build manifest
2022-10-13 14:16:41 +02:00
Thorben Günther
072251d8ad
Add readme
2022-10-13 13:41:35 +02:00
Thorben Günther
eed7b9fc1d
Add package comment
2022-10-13 13:14:56 +02:00
Thorben Günther
1714bf5ed6
basicAuthMiddleware: Protect against timing attacks
...
Compare strings of equal length (hashed with SHA-512) with
ConstantTimeCompare.
Closes: https://todo.xenrox.net/~xenrox/ntfy-alertmanager/1
2022-10-13 13:08:54 +02:00
Thorben Günther
9d0772b436
Move notification publishing to own function
2022-10-13 01:17:29 +02:00
Thorben Günther
83f9af7bed
Upgrade dependencies
2022-10-13 01:15:04 +02:00
Thorben Günther
2818ba9885
Support ntfy tags
2022-10-12 17:04:44 +02:00
Thorben Günther
9043ccfb5e
Set ntfy priority depending on Prometheus labels
...
It is possible to configure a priority for an arbitrary label.
Furthermore a priority/order of those arbitrary labels should be
defined. The Alertmanager payload is checked for these and the
priority will be selected from the highest valued label that has one
set in the configuration file.
2022-10-12 16:35:04 +02:00
Thorben Günther
9435feba8d
Set HTTP status codes when declining payload
2022-10-10 22:59:05 +02:00
Thorben Günther
a6c41b2aac
Use middleware for basic auth
2022-10-10 19:55:33 +02:00
Thorben Günther
61ed59cefa
Improve logging
2022-10-10 14:55:22 +02:00
Thorben Günther
5cf4add40b
Support basic auth for the http endpoint
2022-10-10 14:04:51 +02:00
Thorben Günther
93d004925b
Support ntfy auth
2022-10-10 02:42:13 +02:00
Thorben Günther
e02a3d9af1
Fix error message
2022-10-10 01:33:40 +02:00
Thorben Günther
bb1a71a637
Read topic from config
2022-10-10 01:30:39 +02:00
Thorben Günther
8347d6410f
Read log level and bind address from config file
2022-10-10 01:20:18 +02:00
Thorben Günther
0bfa2cf7b9
Check content type and method
2022-10-09 20:03:55 +02:00
Thorben Günther
d2243e3a13
Add gitignore
2022-10-09 19:52:32 +02:00
Thorben Günther
b9335462eb
Format the alert message
...
For now the format is similar to the email receiver. Maybe switch to
template usage in the future.
2022-10-09 19:50:46 +02:00
Thorben Günther
8cdd87e73b
Initial commit
2022-10-09 14:19:48 +02:00