Enable Prometheus server and Grafana
This commit is contained in:
+42
-1
@@ -2,7 +2,7 @@
|
|||||||
# your system. Help is available in the configuration.nix(5) man page
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
{ pkgs, top, ... }:
|
{ config, pkgs, top, ... }:
|
||||||
let
|
let
|
||||||
wanInterface = "enp2s0";
|
wanInterface = "enp2s0";
|
||||||
lanInterface = "enp1s0";
|
lanInterface = "enp1s0";
|
||||||
@@ -89,6 +89,47 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
};
|
};
|
||||||
|
grafana = {
|
||||||
|
enable = true;
|
||||||
|
provision = {
|
||||||
|
enable = true;
|
||||||
|
dashboards.settings.providers = [{
|
||||||
|
name = "Dashboards";
|
||||||
|
disableDeletion = true;
|
||||||
|
options = {
|
||||||
|
path = "/etc/grafana-dashboards";
|
||||||
|
foldersFromFilesStructure = true;
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
datasources.settings.datasources = [{
|
||||||
|
name = "Prometheus";
|
||||||
|
type = "prometheus";
|
||||||
|
url = "http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}";
|
||||||
|
isDefault = true;
|
||||||
|
editable = false;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
domain = "${config.networking.hostName}.shire-zebra.ts.net";
|
||||||
|
enforce_domain = true;
|
||||||
|
http_addr = "0.0.0.0";
|
||||||
|
enable_gzip = true;
|
||||||
|
http_port = 3001;
|
||||||
|
};
|
||||||
|
analytics.reporting_enabled = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
prometheus = {
|
||||||
|
enable = true;
|
||||||
|
globalConfig.scrape_interval = "10s";
|
||||||
|
scrapeConfigs = [ {
|
||||||
|
job_name = "node stats";
|
||||||
|
static_configs = [{
|
||||||
|
targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ];
|
||||||
|
}];
|
||||||
|
} ];
|
||||||
|
};
|
||||||
# Configure keymap
|
# Configure keymap
|
||||||
xserver.xkb = {
|
xserver.xkb = {
|
||||||
layout = "us";
|
layout = "us";
|
||||||
|
|||||||
Reference in New Issue
Block a user