1 { config, myconfig, pkgs, lib, name, hostFQDN, ... }:
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 [
13 wrapProgram $out/check_mem.sh --prefix PATH : ${lib.makeBinPath [
14 pkgs.gnugrep pkgs.gawk pkgs.procps-ng
16 wrapProgram $out/check_postgres_replication --prefix PATH : ${lib.makeBinPath [
21 let specific_file = ./conf + "/specific_" + name + ".cfg";
23 builtins.readFile ./conf/local_services.cfg
24 + builtins.readFile ./conf/timeperiods.cfg
25 + builtins.readFile ./conf/services.cfg
26 + builtins.readFile ./conf/contacts.cfg
27 + builtins.readFile ./conf/hosts.cfg
30 command_line ${myplugins}/send_nrdp.sh -u "$USER200$" -t "$USER201$" -H "$HOSTADDRESS$" -s "$SERVICEDESC$" -S "$SERVICESTATEID$" -o "$SERVICEOUTPUT$"
31 command_name notify-master
34 service_description No mdadm array is degraded
36 check_command check_command_output!${pkgs.mdadm}/bin/mdadm --monitor --scan -1!^$!-s 0 -r root
55 + lib.strings.optionalString (builtins.pathExists specific_file) (builtins.readFile specific_file);
59 myServices.monitoring = {
60 enable = lib.mkOption {
61 type = lib.types.bool;
64 Whether to enable monitoring.
70 config = lib.mkIf config.myServices.monitoring.enable {
71 services.duplyBackup.profiles.monitoring = {
72 rootDir = config.services.naemon.varDir;
74 security.sudo.extraRules = [
77 { command = "${pkgs.mdadm}/bin/mdadm --monitor --scan -1"; options = [ "NOPASSWD" ]; }
78 { command = "${pkgs.postfix}/bin/mailq"; options = [ "NOPASSWD" ]; }
85 { command = "${myplugins}/check_postgres_replication *"; options = [ "NOPASSWD" ]; }
86 { command = "${myplugins}/check_last_file_date /backup2/*"; options = [ "NOPASSWD" ]; }
93 { command = "${myplugins}/check_last_file_date /backup2/*"; options = [ "NOPASSWD" ]; }
99 environment.etc."mdadm.conf" = {
103 text = "MAILADDR ${myconfig.env.monitoring.email}";
106 # needed since extraResource is not in the closure
107 systemd.services.naemon.path = [ myplugins ];
111 broker_module=${pkgs.naemon-livestatus}/lib/naemon-livestatus/livestatus.so ${config.services.naemon.runDir}/live
115 admin_email=${myconfig.env.monitoring.email}
117 obsess_over_services=1
118 ocsp_command=notify-master
122 $USER200$=${myconfig.env.monitoring.status_url}
123 $USER201$=${myconfig.env.monitoring.status_token}
125 objectDefs = defaultObjects;