mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 20:09:07 +01:00
comin: Scrape metrics with alloy
This commit is contained in:
parent
8855886547
commit
050f635b8f
2 changed files with 29 additions and 2 deletions
|
|
@ -109,6 +109,20 @@ in
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
"alloy/comin-metrics.alloy" = {
|
||||||
|
enable = cfg.collect.metrics.comin;
|
||||||
|
text = ''
|
||||||
|
prometheus.scrape "comin" {
|
||||||
|
targets = [{
|
||||||
|
__address__ = "localhost:${toString config.custom.services.comin.metricsPort}",
|
||||||
|
job = "comin",
|
||||||
|
instance = constants.hostname,
|
||||||
|
}]
|
||||||
|
forward_to = [prometheus.remote_write.default.receiver]
|
||||||
|
scrape_interval = "30s"
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
custom.services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
custom.services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,21 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.custom.services.comin;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.comin.nixosModules.comin ];
|
imports = [ inputs.comin.nixosModules.comin ];
|
||||||
|
|
||||||
options.custom.services.comin.enable = lib.mkEnableOption "";
|
options.custom.services.comin = {
|
||||||
|
enable = lib.mkEnableOption "";
|
||||||
|
metricsPort = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 4243;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.custom.services.comin.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
services.comin = {
|
services.comin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
remotes = lib.singleton {
|
remotes = lib.singleton {
|
||||||
|
|
@ -18,5 +27,9 @@
|
||||||
branches.main.name = "deploy";
|
branches.main.name = "deploy";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
exporter = {
|
||||||
|
listen_address = "127.0.0.1";
|
||||||
|
inherit (cfg) port;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue