Merge pull request #1073 from offlinehacker/nixos/graphite/fix_carbon
nixos/graphite: carbon, use syslog for logging
This commit is contained in:
commit
c9acee7ee0
@ -5,7 +5,18 @@ with pkgs.lib;
|
|||||||
let
|
let
|
||||||
cfg = config.services.graphite;
|
cfg = config.services.graphite;
|
||||||
writeTextOrNull = f: t: if t == null then null else pkgs.writeText f t;
|
writeTextOrNull = f: t: if t == null then null else pkgs.writeText f t;
|
||||||
|
|
||||||
dataDir = "/var/db/graphite";
|
dataDir = "/var/db/graphite";
|
||||||
|
carbonOpts = name: with config.ids; ''
|
||||||
|
--nodaemon --syslog --prefix=${name} \
|
||||||
|
--uid ${toString uids.graphite} --gid ${toString uids.graphite} ${name}
|
||||||
|
'';
|
||||||
|
carbonEnv = {
|
||||||
|
PYTHONPATH = "${pkgs.python27Packages.carbon}/lib/python2.7/site-packages";
|
||||||
|
GRAPHITE_ROOT = dataDir;
|
||||||
|
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
||||||
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
@ -59,7 +70,7 @@ in {
|
|||||||
[all_min]
|
[all_min]
|
||||||
pattern = \.min$
|
pattern = \.min$
|
||||||
xFilesFactor = 0.1
|
xFilesFactor = 0.1
|
||||||
aggregationMethod = min
|
aggregationMethod = min
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -160,15 +171,8 @@ in {
|
|||||||
description = "Graphite data storage backend";
|
description = "Graphite data storage backend";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-interfaces.target" ];
|
after = [ "network-interfaces.target" ];
|
||||||
environment = {
|
environment = carbonEnv;
|
||||||
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-cache"}";
|
||||||
GRAPHITE_STORAGE_DIR = "/var/db/graphite/";
|
|
||||||
};
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "${pkgs.pythonPackages.carbon}/bin/carbon-cache.py --pidfile /tmp/carbonCache.pid start";
|
|
||||||
User = "graphite";
|
|
||||||
Group = "graphite";
|
|
||||||
};
|
|
||||||
restartTriggers = [
|
restartTriggers = [
|
||||||
pkgs.pythonPackages.carbon
|
pkgs.pythonPackages.carbon
|
||||||
cfg.carbon.config
|
cfg.carbon.config
|
||||||
@ -185,15 +189,8 @@ in {
|
|||||||
description = "Carbon data aggregator";
|
description = "Carbon data aggregator";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-interfaces.target" ];
|
after = [ "network-interfaces.target" ];
|
||||||
environment = {
|
environment = carbonEnv;
|
||||||
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-aggregator"}";
|
||||||
GRAPHITE_STORAGE_DIR = "${dataDir}";
|
|
||||||
};
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "${pkgs.pythonPackages.carbon}/bin/carbon-aggregator.py --pidfile /tmp/carbonAggregator.pid start";
|
|
||||||
User = "graphite";
|
|
||||||
Group = "graphite";
|
|
||||||
};
|
|
||||||
restartTriggers = [
|
restartTriggers = [
|
||||||
pkgs.pythonPackages.carbon cfg.carbon.config cfg.carbon.aggregationRules
|
pkgs.pythonPackages.carbon cfg.carbon.config cfg.carbon.aggregationRules
|
||||||
];
|
];
|
||||||
@ -203,15 +200,8 @@ in {
|
|||||||
description = "Carbon data relay";
|
description = "Carbon data relay";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-interfaces.target" ];
|
after = [ "network-interfaces.target" ];
|
||||||
environment = {
|
environment = carbonEnv;
|
||||||
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-relay"}";
|
||||||
GRAPHITE_STORAGE_DIR = "${dataDir}";
|
|
||||||
};
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "${pkgs.pythonPackages.carbon}/bin/carbon-relay.py --pidfile /tmp/carbonRelay.pid start";
|
|
||||||
User = "graphite";
|
|
||||||
Group = "graphite";
|
|
||||||
};
|
|
||||||
restartTriggers = [
|
restartTriggers = [
|
||||||
pkgs.pythonPackages.carbon cfg.carbon.config cfg.carbon.relayRules
|
pkgs.pythonPackages.carbon cfg.carbon.config cfg.carbon.relayRules
|
||||||
];
|
];
|
||||||
@ -225,7 +215,7 @@ in {
|
|||||||
PYTHONPATH = "${pkgs.python27Packages.graphite_web}/lib/python2.7/site-packages";
|
PYTHONPATH = "${pkgs.python27Packages.graphite_web}/lib/python2.7/site-packages";
|
||||||
DJANGO_SETTINGS_MODULE = "graphite.settings";
|
DJANGO_SETTINGS_MODULE = "graphite.settings";
|
||||||
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
||||||
GRAPHITE_STORAGE_DIR = "${dataDir}";
|
GRAPHITE_STORAGE_DIR = dataDir;
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
@ -264,7 +254,7 @@ in {
|
|||||||
name = "graphite";
|
name = "graphite";
|
||||||
uid = config.ids.uids.graphite;
|
uid = config.ids.uids.graphite;
|
||||||
description = "Graphite daemon user";
|
description = "Graphite daemon user";
|
||||||
home = "${dataDir}";
|
home = dataDir;
|
||||||
createHome = true;
|
createHome = true;
|
||||||
};
|
};
|
||||||
users.extraGroups.graphite.gid = config.ids.gids.graphite;
|
users.extraGroups.graphite.gid = config.ids.gids.graphite;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user