modules: services: add monitoring dashboard

This commit is contained in:
Bruno BELANYI 2021-07-13 19:10:17 +02:00
parent c910b643da
commit 24028669f4

View file

@ -1,7 +1,7 @@
# Configuration shamelessly stolen from [1] # Configuration shamelessly stolen from [1]
# #
# [1]: https://github.com/delroth/infra.delroth.net/blob/master/common/nginx.nix # [1]: https://github.com/delroth/infra.delroth.net/blob/master/common/nginx.nix
{ config, pkgs, lib, ... }: { config, lib, pkgs, ... }:
{ {
# Whenever something defines an nginx vhost, ensure that nginx defaults are # Whenever something defines an nginx vhost, ensure that nginx defaults are
@ -40,5 +40,34 @@
}; };
}; };
}; };
# Setup monitoring
services.grafana.provision.dashboards = [
{
name = "NGINX";
options.path = pkgs.nur.repos.alarsyo.grafana-dashboards.nginx;
disableDeletion = true;
}
];
services.prometheus = {
exporters.nginx = {
enable = true;
listenAddress = "127.0.0.1";
};
scrapeConfigs = [
{
job_name = "nginx";
static_configs = [
{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}" ];
labels = {
instance = config.networking.hostName;
};
}
];
}
];
};
}; };
} }