+ toObjects = pkgs.callPackage ./to_objects.nix {};
+ commonConfig = {
+ eldiron = {
+ processWarn = "250"; processAlert = "400";
+ loadWarn = "8.0"; loadAlert = "10.0";
+ };
+ backup-2 = {
+ processWarn = "50"; processAlert = "60";
+ loadWarn = "1.0"; loadAlert = "2.0";
+ };
+ monitoring-1 = {
+ processWarn = "50"; processAlert = "60";
+ loadWarn = "1.0"; loadAlert = "2.0";
+ };
+ };
+ masterPassiveObjects = let
+ otherPassiveObjects = map
+ (n: (pkgs.callPackage (./. + "/objects_" + n + ".nix") {}))
+ [ "caldance-1" "ulminfo-fr" "immae-eu" "phare" "tiboqorl-fr" ];
+ otherPassiveServices = lib.flatten (map (h: h.service or []) otherPassiveObjects);
+ otherPassiveHosts = (map (h: h.host)) otherPassiveObjects;
+ passiveNodes = lib.attrsets.filterAttrs (n: _: builtins.elem n ["backup-2" "eldiron"]) nodes;
+ toPassiveServices = map (s: s.passiveInfo.filter s // s.passiveInfo);
+ passiveServices = lib.flatten (lib.attrsets.mapAttrsToList
+ (_: n: toPassiveServices n.config.myServices.monitoring.services)
+ passiveNodes
+ );
+ in {
+ service = passiveServices ++ otherPassiveServices;
+ host = lib.lists.foldr
+ (a: b: a//b)
+ {}
+ (otherPassiveHosts ++ lib.attrsets.mapAttrsToList (_: h: h.config.myServices.monitoring.hosts) passiveNodes);
+ };
+ masterObjects = pkgs.callPackage ./objects_master.nix { inherit config; };
+ commonObjects = pkgs.callPackage ./objects_common.nix ({
+ master = cfg.master;
+ hostFQDN = config.hostEnv.FQDN;
+ hostName = name;
+ sudo = "/run/wrappers/bin/sudo";
+ } // builtins.getAttr name commonConfig);
+ hostObjects =
+ let
+ specific_file = ./. + "/objects_" + name + ".nix";
+ in
+ lib.attrsets.optionalAttrs
+ (builtins.pathExists specific_file)
+ (pkgs.callPackage specific_file {
+ inherit config;
+ hostFQDN = config.hostEnv.FQDN;
+ hostName = name;
+ });