Skip to content

Commit

Permalink
feat(win10): added windows_exporter to prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
Wittano committed Dec 8, 2024
1 parent fe18797 commit 17cf6b5
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions nixos/services/prometheus.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
{ config, lib, ... }:
with lib;
with lib.my;
let
windowsExporterConfig = attrsets.optionalAttrs config.hardware.virtualization.wittano.enableWindowsVM
{
job_name = "windows_exporter";
static_configs = [{
targets = [ "192.168.122.110:9182" ];
}];
};
in
{
options.services.prometheus.wittano.enable = mkEnableOption "prometheus service";

config = mkIf config.services.prometheus.wittano.enable {
networking.firewall.interfaces.eno1.allowedTCPPorts = [ 9090 9100 ];

services.prometheus = {
services.prometheus = rec {
enable = true;
port = 9090;

scrapeConfigs = [{
job_name = "node";
static_configs = [{ targets = [ "localhost:9100" ]; }];
}];
scrapeConfigs = [
{
job_name = "node";
static_configs = [{ targets = [ "localhost:${builtins.toString exporters.node.port}" ]; }];
}
windowsExporterConfig
];

exporters.node = {
enable = true;
Expand Down

0 comments on commit 17cf6b5

Please sign in to comment.