diff options
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r-- | nixos/modules/services/monitoring/monit.nix | 16 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/ups.nix | 29 |
2 files changed, 22 insertions, 23 deletions
diff --git a/nixos/modules/services/monitoring/monit.nix b/nixos/modules/services/monitoring/monit.nix index 642fac3b3a0..704693969a3 100644 --- a/nixos/modules/services/monitoring/monit.nix +++ b/nixos/modules/services/monitoring/monit.nix @@ -19,10 +19,6 @@ in default = ""; description = "monit.conf content"; }; - startOn = mkOption { - default = "started network-interfaces"; - description = "What Monit supposes to be already present"; - }; }; }; @@ -39,14 +35,12 @@ in } ]; - jobs.monit = { + systemd.services.monit = { description = "Monit system watcher"; - - startOn = config.services.monit.startOn; - - exec = "${pkgs.monit}/bin/monit -I -c /etc/monit.conf"; - - respawn = true; + after = [ "network-interfaces.target" ]; + wantedBy = [ "multi-user.target" ]; + script = "${pkgs.monit}/bin/monit -I -c /etc/monit.conf"; + serviceConfig.Restart = "always"; }; }; } diff --git a/nixos/modules/services/monitoring/ups.nix b/nixos/modules/services/monitoring/ups.nix index eb478f7da65..5f80d547dbc 100644 --- a/nixos/modules/services/monitoring/ups.nix +++ b/nixos/modules/services/monitoring/ups.nix @@ -180,31 +180,36 @@ in environment.systemPackages = [ pkgs.nut ]; - jobs.upsmon = { + systemd.services.upsmon = { description = "Uninterruptible Power Supplies (Monitor)"; - startOn = "ip-up"; - daemonType = "fork"; - exec = ''${pkgs.nut}/sbin/upsmon''; + wantedBy = [ "ip-up.target" ]; + serviceConfig.Type = "forking"; + script = "${pkgs.nut}/sbin/upsmon"; environment.NUT_CONFPATH = "/etc/nut/"; environment.NUT_STATEPATH = "/var/lib/nut/"; }; - jobs.upsd = { + systemd.services.upsd = { description = "Uninterruptible Power Supplies (Daemon)"; - startOn = "started network-interfaces and started upsmon"; - daemonType = "fork"; + wantedBy = [ "multi-user.target" ]; + after = [ "network-interfaces.target" "upsmon.service" ]; + serviceConfig.Type = "forking"; # TODO: replace 'root' by another username. - exec = ''${pkgs.nut}/sbin/upsd -u root''; + script = "${pkgs.nut}/sbin/upsd -u root"; environment.NUT_CONFPATH = "/etc/nut/"; environment.NUT_STATEPATH = "/var/lib/nut/"; }; - jobs.upsdrv = { + systemd.services.upsdrv = { description = "Uninterruptible Power Supplies (Register all UPS)"; - startOn = "started upsd"; + wantedBy = [ "multi-user.target" ]; + after = [ "upsd.service" ]; # TODO: replace 'root' by another username. - exec = ''${pkgs.nut}/bin/upsdrvctl -u root start''; - task = true; + script = ''${pkgs.nut}/bin/upsdrvctl -u root start''; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; environment.NUT_CONFPATH = "/etc/nut/"; environment.NUT_STATEPATH = "/var/lib/nut/"; }; |