This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / 2configs / monitoring / prometheus.nix
2.8 kB 110 lines
1{ config, lib, pkgs, ... }: 2{ 3 #prometheus 4 krebs.iptables = { 5 enable = true; 6 tables.filter.INPUT.rules = [ 7 { predicate = "-i retiolum -p tcp --dport 80"; target = "ACCEPT"; } # nginx 8 # { predicate = "-i retiolum -p tcp --dport 3012"; target = "ACCEPT"; } # grafana 9 # { predicate = "-i retiolum -p tcp --dport 9093"; target = "ACCEPT"; } # alertmanager 10 # { predicate = "-i retiolum -p tcp --dport 9223"; target = "ACCEPT"; } # alertmanager 11 ]; 12 }; 13 14 services.nginx = { 15 enable = true; 16 virtualHosts = { 17 "prometheus.lass.r" = { 18 locations."/".proxyPass = "http://localhost:9090"; 19 }; 20 "alert.lass.r" = { 21 locations."/".proxyPass = "http://localhost:9093"; 22 }; 23 "grafana.lass.r" = { 24 locations."/".proxyPass = "http://localhost:3012"; 25 }; 26 }; 27 }; 28 29 services.grafana = { 30 enable = true; 31 addr = "0.0.0.0"; 32 port = 3012; 33 auth.anonymous = { 34 enable = true; 35 org_role = "Admin"; 36 }; 37 }; 38 services.prometheus = { 39 enable = true; 40 ruleFiles = [ 41 (pkgs.writeText "prometheus-rules.yml" (builtins.toJSON { 42 groups = [{ 43 name = "alerting-rules"; 44 rules = import ./alert-rules.nix { inherit lib; }; 45 }]; 46 })) 47 ]; 48 scrapeConfigs = [ 49 { 50 job_name = "telegraf"; 51 scrape_interval = "60s"; 52 metrics_path = "/metrics"; 53 static_configs = [ 54 { 55 targets = [ 56 "prism.r:9273" 57 "dishfire.r:9273" 58 "yellow.r:9273" 59 ]; 60 } 61 ]; 62 } 63 ]; 64 alertmanagers = [ 65 { scheme = "http"; 66 path_prefix = "/"; 67 static_configs = [ { targets = [ "localhost:9093" ]; } ]; 68 } 69 ]; 70 alertmanager = { 71 enable = true; 72 webExternalUrl = "https://alert.lass.r"; 73 listenAddress = "[::1]"; 74 configuration = { 75 global = { 76 # The smarthost and SMTP sender used for mail notifications. 77 smtp_smarthost = "localhost:587"; 78 smtp_from = "alertmanager@alert.lass.r"; 79 # smtp_auth_username = "alertmanager@thalheim.io"; 80 # smtp_auth_password = "$SMTP_PASSWORD"; 81 }; 82 route = { 83 receiver = "default"; 84 routes = [ 85 { 86 group_by = [ "host" ]; 87 group_wait = "30s"; 88 group_interval = "2m"; 89 repeat_interval = "2h"; 90 receiver = "all"; 91 } 92 ]; 93 }; 94 receivers = [ 95 { 96 name = "all"; 97 webhook_configs = [{ 98 url = "http://127.0.0.1:9223/"; 99 max_alerts = 5; 100 }]; 101 } 102 { 103 name = "default"; 104 } 105 ]; 106 }; 107 }; 108 }; 109 110}