1
0
mirror of https://github.com/kmein/niveum synced 2026-03-23 05:11:08 +01:00

5 Commits

7 changed files with 20 additions and 23 deletions

2
ci.nix
View File

@@ -38,7 +38,7 @@ let
"spotify/password" "spotify/password"
]; ];
systemSecrets = let basic = [ "retiolum.ed25519" "retiolum.key" "syncthing/cert.pem" "syncthing/key.pem"]; in { systemSecrets = let basic = [ "retiolum.ed25519" "retiolum.key" "syncthing/cert.pem" "syncthing/key.pem"]; in {
zaatar = ensureFiles ([ "moodle.token" "telegram/moodle-dl.token" ] ++ basic); zaatar = ensureFiles ([ "moodle.token" "telegram/moodle-dl.token" "mpd-web.key" ] ++ basic);
kabsa = ensureFiles basic; kabsa = ensureFiles basic;
manakish = ensureFiles basic; manakish = ensureFiles basic;
makanek = ensureFiles ([ makanek = ensureFiles ([

View File

@@ -18,7 +18,6 @@ in {
"x-systemd.device-timeout=1" "x-systemd.device-timeout=1"
"x-systemd.idle-timeout=1min" "x-systemd.idle-timeout=1min"
"x-systemd.requires=tinc.retiolum.service" "x-systemd.requires=tinc.retiolum.service"
"x-systemd.requires=wpa_supplicant.service"
"user" "user"
"_netdev" "_netdev"
]; ];

6
flake.lock generated
View File

@@ -158,11 +158,11 @@
"retiolum": { "retiolum": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1643137996, "lastModified": 1643369411,
"narHash": "sha256-Fvmq2i8l9drzU91uvHmx0eeqr06/o+y28RgVmwcTYZ4=", "narHash": "sha256-FRfEQdRJxVF6w41jgjQXDtK5YxIjDh5S4acA0FbwPyE=",
"owner": "krebs", "owner": "krebs",
"repo": "retiolum", "repo": "retiolum",
"rev": "bbed4ffd74987bb9a577ae6290ed446c3f27f594", "rev": "23e04565a0360d31605a6c6cdc1becb5b9f76f32",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -6,7 +6,7 @@ let
importJSON = path: builtins.fromJSON (builtins.readFile path); importJSON = path: builtins.fromJSON (builtins.readFile path);
di-fm-name = name: "${name} | DI.FM"; di-fm-name = name: "${name} | DI.FM";
di-fm = name: "http://prem2.di.fm/${name}_hi?${di-fm-key}"; di-fm = name: "http://prem3.di.fm/${name}_hi?${di-fm-key}";
soma-fm-name = name: "${name} | soma.fm"; soma-fm-name = name: "${name} | soma.fm";
soma-fm = name: "http://ice1.somafm.com/${name}-128-aac"; soma-fm = name: "http://ice1.somafm.com/${name}-128-aac";

View File

@@ -27,7 +27,7 @@ in
alert = "ServiceDown"; alert = "ServiceDown";
expr = ''node_systemd_unit_state{state="failed"} == 1''; expr = ''node_systemd_unit_state{state="failed"} == 1'';
annotations = { annotations = {
summary = "{{$labels.job}}: Service {{$labels.name}} failed to start."; summary = "{{$labels.name}} failed on {{$labels.job}}";
}; };
} }
{ {
@@ -35,8 +35,7 @@ in
for = "10m"; for = "10m";
expr = ''(node_filesystem_free_bytes{mountpoint="/"} * 100) / node_filesystem_size_bytes{mountpoint="/"} < ${toString diskFreeThreshold}''; expr = ''(node_filesystem_free_bytes{mountpoint="/"} * 100) / node_filesystem_size_bytes{mountpoint="/"} < ${toString diskFreeThreshold}'';
annotations = { annotations = {
summary = "{{ $labels.job }}: Filesystem is running out of space soon."; summary = ''{{ $labels.job }} running out of space: {{ $value | printf "%.2f" }}% < ${toString diskFreeThreshold}%'';
description = ''The root disk of {{ $labels.job }} has {{ $value | printf "%.2f" }}% free disk space (threshold at ${toString diskFreeThreshold}%).'';
}; };
} }
{ {
@@ -45,7 +44,7 @@ in
expr = ''node_filesystem_free_bytes{mountpoint="/"} '' expr = ''node_filesystem_free_bytes{mountpoint="/"} ''
+ ''and predict_linear(node_filesystem_free_bytes{mountpoint="/"}[2d], 7*24*3600) <= 0''; + ''and predict_linear(node_filesystem_free_bytes{mountpoint="/"}[2d], 7*24*3600) <= 0'';
annotations = { annotations = {
summary = "{{$labels.job}}: Filesystem is running out of space in 7 days."; summary = "{{$labels.job}} running out of space in 7 days";
}; };
} }
{ {
@@ -53,62 +52,62 @@ in
expr = ''node_load15 / on(job) count(node_cpu_seconds_total{mode="system"}) by (job) >= 1.0''; expr = ''node_load15 / on(job) count(node_cpu_seconds_total{mode="system"}) by (job) >= 1.0'';
for = "10m"; for = "10m";
annotations = { annotations = {
summary = "{{$labels.job}}: Running on high load: {{$value}}"; summary = "{{$labels.job}} running on high load: {{$value}}";
}; };
} }
{ {
alert = "HighRAM"; alert = "HighRAM";
expr = "node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes < node_memory_MemTotal_bytes * 0.1"; expr = "node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes < node_memory_MemTotal_bytes * 0.1";
for = "1h"; for = "1h";
annotations.summary = "{{$labels.job}}: Using lots of RAM."; annotations.summary = "{{$labels.job}} using lots of RAM";
} }
{ {
alert = "UptimeMonster"; alert = "UptimeMonster";
expr = "time() - node_boot_time_seconds > 2592000"; expr = "time() - node_boot_time_seconds > 2592000";
annotations.summary = "{{$labels.job}}: up for more than 30 days."; annotations.summary = "uptime monster {{$labels.job}} up for more than 30 days";
} }
{ {
alert = "HostDown"; alert = "HostDown";
expr = ''up == 0''; expr = ''up == 0'';
for = "5m"; for = "5m";
annotations = { annotations = {
summary = "Host {{ $labels.job }} down for 5 minutes."; summary = "{{ $labels.job }} seeming down since 5 minutes";
}; };
} }
{ {
alert = "Reboot"; alert = "Reboot";
expr = "time() - node_boot_time_seconds < 300"; expr = "time() - node_boot_time_seconds < 300";
annotations.summary = "{{$labels.job}}: Reboot"; annotations.summary = "{{$labels.job}} rebooted";
} }
{ {
alert = "ProbeFailed"; alert = "ProbeFailed";
expr = "probe_success == 0"; expr = "probe_success == 0";
for = "5m"; for = "5m";
annotations.summary = "{{$labels.instance}}: probe failed"; annotations.summary = "HTTP probe failed for {{$labels.instance}}";
} }
{ {
alert = "SlowProbe"; alert = "SlowProbe";
expr = "avg_over_time(probe_http_duration_seconds[1m]) > 1"; expr = "avg_over_time(probe_http_duration_seconds[1m]) > 1";
for = "5m"; for = "5m";
annotations.summary = "{{$labels.instance}}: HTTP probe slow"; annotations.summary = "HTTP probe slow for {{$labels.instance}}";
} }
{ {
alert = "HttpStatusCode"; alert = "HttpStatusCode";
expr = "probe_http_status_code != 0 AND (probe_http_status_code <= 199 OR probe_http_status_code >= 400)"; expr = "probe_http_status_code != 0 AND (probe_http_status_code <= 199 OR probe_http_status_code >= 400)";
for = "5m"; for = "5m";
annotations.summary = "{{$labels.instance}}: status code {{$value}}"; annotations.summary = "status code {{$value}} for {{$labels.instance}}";
} }
{ {
alert = "SslExpirySoon"; alert = "SslExpirySoon";
expr = "probe_ssl_earliest_cert_expiry - time() < 86400 * 30"; expr = "probe_ssl_earliest_cert_expiry - time() < 86400 * 30";
for = "5m"; for = "5m";
annotations.summary = "{{$labels.instance}}: SSL certificate expires in 30 days"; annotations.summary = "SSL certificate for {{$labels.instance}} expires in 30 days";
} }
{ {
alert = "SslExpiry"; alert = "SslExpiry";
expr = "probe_ssl_earliest_cert_expiry - time() <= 0"; expr = "probe_ssl_earliest_cert_expiry - time() <= 0";
for = "5m"; for = "5m";
annotations.summary = "{{$labels.instance}}: SSL certificate has expired"; annotations.summary = "SSL certificate for {{$labels.instance}} has expired";
} }
]; ];
}]; }];

View File

@@ -10,7 +10,7 @@
user = config.users.extraUsers.kiosk.name; user = config.users.extraUsers.kiosk.name;
extraArguments = [ "-s" ]; # allow vt switching extraArguments = [ "-s" ]; # allow vt switching
program = program =
let startUrls = [ "https://open.spotify.com" "https://youtube.com" "http://bvg.kmein.r" ]; let startUrls = [ "https://youtube.com" "http://radio.kmein.r" ];
in pkgs.writers.writeDash "kiosk-browser" '' in pkgs.writers.writeDash "kiosk-browser" ''
while true; do while true; do
${pkgs.brave}/bin/brave \ ${pkgs.brave}/bin/brave \

View File

@@ -81,6 +81,7 @@ in
stations = lib.lists.imap0 (id: {desc ? "", logo ? "https://picsum.photos/seed/${builtins.hashString "md5" stream}/300", stream, station}: { inherit id desc logo stream station; }) streams; stations = lib.lists.imap0 (id: {desc ? "", logo ? "https://picsum.photos/seed/${builtins.hashString "md5" stream}/300", stream, station}: { inherit id desc logo stream station; }) streams;
stationsJson = (pkgs.formats.json {}).generate "stations.json" stations; stationsJson = (pkgs.formats.json {}).generate "stations.json" stations;
in { in {
enable = false;
wantedBy = [ "tuna.service" ]; wantedBy = [ "tuna.service" ];
startAt = "hourly"; startAt = "hourly";
script = '' script = ''
@@ -95,7 +96,6 @@ in
}; };
/*
services.nginx = { services.nginx = {
enable = true; enable = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
@@ -110,5 +110,4 @@ in
}; };
}; };
}; };
*/
} }