aboutsummaryrefslogtreecommitdiff
path: root/systems/monitoring-1/monitoring.nix
blob: 421c71f71e6c0793dbf44b4a49660d935f16f04c (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ config, pkgs, lib, name, monitoring, ... }:
let
  hostFQDN = config.hostEnv.fqdn;
  emailCheck = monitoring.lib.emailCheck config.myEnv.monitoring.email_check;
in
{
  config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "emails" "ovh" "notify-primary" ];
  config.myServices.monitoring.objects = lib.mkMerge [
    (monitoring.lib.objectsCommon {
      inherit hostFQDN;
      hostName = name;
      master = true;
      processWarn = "70"; processAlert = "80";
      loadWarn = "4.0"; loadAlert = "5.0";
      load15Warn = "1.0"; load15Alert = "2.0";
      interface = builtins.head (builtins.attrNames config.networking.interfaces);
    })

    {
      service = [
        (emailCheck "monitoring-1" hostFQDN)

        {
          service_description = "OVH account has enough sms";
          host_name = hostFQDN;
          use = "external-service";
          check_command = "check_ovh_sms";

          check_interval = 120;
          notification_interval = "1440";
        }

        # Dummy service for testing
        # {
        #   service_description = "Dummy failing test";
        #   host_name = "dummy-host";
        #   use = "local-service";
        #   check_interval = 0.3;
        #   max_check_attempts = "1";
        #   flap_detection_enabled = "0";
        #   notification_interval = "0.1";
        #   check_command = "check_critical";
        # }
      ];

      host = {
        # Dummy host for testing
        # "dummy-host" = {
        #   alias = "dummy.host";
        #   check_interval = 0.3;
        #   max_check_attempts = "1";
        #   flap_detection_enabled = "0";
        #   notification_interval = "0.1";
        #   address = "dummy.host";
        #   use = "linux-server";
        #   check_command = "check_ok";
        # };
      };
    }
  ];
}