initial observability setup
All checks were successful
Test action / Print hello world (push) Successful in 12s
All checks were successful
Test action / Print hello world (push) Successful in 12s
This commit is contained in:
parent
a3cb9796b1
commit
6511e513a3
7 changed files with 253 additions and 3 deletions
32
modules/nixos/services/observability/prometheus/default.nix
Normal file
32
modules/nixos/services/observability/prometheus/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ pkgs, config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
|
||||
cfg = config.${namespace}.services.observability.prometheus;
|
||||
in
|
||||
{
|
||||
options.${namespace}.services.observability.prometheus = {
|
||||
enable = mkEnableOption "enable Prometheus";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
port = 9002;
|
||||
|
||||
globalConfig.scrape_interval = "15s";
|
||||
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "prometheus";
|
||||
static_configs = [
|
||||
{ targets = [ "localhost:9002" ]; }
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 9002 ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue