Prometheus extraScrapeConfigs as parameter
This commit is contained in:
parent
addd0c5df4
commit
f20c086d6f
2 changed files with 32 additions and 21 deletions
|
|
@ -15,6 +15,14 @@ in
|
|||
options.my.monitoring.prometheus = {
|
||||
enable = lib.mkEnableOption "Enable prometheus as a data scraper";
|
||||
|
||||
extraScrapeConfigs = lib.mkOption {
|
||||
default = [ ];
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
description = ''
|
||||
Additional scrape configurations to add to Prometheus.
|
||||
'';
|
||||
};
|
||||
|
||||
proxy = {
|
||||
enable = lib.mkEnableOption "Set the proxy entry for this service";
|
||||
|
||||
|
|
@ -49,13 +57,6 @@ in
|
|||
config = lib.mkMerge [
|
||||
(lib.mkIf cfg.enable {
|
||||
|
||||
age.secrets.searx-prometheus-secret = {
|
||||
file = ../../secrets/searx-prometheus-secret.age;
|
||||
owner = config.users.users."prometheus".name;
|
||||
group = config.users.groups."prometheus".name;
|
||||
mode = "0644";
|
||||
};
|
||||
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
scrapeConfigs = [
|
||||
|
|
@ -73,19 +74,7 @@ in
|
|||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "caddy";
|
||||
static_configs = [ { targets = [ "caddy.internal:2024" ]; } ];
|
||||
}
|
||||
{
|
||||
job_name = "searxng";
|
||||
static_configs = [ { targets = [ "caddy.internal:8080" ]; } ];
|
||||
basic_auth = {
|
||||
username = "searxng";
|
||||
password_file = config.age.secrets.searx-prometheus-secret.path;
|
||||
};
|
||||
}
|
||||
];
|
||||
] ++ cfg.extraScrapeConfigs;
|
||||
};
|
||||
|
||||
services.grafana = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue