1 { config, myconfig, pkgs, lib, ... }:
3 myplugins = pkgs.runCommand "buildplugins" {
4 buildInputs = [ pkgs.makeWrapper pkgs.perl ];
7 cp ${./plugins}/* $out/
9 wrapProgram $out/check_command --prefix PATH : ${config.security.wrapperDir}
10 wrapProgram $out/send_nrdp.sh --prefix PATH : ${lib.makeBinPath [
11 pkgs.curl pkgs.which pkgs.coreutils
13 wrapProgram $out/check_mem.sh --prefix PATH : ${lib.makeBinPath [
14 pkgs.gnugrep pkgs.gawk pkgs.procps-ng
20 myServices.monitoring.enable = lib.mkOption {
21 type = lib.types.bool;
24 Whether to enable monitoring.
29 config = lib.mkIf config.myServices.monitoring.enable {
30 security.sudo.extraRules = [
33 { command = "${pkgs.mdadm}/bin/mdadm --monitor --scan -1"; options = [ "NOPASSWD" ]; }
34 { command = "${pkgs.postfix}/bin/mailq"; options = [ "NOPASSWD" ]; }
40 environment.etc."mdadm.conf" = {
44 text = "MAILADDR ${myconfig.env.monitoring.email}";
47 # needed since extraResource is not in the closure
48 systemd.services.naemon.path = [ myplugins ];
52 broker_module=${pkgs.naemon-livestatus}/lib/naemon-livestatus/livestatus.so ${config.services.naemon.runDir}/live
56 admin_email=${myconfig.env.monitoring.email}
58 obsess_over_services=1
59 ocsp_command=notify-master
63 $USER200$=${myconfig.env.monitoring.status_url}
64 $USER201$=${myconfig.env.monitoring.status_token}
66 objectDefs = builtins.readFile ./conf/local_services.cfg
67 + builtins.readFile ./conf/timeperiods.cfg
68 + builtins.readFile ./conf/services.cfg
69 + builtins.readFile ./conf/contacts.cfg
70 + builtins.readFile ./conf/hosts.cfg
73 command_line ${myplugins}/send_nrdp.sh -u "$USER200$" -t "$USER201$" -H "$HOSTADDRESS$" -s "$SERVICEDESC$" -S "$SERVICESTATEID$" -o "$SERVICEOUTPUT$"
74 command_name notify-master
77 service_description No mdadm array is degraded
79 check_command check_command_output!${pkgs.mdadm}/bin/mdadm --monitor --scan -1!^$!-s 0 -r root
83 service_description mailq is empty
85 check_command check_mailq
89 command_name check_mailq
90 command_line $USER1$/check_mailq -s -w 1 -c 2
96 host_name eldiron.immae.eu
103 host_name eldiron.immae.eu
104 alias eldiron.immae.eu
105 address eldiron.immae.eu