Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stretch-monit-systemd-timer' into 'stretch'
Run symbiosis-monit from a systemd timer. See merge request !48
- Loading branch information
Showing
7 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
sbin/symbiosis-monit usr/sbin/ | ||
sbin/* usr/sbin/ | ||
monit.d/* usr/share/symbiosis/monit/checks/ | ||
templates/* usr/share/symbiosis/monit/ | ||
lib/* usr/lib/ruby/vendor_ruby/ | ||
test.d/* etc/symbiosis/test.d/ | ||
|
||
system/* lib/systemd/system/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
args="--since=today" | ||
[ -e "/var/tmp/symbiosis-monit.cursor" ] && args="--after-cursor=$(</var/tmp/symbiosis-monit.cursor)" | ||
|
||
journalctl -b0 $args -o cat -u "symbiosis-monit.service" | mail -s "Symbiosis monitor detected service failure" root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Unit] | ||
Description=Notify by email about symbiosis-monit failure | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/sbin/symbiosis-monit-failure-email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[Unit] | ||
Description=Symbiosis monitor | ||
OnFailure=symbiosis-monit-failure-email.service | ||
|
||
[Service] | ||
Type=simple | ||
ExecStartPre=/bin/sh -c 'journalctl -o cat -n 0 -u %n --show-cursor | cut -f3 -d" " | sudo -u nobody tee /var/tmp/symbiosis-monit.cursor >/dev/null' | ||
ExecStart=/usr/sbin/symbiosis-monit -t email /etc/symbiosis/monit.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Regularly execute symbiosis-monit.service | ||
|
||
[Timer] | ||
# run every 2 minutes | ||
OnCalendar=*:0/2 | ||
|
||
[Install] | ||
WantedBy=timers.target |