mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-11 07:15:54 +03:00
nixos/graphite: carbon, use syslog for logging
Twisted provides option to log with syslog, this enables nicer logging. Imagine what happens in a case of exception. If logs are written to stdout, traceback won't be merged thus giving ugly logs. This commit fixes that. This is also one of the official ways of starting carbon, so no worries.
This commit is contained in:
parent
c51e6c75a6
commit
63539b2844
@ -5,7 +5,18 @@ with pkgs.lib;
|
||||
let
|
||||
cfg = config.services.graphite;
|
||||
writeTextOrNull = f: t: if t == null then null else pkgs.writeText f t;
|
||||
|
||||
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 {
|
||||
|
||||
###### interface
|
||||
@ -52,7 +63,7 @@ in {
|
||||
[all_min]
|
||||
pattern = \.min$
|
||||
xFilesFactor = 0.1
|
||||
aggregationMethod = min
|
||||
aggregationMethod = min
|
||||
'';
|
||||
};
|
||||
|
||||
@ -153,15 +164,8 @@ in {
|
||||
description = "Graphite data storage backend";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-interfaces.target" ];
|
||||
environment = {
|
||||
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
||||
GRAPHITE_STORAGE_DIR = "/var/db/graphite/";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.pythonPackages.carbon}/bin/carbon-cache.py --pidfile /tmp/carbonCache.pid start";
|
||||
User = "graphite";
|
||||
Group = "graphite";
|
||||
};
|
||||
environment = carbonEnv;
|
||||
serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-cache"}";
|
||||
restartTriggers = [
|
||||
pkgs.pythonPackages.carbon
|
||||
cfg.carbon.config
|
||||
@ -178,15 +182,8 @@ in {
|
||||
description = "Carbon data aggregator";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-interfaces.target" ];
|
||||
environment = {
|
||||
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
||||
GRAPHITE_STORAGE_DIR = "${dataDir}";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.pythonPackages.carbon}/bin/carbon-aggregator.py --pidfile /tmp/carbonAggregator.pid start";
|
||||
User = "graphite";
|
||||
Group = "graphite";
|
||||
};
|
||||
environment = carbonEnv;
|
||||
serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-aggregator"}";
|
||||
restartTriggers = [
|
||||
pkgs.pythonPackages.carbon cfg.carbon.config cfg.carbon.aggregationRules
|
||||
];
|
||||
@ -196,15 +193,8 @@ in {
|
||||
description = "Carbon data relay";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-interfaces.target" ];
|
||||
environment = {
|
||||
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
||||
GRAPHITE_STORAGE_DIR = "${dataDir}";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.pythonPackages.carbon}/bin/carbon-relay.py --pidfile /tmp/carbonRelay.pid start";
|
||||
User = "graphite";
|
||||
Group = "graphite";
|
||||
};
|
||||
environment = carbonEnv;
|
||||
serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-relay"}";
|
||||
restartTriggers = [
|
||||
pkgs.pythonPackages.carbon cfg.carbon.config cfg.carbon.relayRules
|
||||
];
|
||||
@ -218,7 +208,7 @@ in {
|
||||
PYTHONPATH = "${pkgs.python27Packages.graphite_web}/lib/python2.7/site-packages";
|
||||
DJANGO_SETTINGS_MODULE = "graphite.settings";
|
||||
GRAPHITE_CONF_DIR = "/etc/graphite/";
|
||||
GRAPHITE_STORAGE_DIR = "${dataDir}";
|
||||
GRAPHITE_STORAGE_DIR = dataDir;
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
@ -257,7 +247,7 @@ in {
|
||||
name = "graphite";
|
||||
uid = config.ids.uids.graphite;
|
||||
description = "Graphite daemon user";
|
||||
home = "${dataDir}";
|
||||
home = dataDir;
|
||||
createHome = true;
|
||||
};
|
||||
users.extraGroups.graphite.gid = config.ids.gids.graphite;
|
||||
|
Loading…
Reference in New Issue
Block a user