Compare commits

...

3 Commits
v0.1.0 ... main

Author SHA1 Message Date
fb33fa7596
remove timestamp, it seems it's not present for all messages? 2024-07-14 16:41:49 +02:00
f759b8bb1e
add example config for service specific override 2024-07-14 16:12:30 +02:00
93f5a9aaad
add timestamp to mailed journal log.
Also restrict to 200 rows to prevent unreasonable large emails...
2024-07-14 16:07:11 +02:00
2 changed files with 12 additions and 1 deletions

View File

@ -29,3 +29,10 @@ alert_method=sysalert.email
#mail_to=root <root@localhost>
smtp_host=localhost
# Specific services can have their own configuration
# If you have an unstable service that sometimes fails three times
# before it recovers you can override max_failures for this service
# by adding a section named after that service:
#
#[unstable.service]
#max_failures=3

View File

@ -50,7 +50,11 @@ def failure(name, failures, config):
reader.add_match(MONITOR_INVOCATION_ID=latest_inv_id)
reader.add_disjunction()
reader.add_match(_SYSTEMD_INVOCATION_ID=latest_inv_id)
journal_txt = "\n".join([entry['MESSAGE'] for entry in reader])
journal_txt = "\n".join(
[
entry["MESSAGE"]
for entry in list(reader)[-200:]
])
if nr_failures <= 1:
subject=f"{hostname} - {name}: failure"