2015-12-16 10:59:26 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2019-07-19 14:04:45 +00:00
|
|
|
# hostname: graphite.shack
|
|
|
|
|
2015-12-16 10:59:26 +00:00
|
|
|
|
|
|
|
# graphite-web on port 8080
|
|
|
|
# carbon cache on port 2003 (tcp/udp)
|
2019-07-19 14:04:45 +00:00
|
|
|
let
|
|
|
|
port = 8080;
|
|
|
|
in {
|
|
|
|
networking.firewall.allowedTCPPorts = [ 2003 port ];
|
|
|
|
networking.firewall.allowedUDPPorts = [ 2003 ];
|
|
|
|
services.nginx.virtualHosts."graphite.shack" = {
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://localhost:${toString port}/";
|
|
|
|
};
|
|
|
|
};
|
2015-12-16 10:59:26 +00:00
|
|
|
services.graphite = {
|
2017-06-09 11:53:30 +00:00
|
|
|
api = {
|
2019-07-19 14:04:45 +00:00
|
|
|
inherit port;
|
2015-12-16 10:59:26 +00:00
|
|
|
enable = true;
|
2016-10-19 16:33:42 +00:00
|
|
|
listenAddress = "0.0.0.0";
|
2015-12-16 10:59:26 +00:00
|
|
|
};
|
|
|
|
carbon = {
|
|
|
|
enableCache = true;
|
|
|
|
# save disk usage by restricting to 1 bulk update per second
|
|
|
|
config = ''
|
|
|
|
[cache]
|
|
|
|
MAX_CACHE_SIZE = inf
|
|
|
|
MAX_UPDATES_PER_SECOND = 1
|
|
|
|
MAX_CREATES_PER_MINUTE = 50
|
2017-06-01 08:13:31 +00:00
|
|
|
MAX_UPDATES_PER_SECOND_ONSHUTDOWN = 9001
|
2017-06-09 11:53:30 +00:00
|
|
|
|
|
|
|
LOG_CACHE_HITS = False
|
|
|
|
LOG_CACHE_QUEUE_SORTS = False
|
|
|
|
LOG_UPDATES = False
|
|
|
|
LOG_LISTENER_CONNECTIONS = False
|
|
|
|
LOG_CREATES = True
|
2015-12-16 10:59:26 +00:00
|
|
|
'';
|
2017-06-09 11:53:30 +00:00
|
|
|
storageAggregation = ''
|
|
|
|
'';
|
2015-12-16 10:59:26 +00:00
|
|
|
storageSchemas = ''
|
|
|
|
[carbon]
|
|
|
|
pattern = ^carbon\.
|
|
|
|
retentions = 60:90d
|
|
|
|
|
2017-06-01 08:13:31 +00:00
|
|
|
|
|
|
|
[radiation_sensor]
|
|
|
|
pattern = ^sensors\.radiation\.
|
|
|
|
retentions = 1m:30d,5m:180d,10m:3y
|
|
|
|
|
|
|
|
[motion_sensors]
|
|
|
|
pattern = ^sensors\.motion\.
|
|
|
|
retentions = 1s:1h,60s:30d,300s:1y
|
|
|
|
|
|
|
|
[motion_sensors]
|
|
|
|
pattern = ^retiolum\.
|
|
|
|
retentions = 10s:1h,30s:30d,300s:1y
|
|
|
|
|
|
|
|
[homeassistant]
|
|
|
|
pattern = ^homeassistant\.
|
|
|
|
retentions = 10s:24h,30s:30d,300s:1y,3600s:5y
|
|
|
|
|
|
|
|
[ara]
|
|
|
|
pattern = ^ara\.
|
|
|
|
retentions = 60s:30d,300s:1y
|
|
|
|
|
|
|
|
[openweathermap]
|
|
|
|
pattern = ^weather\.openweathermap
|
|
|
|
retentions = 30m:30d,1h:5y
|
|
|
|
|
|
|
|
[stadtklima]
|
|
|
|
pattern = ^weather\.stadtklima-stuttgart
|
|
|
|
retentions = 15m:30d,30m:5y
|
|
|
|
|
|
|
|
[sensebox]
|
|
|
|
pattern = ^weather\.sensebox
|
|
|
|
retentions = 1m:90d,30m:5y
|
|
|
|
|
|
|
|
[elchos]
|
|
|
|
pattern = ^elchos\.
|
|
|
|
retentions = 10s:14d,1m:90d,10m:5y
|
|
|
|
|
2017-06-09 11:53:30 +00:00
|
|
|
[icinga_default]
|
|
|
|
pattern = ^icinga
|
|
|
|
retentions = 10s:14d,5m:90d,10m:5y
|
|
|
|
|
|
|
|
[icinga_internals]
|
|
|
|
pattern = ^icinga.*\.(max_check_attempts|reachable|current_attempt|execution_time|latency|state|state_type)
|
|
|
|
retentions = 5m:7d
|
|
|
|
|
2015-12-16 10:59:26 +00:00
|
|
|
[default]
|
|
|
|
pattern = .*
|
|
|
|
retentions = 60s:30d,300s:1y
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2017-06-09 11:53:30 +00:00
|
|
|
systemd.services.carbonCache.serviceConfig.Restart="always";
|
|
|
|
systemd.services.graphiteApi.serviceConfig.Restart="always";
|
2015-12-16 10:59:26 +00:00
|
|
|
}
|