summaryrefslogtreecommitdiffstats
path: root/lass/1systems/mors.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-12-28 03:40:28 +0100
committermakefu <github@syntax-fehler.de>2016-12-28 03:40:28 +0100
commitc422632d0370f15d4f0b0a5ce35e79a90e49740c (patch)
treeba271e34c75085970889d62dfc76e12b4c5a1374 /lass/1systems/mors.nix
parent096d83fe893f5134be957bf6dfe3da99e038e8a5 (diff)
parent0d61093e18929e48ebfd984c1e0f2b6b1f0c6c58 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/1systems/mors.nix')
-rw-r--r--lass/1systems/mors.nix150
1 files changed, 137 insertions, 13 deletions
diff --git a/lass/1systems/mors.nix b/lass/1systems/mors.nix
index 4553cc15b..3498f662b 100644
--- a/lass/1systems/mors.nix
+++ b/lass/1systems/mors.nix
@@ -17,7 +17,6 @@ with import <stockholm/lib>;
../2configs/steam.nix
../2configs/wine.nix
../2configs/git.nix
- ../2configs/skype.nix
../2configs/libvirt.nix
../2configs/fetchWallpaper.nix
#../2configs/c-base.nix
@@ -66,20 +65,18 @@ with import <stockholm/lib>;
};
}
{
- krebs.nginx = {
+ services.nginx = {
enable = true;
- servers.default = {
- server-names = [
+ virtualHosts.default = {
+ serverAliases = [
"localhost"
"${config.krebs.build.host.name}"
"${config.krebs.build.host.name}.r"
"${config.krebs.build.host.name}.retiolum"
];
- locations = [
- (nameValuePair "~ ^/~(.+?)(/.*)?\$" ''
- alias /home/$1/public_html$2;
- '')
- ];
+ locations."~ ^/~(.+?)(/.*)?\$".extraConfig = ''
+ alias /home/$1/public_html$2;
+ '';
};
};
}
@@ -89,6 +86,137 @@ with import <stockholm/lib>;
{
virtualisation.libvirtd.enable = true;
}
+ {
+ services.nginx = {
+ enable = mkDefault true;
+ virtualHosts = {
+ "stats.mors" = {
+ 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;
+ '';
+ };
+ };
+ };
+ };
+ };
+
+ services.grafana = {
+ enable = true;
+ addr = "127.0.0.1";
+ users.allowSignUp = false;
+ users.allowOrgCreate = false;
+ users.autoAssignOrg = false;
+ auth.anonymous.enable = true;
+ security = import <secrets/grafana_security.nix>; # { AdminUser = ""; adminPassword = ""}
+ };
+
+ services.graphite = {
+ api = {
+ enable = true;
+ listenAddress = "127.0.0.1";
+ port = 18080;
+ };
+ 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\.
+ retentions = 10s:30d,60s:3y
+
+ [default]
+ pattern = .*
+ retentions = 30s:30d,300s:1y
+ '';
+ };
+ };
+
+ services.collectd = {
+ enable = true;
+ include = [ (toString (pkgs.writeText "collectd-graphite-cfg" ''
+ LoadPlugin write_graphite
+ <Plugin "write_graphite">
+ <Carbon>
+ Host "localhost"
+ Port "2003"
+ EscapeCharacter "_"
+ StoreRates false
+ AlwaysAppendDS false
+ </Carbon>
+ </Plugin>
+ ''))
+ ];
+ extraConfig = ''
+ LoadPlugin interface
+ LoadPlugin battery
+ LoadPlugin load
+ LoadPlugin cpu
+ LoadPlugin entropy
+ LoadPlugin write_graphite
+ <Plugin "interface">
+ Interface "et0"
+ Interface "wl0"
+ Interface "retiolum"
+ </Plugin>
+ '';
+ };
+ services.graphite.beacon = {
+ enable = true;
+ config = {
+ graphite_url = "http://localhost:18080";
+ cli = {
+ command = ''${pkgs.irc-announce}/bin/irc-announce irc.freenode.org 6667 mors-beacon-alert \#krebs ' ''${level} ''${name} ''${value}' '';
+ };
+ smtp = {
+ from = "beacon@mors.r";
+ to = [
+ "lass@mors.r"
+ ];
+ };
+ normal_handlers = [
+ "smtp"
+ "cli"
+ ];
+ warning_handlers = [
+ "smtp"
+ "cli"
+ ];
+ critical_handlers = [
+ "smtp"
+ "cli"
+ ];
+ alerts = [
+ {
+ name = "testbattery";
+ query = "*.battery-0.capacity";
+ method = "last_value";
+ interval = "1minute";
+ logging = "info";
+ repeat_interval = "5minute";
+ rules = [
+ "warning: < 30.0"
+ "critical: < 10.0"
+ ];
+ }
+ ];
+ };
+ };
+ }
];
krebs.build.host = config.krebs.hosts.mors;
@@ -238,8 +366,4 @@ with import <stockholm/lib>;
krebs.repo-sync.timerConfig = {
OnCalendar = "00:37";
};
-
- services.mongodb = {
- enable = true;
- };
}