2016-10-19 10:17:04 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2016-12-24 22:42:19 +00:00
|
|
|
# requires nsupdate to get correct hostname (from ./search.nix)
|
2016-10-19 10:17:04 +00:00
|
|
|
# graphite-web on port 8080
|
|
|
|
# carbon cache on port 2003 (tcp/udp)
|
2016-12-24 22:42:19 +00:00
|
|
|
|
2016-10-20 18:54:38 +00:00
|
|
|
with import <stockholm/lib>;
|
2016-12-24 22:42:19 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
virtualHosts = {
|
|
|
|
"stats.nsupdate.info" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
|
|
|
locations = {
|
|
|
|
"/" = {
|
|
|
|
proxyPass = "http://localhost:3000/";
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2016-10-19 10:17:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.grafana = {
|
|
|
|
enable = true;
|
|
|
|
addr = "127.0.0.1";
|
|
|
|
users.allowSignUp = false;
|
|
|
|
users.allowOrgCreate = false;
|
|
|
|
users.autoAssignOrg = false;
|
2016-12-24 22:42:19 +00:00
|
|
|
auth.anonymous.enable = true;
|
2016-10-19 10:17:04 +00:00
|
|
|
security = import <secrets/grafana_security.nix>; # { AdminUser = ""; adminPassword = ""}
|
|
|
|
};
|
|
|
|
|
|
|
|
services.graphite = {
|
2016-12-24 22:42:19 +00:00
|
|
|
api = {
|
2016-10-19 10:17:04 +00:00
|
|
|
enable = true;
|
2016-12-24 22:42:19 +00:00
|
|
|
listenAddress = "127.0.0.1";
|
|
|
|
port = 18080;
|
2016-10-19 10:17:04 +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 = 500
|
|
|
|
'';
|
|
|
|
storageSchemas = ''
|
|
|
|
[carbon]
|
|
|
|
pattern = ^carbon\.
|
|
|
|
retentions = 60:90d
|
|
|
|
|
|
|
|
[elchos]
|
|
|
|
patterhn = ^elchos\.
|
2016-12-24 22:42:19 +00:00
|
|
|
retentions = 10s:30d,60s:3y
|
2016-10-19 10:17:04 +00:00
|
|
|
|
|
|
|
[default]
|
|
|
|
pattern = .*
|
|
|
|
retentions = 30s:30d,300s:1y
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2016-12-24 22:42:19 +00:00
|
|
|
|
|
|
|
networking.firewall = {
|
|
|
|
allowedTCPPorts = [ 2003 80 443 ];
|
|
|
|
allowedUDPPorts = [ 2003 ];
|
|
|
|
};
|
2016-10-19 10:17:04 +00:00
|
|
|
}
|