Skip to content

Commit

Permalink
High hope
Browse files Browse the repository at this point in the history
  • Loading branch information
peterablehmann committed Mar 13, 2024
1 parent 0f85997 commit 7a88d67
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
10 changes: 6 additions & 4 deletions modules/common/exporters.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@

sops.secrets."monitoring/basicAuthFile" = {
sopsFile = "${inputs.self}/secrets/common.yaml";
owner = "nginx";
};

security.acme = {
defaults.email = "[email protected]";
acceptTerms = true;
certs."metrics.${config.networking.hostName}.${config.networking.domain}" = { };
certs."${config.networking.fqdn}" = { };
};

services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
virtualHosts."metrics.${config.networking.hostName}.${config.networking.domain}" = {
virtualHosts."${config.networking.hostName}.${config.networking.domain}" = {
enableACME = true;
forceSSL = true;
locations."/node" = {
proxyPass = "http://${config.services.prometheus.exporters.node.listenAddress}:${builtins.toString config.services.prometheus.exporters.node.port}";
locations."/exporters/node-exporter" = {
proxyPass = "http://${config.services.prometheus.exporters.node.listenAddress}:${builtins.toString config.services.prometheus.exporters.node.port}/";
proxyWebsockets = true;
basicAuthFile = config.sops.secrets."monitoring/basicAuthFile".path;
};
Expand All @@ -34,6 +35,7 @@
services.prometheus.exporters.node = {
enable = true;
listenAddress = "127.0.0.1";
extraFlags = [ "--web.telemetry-path=\"/node_exporter/metrics\"" ];
enabledCollectors = [
"systemd"
];
Expand Down
21 changes: 14 additions & 7 deletions nodes/monitoring/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{ config, lib, pkgs, modulesPath, ... }:

{ lib
, modulesPath
, ...
}:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
[
(modulesPath + "/profiles/qemu-guest.nix")
];

boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot = {
initrd = {
availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
kernelModules = [ ];
};
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
};

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
14 changes: 2 additions & 12 deletions nodes/monitoring/modules/prometheus.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{config
{ config
, inputs
, ...
}:
let
domain = "monitoring.xnee.net";
in
{
sops.secrets."basicAuth/password" = {
sopsFile = "${inputs.self}/secrets/monitoring.yaml";
Expand All @@ -27,14 +24,7 @@ in
"sync.xnee.de"
];
}];
relabel_configs = [
{
source_labels = [ "__address__" ];
target_label = "__address__";
replacement = "metrics.$1";
}
];
metrics_path = "/node";
metrics_path = "/exporters/node-exporter";
basic_auth = {
username = "prometheus";
password_file = config.sops.secrets."basicAuth/password".path;
Expand Down

0 comments on commit 7a88d67

Please sign in to comment.