Skip to content

Commit

Permalink
add prometheus + grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
AtaraxiaSjel committed Feb 15, 2024
1 parent ebe0570 commit dcda3b2
Show file tree
Hide file tree
Showing 9 changed files with 2,328 additions and 70 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion machines/Home-Hypervisor/default.nix
Expand Up @@ -21,8 +21,8 @@ in {
customProfiles.hoyolab
customProfiles.inpx-web
customProfiles.it-tools
# customProfiles.joplin-server
customProfiles.media-stack
customProfiles.metrics
customProfiles.minio
customProfiles.nginx
customProfiles.ocis
Expand Down
6 changes: 3 additions & 3 deletions machines/Home-Hypervisor/dns-mapping.nix
Expand Up @@ -25,7 +25,7 @@
{ name = "restic.ataraxiadev.com"; type = "A"; value = "100.64.0.3"; }
{ name = "s3.ataraxiadev.com"; type = "A"; value = "100.64.0.3"; }
{ name = "sonarr.ataraxiadev.com"; type = "A"; value = "100.64.0.3"; }
{ name = "stats.ataraxiadev.com"; type = "A"; value = "100.64.0.1"; }
{ name = "stats.ataraxiadev.com"; type = "A"; value = "100.64.0.3"; }
{ name = "tools.ataraxiadev.com"; type = "A"; value = "100.64.0.3"; }
{ name = "turn.ataraxiadev.com"; type = "A"; value = "100.64.0.1"; }
{ name = "vault.ataraxiadev.com"; type = "A"; value = "100.64.0.3"; }
Expand Down Expand Up @@ -57,7 +57,7 @@
{ name = "restic.ataraxiadev.com"; type = "AAAA"; value = "fd7a:115c:a1e0::3"; }
{ name = "s3.ataraxiadev.com"; type = "AAAA"; value = "fd7a:115c:a1e0::3"; }
{ name = "sonarr.ataraxiadev.com"; type = "AAAA"; value = "fd7a:115c:a1e0::3"; }
{ name = "stats.ataraxiadev.com"; type = "AAAA"; value = "fd7a:115c:a1e0::1"; }
{ name = "stats.ataraxiadev.com"; type = "AAAA"; value = "fd7a:115c:a1e0::3"; }
{ name = "tools.ataraxiadev.com"; type = "AAAA"; value = "fd7a:115c:a1e0::3"; }
{ name = "turn.ataraxiadev.com"; type = "AAAA"; value = "fd7a:115c:a1e0::1"; }
{ name = "vault.ataraxiadev.com"; type = "AAAA"; value = "fd7a:115c:a1e0::3"; }
Expand All @@ -68,7 +68,6 @@
# TODO: Fix dns resolution in blocky for unmapped subdomains of ataraxiadev.com
"/element.ataraxiadev.com/83.138.55.118"
"/matrix.ataraxiadev.com/83.138.55.118"
"/stats.ataraxiadev.com/83.138.55.118"
"/turn.ataraxiadev.com/83.138.55.118"

"/api.ataraxiadev.com/192.168.0.10"
Expand All @@ -92,6 +91,7 @@
"/radarr.ataraxiadev.com/192.168.0.10"
"/restic.ataraxiadev.com/192.168.0.10"
"/s3.ataraxiadev.com/192.168.0.10"
"/stats.ataraxiadev.com/192.168.0.10"
"/sonarr.ataraxiadev.com/192.168.0.10"
"/tools.ataraxiadev.com/192.168.0.10"
"/vault.ataraxiadev.com/192.168.0.10"
Expand Down
65 changes: 2 additions & 63 deletions profiles/servers/blocky.nix
Expand Up @@ -19,7 +19,6 @@ in {
bindMounts."/tmp/blocky-authkey".hostPath = "/tmp/blocky-authkey";
config = { config, lib, ... }:
let
grafanaPort = config.services.grafana.settings.server.http_port;
blockyPort = config.services.blocky.settings.ports.dns;
blockyHttpPort = config.services.blocky.settings.ports.http;
in {
Expand All @@ -31,7 +30,7 @@ in {
useHostResolvConf = false;
firewall = {
enable = true;
allowedTCPPorts = [ blockyPort grafanaPort ];
allowedTCPPorts = [ blockyPort blockyHttpPort ];
allowedUDPPorts = [ blockyPort ];
};
hosts = {
Expand Down Expand Up @@ -94,72 +93,12 @@ in {
};
ports = {
dns = 53;
http = "127.0.0.1:4000";
http = 4000;
};
prometheus.enable = true;
queryLog.type = "console";
};
};
services.prometheus = {
enable = true;
listenAddress = "127.0.0.1";
globalConfig.scrape_interval = "15s";
globalConfig.evaluation_interval = "15s";
scrapeConfigs = [{
job_name = "blocky";
static_configs = [{
targets = [ blockyHttpPort ];
}];
}];
};
services.grafana = {
enable = true;
settings = {
analytics.reporting_enabled = false;
server = {
domain = "${nodeAddress}:${toString grafanaPort}";
http_addr = nodeAddress;
enable_gzip = true;
};
panels.disable_sanitize_html = true;
};
provision = {
enable = true;
datasources.settings = {
datasources = [{
name = "Prometheus";
type = "prometheus";
access = "proxy";
orgId = 1;
uid = "Y4SSG429DWCGDQ3R";
url = "http://127.0.0.1:${toString config.services.prometheus.port}";
isDefault = true;
jsonData = {
graphiteVersion = "1.1";
tlsAuth = false;
tlsAuthWithCACert = false;
};
version = 1;
editable = true;
}];
};
dashboards = {
settings = {
providers = [{
name = "My Dashboards";
options.path = "/etc/grafana-dashboards";
}];
};
};
};
};
environment.etc = {
"grafana-dashboards/blocky_rev3.json" = {
source = ../../misc/grafana_blocky_rev3.json;
group = "grafana";
user = "grafana";
};
};
system.stateVersion = "23.11";
};
};
Expand Down

0 comments on commit dcda3b2

Please sign in to comment.