mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 01:44:40 +02:00
service/fritzbox: init
This commit is contained in:
parent
d23f5a0e40
commit
8827ca309e
6 changed files with 89 additions and 2 deletions
|
@ -26,6 +26,8 @@ prowlarr:
|
|||
apikey: ENC[AES256_GCM,data:5H3aZEaa7trPgwo7CKnryhMUdZ+UP+a9UBNbeLNHqxk=,iv:OE5/q4HRIhoB/ZK4ic2nC63t5nNyJi2AZsP4JYuxaW0=,tag:l5IFkGCmam+f3dFgKM1Rwg==,type:str]
|
||||
bazarr:
|
||||
apikey: ENC[AES256_GCM,data:242MsUAen1TWp967NoWifjuof41umtrpTKDRe2eeLyU=,iv:uvWaZmatQk71Q1Q7TQ4PLmjn1jYwKrrWLZ+xOjgl6eo=,tag:BFYP4uozPyAX9I8djfBESQ==,type:str]
|
||||
fritzbox:
|
||||
password: ENC[AES256_GCM,data:JGWuhP87ghn249eeaDBJNuuqOvl5AYTlfINxtbe5TSc=,iv:SQWvylQPZcnMXj/3/E3u8B3zwucr//kv7kPf1ACouaw=,tag:1BA4mvj+HemxJdQAQ0xBUQ==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
|
@ -50,8 +52,8 @@ sops:
|
|||
a1BjcjVaM01UV0o5bTFTVTE5QUZKMmsKPAGYDf1FVtp4+Z/KUrI6z0aZYEwN1DYa
|
||||
jKtA1IUXrmdaRllN0SfC+YjMXTk7IoJvrjagCv9Zo0zEKasfO8PL4g==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-10-22T19:49:45Z"
|
||||
mac: ENC[AES256_GCM,data:GPUfcCD0BhCHwirxqoTpaOYQJf5E+MZD5baEbZr/x8JqUnkCt7LSXGrd2/0OswOB+8Fg52Kk2X+UAW6Z79fM87a+UXrHvDm48l9dPsqwsd+fH/fdxB2D4GhfzdnbGXjL2qTi4dhuPRhDfyUmZHJSEfkRuxBuO/nNHwa/VNdoq/M=,iv:JSmSWdG3Al+3fZXFqCM+6H3cXDyopuvmEjURm/xsJAE=,tag:fW8rc2a0gA0CJO1SI3I7kA==,type:str]
|
||||
lastmodified: "2024-11-07T21:01:40Z"
|
||||
mac: ENC[AES256_GCM,data:EmiltUNVqdNaabw60HiSM+bxHZd+ni8h4V6e8/z19LMn1FYgRsZ5tXx+9SmceP77c9Ofp5CO+NsCg67MWtO8typo/WrPTfrpCa1sPThaRY5CzMaGizjx68X2H9/Iz7TClHe+ZbkD5fix1sgkAKdRTpF3KGPN42dJbHnEvPOR4ok=,iv:4lvS+vQFfn2dIqVhH9YgWRBkPzujgBOgSJXp/D/dZk8=,tag:cXU+Dy69VVztQuJGhotyAg==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
|
|
|
@ -12,6 +12,9 @@ in
|
|||
"dyndns/password" = {
|
||||
owner = config.users.users.inadyn.name;
|
||||
};
|
||||
"fritzbox/password" = {
|
||||
owner = config.users.users.fritz-exporter.name;
|
||||
};
|
||||
"prowlarr/apikey" = { };
|
||||
"radarr/apikey" = { };
|
||||
"sonarr/apikey" = { };
|
||||
|
@ -75,6 +78,10 @@ in
|
|||
jellyseerr = {
|
||||
enable = true;
|
||||
};
|
||||
fritzbox = {
|
||||
enable = true;
|
||||
passwordFile = secrets."fritzbox/password".path;
|
||||
};
|
||||
# Dashboard
|
||||
homer = {
|
||||
enable = true;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
./blocky
|
||||
./dyndns
|
||||
./freshrss
|
||||
./fritzbox
|
||||
./gitea
|
||||
./grafana
|
||||
./hedgedoc
|
||||
|
|
70
modules/services/fritzbox/default.nix
Normal file
70
modules/services/fritzbox/default.nix
Normal file
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.services.fritzbox;
|
||||
in
|
||||
{
|
||||
options.my.services.fritzbox = with lib; {
|
||||
enable = mkEnableOption "Fritzbox-Monitoring";
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 9787;
|
||||
example = 8080;
|
||||
description = "Internal port";
|
||||
};
|
||||
|
||||
username = mkOption {
|
||||
type = types.str;
|
||||
default = "prometheus";
|
||||
example = "admin";
|
||||
description = "Admin username";
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
type = types.str;
|
||||
example = "/var/lib/fritz/password.txt";
|
||||
description = "password stored in a file";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
prometheus.exporters.fritz = {
|
||||
inherit (cfg) enable port;
|
||||
settings.devices = [
|
||||
{
|
||||
inherit (cfg) username;
|
||||
password_file = cfg.passwordFile;
|
||||
host_info = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
prometheus.scrapeConfigs = [
|
||||
{
|
||||
job_name = "fritzbox";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "127.0.0.1:${toString cfg.port}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
grafana.provision = {
|
||||
dashboards.settings.providers = [
|
||||
{
|
||||
name = "Fritzbox";
|
||||
options.path = pkgs.grafana-dashboards.fritzbox;
|
||||
disableDeletion = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -165,5 +165,12 @@ lib.makeScope pkgs.newScope (
|
|||
(_: {
|
||||
src = ./blackbox.json; # sadly only imported dashboards work
|
||||
});
|
||||
|
||||
fritzbox = buildGrafanaDashboard {
|
||||
id = 17751;
|
||||
pname = "fritzbox";
|
||||
version = "1";
|
||||
hash = "sha256-foc00LtcBTXOzvwyddJO0QJkCP82bUXa5iMuQmHqKcg=";
|
||||
};
|
||||
}
|
||||
)
|
||||
|
|
0
pkgs/grafana-dashboards/fritzbox.json
Normal file
0
pkgs/grafana-dashboards/fritzbox.json
Normal file
Loading…
Add table
Add a link
Reference in a new issue