mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-28 18:18:59 +00:00
hosts/plover: init Prometheus monitoring daemon
This commit is contained in:
parent
6ec18948b5
commit
97916aaa05
@ -33,6 +33,7 @@ in
|
|||||||
./modules/services/vouch-proxy.nix
|
./modules/services/vouch-proxy.nix
|
||||||
|
|
||||||
# The monitoring stack.
|
# The monitoring stack.
|
||||||
|
./modules/services/prometheus.nix
|
||||||
./modules/services/grafana.nix
|
./modules/services/grafana.nix
|
||||||
|
|
||||||
# The database of choice which is used by most self-managed services on
|
# The database of choice which is used by most self-managed services on
|
||||||
|
43
hosts/plover/modules/services/prometheus.nix
Normal file
43
hosts/plover/modules/services/prometheus.nix
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
bindStatsPort = 8053;
|
||||||
|
prometheusExports = config.services.prometheus.exporters;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.prometheus = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
exporters = {
|
||||||
|
bind = {
|
||||||
|
enable = true;
|
||||||
|
bindURI = "http://127.0.0.1/${builtins.toString bindStatsPort}";
|
||||||
|
};
|
||||||
|
|
||||||
|
nginx.enable = true;
|
||||||
|
nginxlog.enable = true;
|
||||||
|
|
||||||
|
node = {
|
||||||
|
enable = true;
|
||||||
|
enabledCollectors = [ "systemd" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
scrapeConfigs = [
|
||||||
|
{
|
||||||
|
job_name = config.networking.hostName;
|
||||||
|
static_configs = [{
|
||||||
|
targets = [ "127.0.0.1:${builtins.toString prometheusExports.node.port}" ];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Requiring this for Prometheus being able to monitor my services.
|
||||||
|
services.nginx.statusPage = true;
|
||||||
|
services.bind.extraConfig = ''
|
||||||
|
statistics-channels {
|
||||||
|
inet 127.0.0.1 port ${builtins.toString bindStatsPort} allow { 127.0.0.1; };
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user