mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Configure Monit on all hosts
This commit is contained in:
parent
8d31683aa0
commit
5f36ab8644
6 changed files with 110 additions and 20 deletions
|
|
@ -9,6 +9,7 @@
|
|||
../modules/synapse.nix
|
||||
../modules/nextcloud.nix
|
||||
../modules/custom-backup-job.nix
|
||||
../modules/custom-monit.nix
|
||||
../modules/dokuwiki.nix
|
||||
../modules/website-marie.nix
|
||||
];
|
||||
|
|
@ -22,12 +23,35 @@
|
|||
|
||||
services.custom-backup-job = {
|
||||
additionalPaths = [ "/var/lib/nextcloud/config" ];
|
||||
readWritePaths = [ "/nix/var/data/murmur" ];
|
||||
preHook = "cp /var/lib/murmur/murmur.sqlite /nix/var/data/murmur/murmur.sqlite";
|
||||
readWritePaths = [ "/nix/var/data/murmur" "/nix/var/data/backup/" ];
|
||||
preHook = ''
|
||||
cp /var/lib/murmur/murmur.sqlite /nix/var/data/murmur/murmur.sqlite
|
||||
'';
|
||||
postHook = ''
|
||||
touch /nix/var/data/backup/backup-ok
|
||||
'';
|
||||
startAt = "03:30";
|
||||
sshKey = config.sops.secrets.borgSshKey.path;
|
||||
};
|
||||
|
||||
services.custom-monit.additionalConfig = ''
|
||||
check file nextcloud-data-mounted with path /var/lib/nextcloud/data/index.html
|
||||
start = "${pkgs.systemd}/bin/systemctl start nextcloud-data-sshfs.service"
|
||||
|
||||
check host jellyfin with address jellyfin.banditlair.com
|
||||
if failed port 443 protocol https with timeout 20 seconds then alert
|
||||
check host stb with address www.societe-de-tir-bertrix.com
|
||||
if failed port 443 protocol https with timeout 20 seconds then alert
|
||||
|
||||
check host transmission with address transmission.banditlair.com
|
||||
if failed
|
||||
port 443
|
||||
protocol https
|
||||
status = 401
|
||||
with timeout 20 seconds
|
||||
then alert
|
||||
'';
|
||||
|
||||
networking.interfaces.enp1s0 = {
|
||||
useDHCP = true;
|
||||
ipv4 = {
|
||||
|
|
@ -43,19 +67,4 @@
|
|||
networking.firewall.allowedTCPPorts = [ 80 443 64738 ];
|
||||
networking.firewall.allowedUDPPorts = [ 64738 ];
|
||||
|
||||
services.monit = {
|
||||
enable = true;
|
||||
config = ''
|
||||
set daemon 30
|
||||
with start delay 90
|
||||
|
||||
set httpd
|
||||
port 2812
|
||||
use address 127.0.0.1
|
||||
allow localhost
|
||||
|
||||
check file nextcloud-data-mounted with path /var/lib/nextcloud/data/index.html
|
||||
start = "${pkgs.systemd}/bin/systemctl start nextcloud-data-sshfs.service"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue