From: Ismaƫl Bouya Date: Sat, 1 May 2021 17:05:47 +0000 (+0200) Subject: Small adjustments for naemon and web server X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=a0e80453478719b9b13240f0e045d4d0419b8109;p=perso%2FImmae%2FConfig%2FNix.git Small adjustments for naemon and web server --- diff --git a/environments/immae-eu.nix b/environments/immae-eu.nix index a398359..7a52a28 100644 --- a/environments/immae-eu.nix +++ b/environments/immae-eu.nix @@ -65,7 +65,7 @@ let newsboat irssi # nix - yarn2nix-moretea.yarn2nix nix + yarn2nix-moretea.yarn2nix nixUnstable nixops nix-prefetch-scripts nix-generate-from-cpan bundix nodePackages.bower2nix nix-diff nodePackages.node2nix niv diff --git a/modules/private/monitoring/default.nix b/modules/private/monitoring/default.nix index d593e55..5f8a8c9 100644 --- a/modules/private/monitoring/default.nix +++ b/modules/private/monitoring/default.nix @@ -232,7 +232,32 @@ in config = lib.mkIf cfg.enable { services.nginx = lib.mkIf config.myServices.status.enable { - virtualHosts."status.immae.eu".locations = objectsFiles; + virtualHosts."status.immae.eu".locations = objectsFiles // { + "=/common/immae.cfg" = { + alias = pkgs.writeText "immae.cfg" '' + # put me for instance in /etc/naemon/module-conf.d/immae.cfg + # Make sure that you have include_dir=module-conf.d in + # naemon.cfg + log_initial_states=1 + date_format=iso8601 + admin_email=${config.myEnv.monitoring.email} + obsess_over_services=1 + ocsp_command=notify-master + ''; + }; + "=/common/resource.cfg" = { + alias = pkgs.writeText "resource.cfg" '' + # Resource.cfg file + # Replace this with path to monitoring plugins + $USER1$=@@COMMON_PLUGINS@@ + # Replace this with a path to scripts from + # https://git.immae.eu/cgit/perso/Immae/Config/Nix.git/tree/modules/private/monitoring/plugins + $USER2$=@@IMMAE_PLUGINS@@ + $USER200$=https://status.immae.eu/ + $USER201$=@@TOKEN@@ + ''; + }; + }; }; services.duplyBackup.profiles.monitoring = { diff --git a/modules/private/monitoring/objects_master.nix b/modules/private/monitoring/objects_master.nix index 5b5b15f..30bfe73 100644 --- a/modules/private/monitoring/objects_master.nix +++ b/modules/private/monitoring/objects_master.nix @@ -32,6 +32,7 @@ retain_status_information = "1"; retry_interval = "2"; check_command = "check_passive"; + _webstatus_namespace = "immae"; }; }; }; diff --git a/modules/private/monitoring/objects_tiboqorl-fr.nix b/modules/private/monitoring/objects_tiboqorl-fr.nix index 3657c19..b49a1d8 100644 --- a/modules/private/monitoring/objects_tiboqorl-fr.nix +++ b/modules/private/monitoring/objects_tiboqorl-fr.nix @@ -85,10 +85,10 @@ in ]; command = { check_local_disk = "$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$"; - check_local_procs = "/usr/bin/sudo $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$"; + check_local_procs = "$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$"; check_local_load = "$USER1$/check_load -w $ARG1$ -c $ARG2$"; check_local_swap = "$USER1$/check_swap -n ok -w $ARG1$ -c $ARG2$"; - check_local_bandwidth = "/usr/bin/sudo $USER2$/check_bandwidth -i=$ARG1$ -w $ARG2$ -c $ARG3$"; + check_local_bandwidth = "$USER2$/check_bandwidth -i=$ARG1$ -w $ARG2$ -c $ARG3$"; check_memory = "$USER2$/check_mem.sh -w $ARG1$ -c $ARG2$"; check_ntp = "$USER1$/check_ntp_time -t 30 -q -H 0.arch.pool.ntp.org"; diff --git a/modules/private/websites/tools/tools/default.nix b/modules/private/websites/tools/tools/default.nix index 7903ca5..6464206 100644 --- a/modules/private/websites/tools/tools/default.nix +++ b/modules/private/websites/tools/tools/default.nix @@ -114,6 +114,7 @@ in { root = "/var/lib/ftp/devtools.immae.eu"; extraConfig = [ '' + Use Apaxy "/var/lib/ftp/devtools.immae.eu" "title" Timeout 600 ProxyTimeout 600 Header always set Content-Security-Policy-Report-Only "${config.myEnv.tools.csp_reports.policies.inline}" diff --git a/modules/private/websites/tools/tools/dmarc_reports/api.php b/modules/private/websites/tools/tools/dmarc_reports/api.php index 5d4657e..850f9ce 100644 --- a/modules/private/websites/tools/tools/dmarc_reports/api.php +++ b/modules/private/websites/tools/tools/dmarc_reports/api.php @@ -116,5 +116,7 @@ if (!isset($_GET['serial'])) { } } +header("Content-Type: application/json"); + echo json_encode($response, JSON_PRETTY_PRINT); ?>