modules/monitoring: add sing-box monitoring
This commit is contained in:
parent
e4fd9e8b23
commit
dacd22b7d2
6 changed files with 69 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
@ -114,7 +115,24 @@ let
|
|||
}
|
||||
]);
|
||||
};
|
||||
experimental = {
|
||||
v2ray_api = {
|
||||
listen = "127.0.0.1:15175";
|
||||
stats = {
|
||||
users = map (u: u.name) users;
|
||||
enabled = true;
|
||||
inbounds = map (p: "sg" + toString p) (lib.range 0 4);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
sing-box = pkgs.sing-box.overrideAttrs (
|
||||
finalAttrs: previousAttrs: {
|
||||
tags = previousAttrs.tags ++ [
|
||||
"with_v2ray_api"
|
||||
];
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
options.commonSettings.proxyServer = {
|
||||
|
@ -166,6 +184,7 @@ in
|
|||
|
||||
services.sing-box = {
|
||||
enable = true;
|
||||
package = sing-box;
|
||||
settings = (
|
||||
mkSingConfig (
|
||||
map (n: {
|
||||
|
|
|
@ -57,6 +57,13 @@ in
|
|||
default = "${config.networking.hostName}.coho-tet.ts.net";
|
||||
};
|
||||
};
|
||||
v2ray = {
|
||||
enable = mkEnableOption "blackbox exporter";
|
||||
listenAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "${config.networking.hostName}.coho-tet.ts.net";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -47,6 +47,13 @@ in
|
|||
);
|
||||
};
|
||||
|
||||
services.prometheus.exporters.v2ray = mkIf cfg.v2ray.enable {
|
||||
enable = true;
|
||||
listenAddress = cfg.v2ray.listenAddress;
|
||||
port = 9516;
|
||||
v2rayEndpoint = config.services.sing-box.settings.experimental.v2ray_api.listen;
|
||||
};
|
||||
|
||||
# gotosocial
|
||||
sops.templates."gotosocial_metrics.env" = {
|
||||
content = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue