Archived
modularized docker health to gotify service
This commit is contained in:
@@ -27,7 +27,8 @@ in
|
|||||||
../../modules/tailscale/enable-service.nix
|
../../modules/tailscale/enable-service.nix
|
||||||
../../modules/rotate-traefik-logs.nix
|
../../modules/rotate-traefik-logs.nix
|
||||||
../../modules/raspi/mount-data.nix
|
../../modules/raspi/mount-data.nix
|
||||||
../../modules/nextcloud-cron-job.nix
|
../../modules/services/nextcloud-cron-job.nix
|
||||||
|
../../modules/services/docker-health-to-gotify.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@@ -117,30 +118,30 @@ services.rpcbind.enable = true;
|
|||||||
|
|
||||||
# Create Gotify Docker monitoring script task
|
# Create Gotify Docker monitoring script task
|
||||||
|
|
||||||
systemd.services.docker-health-to-gotify = {
|
# systemd.services.docker-health-to-gotify = {
|
||||||
description = "Alert Gotify when Docker containers become unhealthy";
|
# description = "Alert Gotify when Docker containers become unhealthy";
|
||||||
after = [ "docker.service" ];
|
# after = [ "docker.service" ];
|
||||||
serviceConfig = {
|
# serviceConfig = {
|
||||||
Type = "oneshot";
|
# Type = "oneshot";
|
||||||
# Run as root so it can read /etc/secrets and access docker socket
|
# # Run as root so it can read /etc/secrets and access docker socket
|
||||||
# User = "root";
|
# # User = "root";
|
||||||
#EnvironmentFile = "-/etc/secrets/docker-health-alert.env";
|
# #EnvironmentFile = "-/etc/secrets/docker-health-alert.env";
|
||||||
ExecStart = "${pkgs.bash}/bin/bash /home/nixos/docker/monitoring/gotify/docker-health-to-gotify.sh";
|
# ExecStart = "${pkgs.bash}/bin/bash /home/nixos/docker/monitoring/gotify/docker-health-to-gotify.sh";
|
||||||
StandardOutput = "journal";
|
# StandardOutput = "journal";
|
||||||
StandardError = "journal";
|
# StandardError = "journal";
|
||||||
};
|
# };
|
||||||
path = with pkgs; [ docker curl coreutils gnused ];
|
# path = with pkgs; [ docker curl coreutils gnused ];
|
||||||
};
|
# };
|
||||||
|
|
||||||
systemd.timers.docker-health-to-gotify = {
|
# systemd.timers.docker-health-to-gotify = {
|
||||||
wantedBy = [ "timers.target" ];
|
# wantedBy = [ "timers.target" ];
|
||||||
timerConfig = {
|
# timerConfig = {
|
||||||
OnBootSec = "2min";
|
# OnBootSec = "2min";
|
||||||
OnUnitActiveSec = "1min";
|
# OnUnitActiveSec = "1min";
|
||||||
AccuracySec = "15s";
|
# AccuracySec = "15s";
|
||||||
Persistent = true;
|
# Persistent = true;
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
# Create /mnt/docker
|
# Create /mnt/docker
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
systemd.services.docker-health-to-gotify = {
|
||||||
|
description = "Alert Gotify when Docker containers become unhealthy";
|
||||||
|
after = [ "docker.service" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
# Run as root so it can read /etc/secrets and access docker socket
|
||||||
|
# User = "root";
|
||||||
|
#EnvironmentFile = "-/etc/secrets/docker-health-alert.env";
|
||||||
|
ExecStart = "${pkgs.bash}/bin/bash /home/nixos/docker/monitoring/gotify/docker-health-to-gotify.sh";
|
||||||
|
StandardOutput = "journal";
|
||||||
|
StandardError = "journal";
|
||||||
|
};
|
||||||
|
path = with pkgs; [ docker curl coreutils gnused ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.docker-health-to-gotify = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnBootSec = "2min";
|
||||||
|
OnUnitActiveSec = "1min";
|
||||||
|
AccuracySec = "15s";
|
||||||
|
Persistent = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user