nixos-config/modules/grafana.nix

134 lines
3.0 KiB
Nix

{ config, pkgs, ...}:
let
caddyDir = "/var/lib/caddy";
in
{
services.grafana = {
enable = true;
domain = "sup.atlanticaweb.fr";
port = 2342;
addr = "192.168.10.108";
};
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
};
scrapeConfigs = [
{
job_name = "sup";
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "nextcloud";
static_configs = [{
targets = [ "192.168.10.114:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "pizzajoffre";
static_configs = [{
targets = [ "37.187.103.8:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "backup";
static_configs = [{
targets = [ "163.172.80.106:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "dell-5590";
static_configs = [{
targets = [ "192.168.10.100:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "temperatures";
static_configs = [{
targets = [ "192.168.10.116:9521" ];
}];
metric_relabel_configs = [
{
source_labels = [ "device" ];
target_label = "device";
regex = "c9:5e:c5:16:23:4d" ;
replacement = "I";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "e4:9b:e7:3f:b1:24" ;
replacement = "J Perso";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "ff:a4:06:f3:18:5e" ;
replacement = "H - réserve ";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "f7:69:1d:2f:f9:6a" ;
replacement = "G - gris";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "fd:7c:46:30:5b:18" ;
replacement = "E - Table";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "e7:ef:27:89:c4:05" ;
replacement = "A CODIGEL";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "d4:1e:62:36:d0:4b" ;
replacement = "B - INFRICO";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "ec:c3:0f:ef:fe:b5" ;
replacement = "C";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "f5:fd:dd:c4:29:c1" ;
replacement = "D - HAIER";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "c8:8e:34:24:2c:89" ;
replacement = "F - salle";
}
];
}
];
};
users.users.caddy = {
group = "caddy";
uid = config.ids.uids.caddy;
home = caddyDir;
createHome = true;
extraGroups = [ "users" ];
};
users.groups.caddy.gid = config.ids.uids.caddy;
}