From 479c521af98ade85b5910a87db5177443467c370 Mon Sep 17 00:00:00 2001
From: Nejc Zupan <nejc.zupan@gmail.com>
Date: Wed, 8 Apr 2020 20:58:06 +0100
Subject: [PATCH] Automatically restart netdata on failures

I've had Netdata crash on me sometimes. Rarely but more than once. And I lost days of data before I noticed.

Let's be nice and restart it on failures by default.
---
 nixos/modules/services/monitoring/netdata.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix
index e43241eea89..a5233a46e34 100644
--- a/nixos/modules/services/monitoring/netdata.nix
+++ b/nixos/modules/services/monitoring/netdata.nix
@@ -154,6 +154,7 @@ in {
         ExecStart = "${cfg.package}/bin/netdata -P /run/netdata/netdata.pid -D -c ${configFile}";
         ExecReload = "${pkgs.utillinux}/bin/kill -s HUP -s USR1 -s USR2 $MAINPID";
         TimeoutStopSec = 60;
+        Restart = "on-failure";
         # User and group
         User = cfg.user;
         Group = cfg.group;