mirror of
https://github.com/juspay/services-flake.git
synced 2024-09-11 12:26:04 +03:00
31 lines
815 B
Nix
31 lines
815 B
Nix
{ pkgs, config, ... }: {
|
|
services.prometheus."pro1" = {
|
|
enable = true;
|
|
# scrape prometheus
|
|
extraConfig = {
|
|
scrape_configs = [{
|
|
job_name = "prometheus";
|
|
static_configs = [{
|
|
targets = [ "localhost:9090" ];
|
|
}];
|
|
}];
|
|
};
|
|
};
|
|
|
|
settings.processes.test =
|
|
let
|
|
cfg = config.services.prometheus."pro1";
|
|
in
|
|
{
|
|
command = pkgs.writeShellApplication {
|
|
runtimeInputs = [ cfg.package pkgs.curl pkgs.gnugrep ];
|
|
text = ''
|
|
curl -sS ${cfg.listenAddress}:${builtins.toString cfg.port}/-/healthy
|
|
curl -s -o /dev/null -w "%{http_code}" ${cfg.listenAddress}:${builtins.toString cfg.port}/metrics
|
|
'';
|
|
name = "prometheus-test";
|
|
};
|
|
depends_on."pro1".condition = "process_healthy";
|
|
};
|
|
}
|