diff options
Diffstat (limited to 'systems/monitoring-1/monitoring.nix')
-rw-r--r-- | systems/monitoring-1/monitoring.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/systems/monitoring-1/monitoring.nix b/systems/monitoring-1/monitoring.nix new file mode 100644 index 0000000..421c71f --- /dev/null +++ b/systems/monitoring-1/monitoring.nix | |||
@@ -0,0 +1,61 @@ | |||
1 | { config, pkgs, lib, name, monitoring, ... }: | ||
2 | let | ||
3 | hostFQDN = config.hostEnv.fqdn; | ||
4 | emailCheck = monitoring.lib.emailCheck config.myEnv.monitoring.email_check; | ||
5 | in | ||
6 | { | ||
7 | config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "emails" "ovh" "notify-primary" ]; | ||
8 | config.myServices.monitoring.objects = lib.mkMerge [ | ||
9 | (monitoring.lib.objectsCommon { | ||
10 | inherit hostFQDN; | ||
11 | hostName = name; | ||
12 | master = true; | ||
13 | processWarn = "70"; processAlert = "80"; | ||
14 | loadWarn = "4.0"; loadAlert = "5.0"; | ||
15 | load15Warn = "1.0"; load15Alert = "2.0"; | ||
16 | interface = builtins.head (builtins.attrNames config.networking.interfaces); | ||
17 | }) | ||
18 | |||
19 | { | ||
20 | service = [ | ||
21 | (emailCheck "monitoring-1" hostFQDN) | ||
22 | |||
23 | { | ||
24 | service_description = "OVH account has enough sms"; | ||
25 | host_name = hostFQDN; | ||
26 | use = "external-service"; | ||
27 | check_command = "check_ovh_sms"; | ||
28 | |||
29 | check_interval = 120; | ||
30 | notification_interval = "1440"; | ||
31 | } | ||
32 | |||
33 | # Dummy service for testing | ||
34 | # { | ||
35 | # service_description = "Dummy failing test"; | ||
36 | # host_name = "dummy-host"; | ||
37 | # use = "local-service"; | ||
38 | # check_interval = 0.3; | ||
39 | # max_check_attempts = "1"; | ||
40 | # flap_detection_enabled = "0"; | ||
41 | # notification_interval = "0.1"; | ||
42 | # check_command = "check_critical"; | ||
43 | # } | ||
44 | ]; | ||
45 | |||
46 | host = { | ||
47 | # Dummy host for testing | ||
48 | # "dummy-host" = { | ||
49 | # alias = "dummy.host"; | ||
50 | # check_interval = 0.3; | ||
51 | # max_check_attempts = "1"; | ||
52 | # flap_detection_enabled = "0"; | ||
53 | # notification_interval = "0.1"; | ||
54 | # address = "dummy.host"; | ||
55 | # use = "linux-server"; | ||
56 | # check_command = "check_ok"; | ||
57 | # }; | ||
58 | }; | ||
59 | } | ||
60 | ]; | ||
61 | } | ||