aboutsummaryrefslogtreecommitdiff
path: root/systems/dilion/monitoring.nix
blob: af7f22434854dba5f93c045810cace92d48b4c9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ lib, pkgs, config, name, monitoring, ... }:
let
  hostFQDN = config.hostEnv.fqdn;
  zfs_snapshot = name: {
    service_description = "ZFS snapshot ${name} happened not too long ago";
    use = "local-service";
    check_command = ["check_zfs_snapshot" name];
    __passive_servicegroups = "webstatus-resources";
  };
in
{
  config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "mdadm" "zfs" "notify-secondary"];
  config.myServices.monitoring.objects = lib.mkMerge [
    (monitoring.lib.objectsCommon {
      inherit hostFQDN;
      hostName = name;
      master = false;
      processWarn = "250"; processAlert = "400";
      loadWarn = "1.0"; loadAlert = "1.2";
      interface = builtins.head (builtins.attrNames config.networking.interfaces);
    })

    {
      service = [
        {
          service_description = "No mdadm array is degraded";
          use = "local-service";
          check_command = ["check_mdadm"];
          __passive_servicegroups = "webstatus-resources";
        }
        {
          service_description = "No ZFS pool is degraded";
          use = "local-service";
          check_command = ["check_zfs"];
          __passive_servicegroups = "webstatus-resources";
        }
        (zfs_snapshot "zpool/backup/eldiron/zpool/root")
        (zfs_snapshot "zpool/backup/eldiron/zpool/root/etc")
        (zfs_snapshot "zpool/backup/eldiron/zpool/root/var")
      ];
    }
  ];
}