Skip to content

Commit fe283c4

Browse files
committed
add extra dashboards
1 parent 791f33d commit fe283c4

File tree

5 files changed

+10136
-11
lines changed

5 files changed

+10136
-11
lines changed

modules/nixos/gateway.nix

Lines changed: 68 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
config,
3-
lib,
43
...
54
}:
65
let
@@ -102,6 +101,10 @@ in
102101
access_control = {
103102
default_policy = "deny";
104103
rules = [
104+
{
105+
domain = "auth.kclj.io";
106+
policy = "one_factor";
107+
}
105108
{
106109
domain = "*.kclj.io";
107110
policy = "two_factor";
@@ -419,6 +422,24 @@ in
419422
}
420423
'';
421424

425+
# Node exporter - system metrics
426+
services.prometheus.exporters.node = {
427+
enable = true;
428+
listenAddress = "127.0.0.1";
429+
enabledCollectors = [
430+
"cpu"
431+
"diskstats"
432+
"filesystem"
433+
"loadavg"
434+
"meminfo"
435+
"netdev"
436+
"stat"
437+
"time"
438+
"uname"
439+
"systemd"
440+
];
441+
};
442+
422443
# Prometheus - metrics scraping
423444
services.prometheus = {
424445
enable = true;
@@ -430,6 +451,16 @@ in
430451
job_name = "authelia";
431452
static_configs = [ { targets = [ "127.0.0.1:9959" ]; } ];
432453
}
454+
{
455+
job_name = "node";
456+
static_configs = [
457+
{ targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; }
458+
];
459+
}
460+
{
461+
job_name = "cloudflared";
462+
static_configs = [ { targets = [ "127.0.0.1:2000" ]; } ];
463+
}
433464
];
434465
};
435466

@@ -456,17 +487,43 @@ in
456487
};
457488
};
458489
provision = {
459-
datasources.settings.datasources = [
460-
{
461-
name = "Loki";
462-
type = "loki";
463-
url = "http://127.0.0.1:${toString lokiPort}";
464-
isDefault = true;
465-
}
490+
datasources.settings = {
491+
apiVersion = 1;
492+
datasources = [
493+
{
494+
name = "Loki";
495+
type = "loki";
496+
uid = "loki";
497+
access = "proxy";
498+
url = "http://127.0.0.1:${toString lokiPort}";
499+
isDefault = true;
500+
jsonData = { };
501+
}
502+
{
503+
name = "Prometheus";
504+
type = "prometheus";
505+
uid = "prometheus";
506+
access = "proxy";
507+
url = "http://127.0.0.1:${toString prometheusPort}";
508+
jsonData = { };
509+
}
510+
];
511+
deleteDatasources = [
512+
{
513+
name = "Loki";
514+
orgId = 1;
515+
}
516+
{
517+
name = "Prometheus";
518+
orgId = 1;
519+
}
520+
];
521+
};
522+
dashboards.settings.providers = [
466523
{
467-
name = "Prometheus";
468-
type = "prometheus";
469-
url = "http://127.0.0.1:${toString prometheusPort}";
524+
name = "default";
525+
options.path = ./grafana-dashboards;
526+
disableDeletion = true;
470527
}
471528
];
472529
};

0 commit comments

Comments
 (0)