summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-05-22 19:27:36 -0400
committerseth <[email protected]>2023-05-22 19:27:36 -0400
commit2cb6cfab9553184c1e6a10303cb832fe96080d00 (patch)
tree5a5d815e3d66fb8e1a550aec6a4dece9fe82b66b
parent3a7cc8116cce947f5652e0e46f4d60d59bfb5717 (diff)
atlas/pbody: fix monitoring
-rw-r--r--hosts/atlas/prometheus.nix31
-rw-r--r--hosts/p-body/default.nix3
-rw-r--r--hosts/p-body/loki.nix (renamed from modules/nixos/server/services/loki.nix)22
-rw-r--r--hosts/p-body/prometheus.nix8
-rw-r--r--modules/nixos/server/services/default.nix1
5 files changed, 14 insertions, 51 deletions
diff --git a/hosts/atlas/prometheus.nix b/hosts/atlas/prometheus.nix
index b0c3f7b..041c407 100644
--- a/hosts/atlas/prometheus.nix
+++ b/hosts/atlas/prometheus.nix
@@ -1,33 +1,14 @@
-{config, ...}: let
- scrapeExporter = name: host: port: {
- job_name = "${name}";
- static_configs = [
- {
- targets = [
- "${host}:${port}"
- ];
- }
- ];
- };
-in {
- services.prometheus = {
+{config, ...}: {
+ networking.firewall.allowedTCPPorts = [config.services.prometheus.exporters.node.port];
+
+ services.prometheus.exporters.node = {
enable = true;
- port = 5000;
- exporters = {
- node = {
- enable = true;
- enabledCollectors = ["systemd"];
- port = 5001;
- };
- };
- scrapeConfigs = [
- (scrapeExporter "atlas" "127.0.0.1" "${toString config.services.prometheus.exporters.node.port}")
- ];
+ enabledCollectors = ["systemd"];
};
getchoo.server.services.promtail.clients = [
{
- url = "p-body:3030/loki/api/v1/push";
+ url = "http://p-body:3030/loki/api/v1/push";
}
];
}
diff --git a/hosts/p-body/default.nix b/hosts/p-body/default.nix
index 10abfac..35cbabb 100644
--- a/hosts/p-body/default.nix
+++ b/hosts/p-body/default.nix
@@ -9,6 +9,7 @@
(modulesPath + "/virtualisation/digital-ocean-image.nix")
./forgejo.nix
./grafana.nix
+ ./loki.nix
./nginx.nix
./prometheus.nix
];
@@ -21,8 +22,6 @@
hermetic = false;
};
- getchoo.server.services.loki.enable = true;
-
networking = {
domain = "mydadleft.me";
hostName = "p-body";
diff --git a/modules/nixos/server/services/loki.nix b/hosts/p-body/loki.nix
index 1a42637..84bb887 100644
--- a/modules/nixos/server/services/loki.nix
+++ b/hosts/p-body/loki.nix
@@ -1,24 +1,10 @@
-{
- config,
- lib,
- ...
-}: let
- cfg = config.getchoo.server.services.loki;
- inherit (lib) mkEnableOption mkIf mkOption types;
-in {
- options.getchoo.server.services.loki = {
- enable = mkEnableOption "enable loki";
- port = mkOption {
- type = types.port;
- default = 3030;
- description = "port for loki";
- };
- };
+{config, ...}: {
+ networking.firewall.allowedTCPPorts = [config.services.loki.configuration.server.http_listen_port];
- config.services.loki = mkIf cfg.enable {
+ services.loki = {
enable = true;
configuration = {
- server.http_listen_port = cfg.port;
+ server.http_listen_port = 3030;
auth_enabled = false;
ingester = {
diff --git a/hosts/p-body/prometheus.nix b/hosts/p-body/prometheus.nix
index 56e05a9..26e9d0e 100644
--- a/hosts/p-body/prometheus.nix
+++ b/hosts/p-body/prometheus.nix
@@ -12,23 +12,21 @@
in {
services.prometheus = {
enable = true;
- port = 5000;
exporters = {
node = {
enable = true;
enabledCollectors = ["systemd"];
- port = 5001;
};
};
scrapeConfigs = [
- (scrapeExporter "p-body" "127.0.0.1" "${toString config.services.prometheus.exporters.node.port}")
- (scrapeExporter "atlas" "atlas" "5001")
+ (scrapeExporter "p-body" "localhost" "${toString config.services.prometheus.exporters.node.port}")
+ (scrapeExporter "atlas" "atlas" "${toString config.services.prometheus.exporters.node.port}")
];
};
getchoo.server.services.promtail.clients = [
{
- url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
+ url = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
}
];
}
diff --git a/modules/nixos/server/services/default.nix b/modules/nixos/server/services/default.nix
index eb24d04..5e9b2b4 100644
--- a/modules/nixos/server/services/default.nix
+++ b/modules/nixos/server/services/default.nix
@@ -1,7 +1,6 @@
_: {
imports = [
./hercules.nix
- ./loki.nix
./promtail.nix
];
}