summaryrefslogtreecommitdiff
path: root/modules/xnet/monitoring/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/xnet/monitoring/default.nix')
-rw-r--r--modules/xnet/monitoring/default.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/xnet/monitoring/default.nix b/modules/xnet/monitoring/default.nix
new file mode 100644
index 0000000..87ae724
--- /dev/null
+++ b/modules/xnet/monitoring/default.nix
@@ -0,0 +1,38 @@
+{ config, ... }:
+let
+ inherit (config.networking) hostName;
+ inherit (config.services.prometheus) exporters;
+in
+{
+ imports = [ ./grafana.nix ./prometheus.nix ];
+
+ exporters = {
+ node = {
+ enable = true;
+ enabledCollectors = [ "processes" "systemd" ];
+ };
+
+ systemd = {
+ enable = true;
+ extraFlags = [
+ "--systemd.collector.enable-ip-accounting"
+ "--systemd.collector.enable-restart-count"
+ ];
+ };
+ };
+
+ services.prometheus.scrapeConfigs = [
+ {
+ job_name = "node";
+ static_configs = [{
+ targets = [ "${hostName}:${toString exporters.node.port}" ];
+ }];
+ }
+ {
+ job_name = "systemd";
+ static_configs = [{
+ targets = [ "${hostName}:${toString exporters.systemd.port}" ];
+ }];
+ }
+ ];
+}