This repository has no description
0

Configure Feed

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

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