From 04b2460eb65c64705df0de0ce33dde6ba524a216 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Tue, 31 Oct 2017 15:49:59 +0100 Subject: [PATCH] graphite: fix the graphiteApi service --- nixos/modules/services/monitoring/graphite.nix | 4 ++-- nixos/tests/graphite.nix | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index 01b4aca91731..645dfeab0193 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -22,8 +22,8 @@ let ); graphiteApiConfig = pkgs.writeText "graphite-api.yaml" '' - time_zone: ${config.time.timeZone} search_index: ${dataDir}/index + ${optionalString (!isNull config.time.timeZone) ''time_zone: ${config.time.timeZone}''} ${optionalString (cfg.api.finders != []) ''finders:''} ${concatMapStringsSep "\n" (f: " - " + f.moduleName) cfg.api.finders} ${optionalString (cfg.api.functions != []) ''functions:''} @@ -536,7 +536,7 @@ in { environment = { PYTHONPATH = let aenv = pkgs.python.buildEnv.override { - extraLibs = [ cfg.api.package pkgs.cairo ] ++ cfg.api.finders; + extraLibs = [ cfg.api.package pkgs.cairo pkgs.pythonPackages.cffi ] ++ cfg.api.finders; }; in "${aenv}/${pkgs.python.sitePackages}"; GRAPHITE_API_CONFIG = graphiteApiConfig; diff --git a/nixos/tests/graphite.nix b/nixos/tests/graphite.nix index 4fd7de192d55..a22ef224580a 100644 --- a/nixos/tests/graphite.nix +++ b/nixos/tests/graphite.nix @@ -4,22 +4,28 @@ import ./make-test.nix ({ pkgs, ...} : nodes = { one = { config, pkgs, ... }: { + time.timeZone = "UTC"; services.graphite = { - web = { + web.enable = true; + api = { enable = true; + port = 8082; }; - carbon = { - enableCache = true; - }; + carbon.enableCache = true; + seyren.enable = true; + pager.enable = true; }; }; - }; + }; testScript = '' startAll; $one->waitForUnit("default.target"); $one->requireActiveUnit("graphiteWeb.service"); + $one->requireActiveUnit("graphiteApi.service"); + $one->requireActiveUnit("graphitePager.service"); $one->requireActiveUnit("carbonCache.service"); + $one->requireActiveUnit("seyren.service"); $one->succeed("echo \"foo 1 `date +%s`\" | nc -q0 localhost 2003"); $one->waitUntilSucceeds("curl 'http://localhost:8080/metrics/find/?query=foo&format=treejson' --silent | grep foo") '';