nixos-config/modules/grafana.nix

72 lines
1.6 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 = "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" ];
}];
relabel_configs = [{
source_labels = [ "device" ];
target_label = "id";
regex = "c9:5e:c5:16:23:4d" ;
replacement = "A";
}];
}
];
};
users.users.caddy = {
group = "caddy";
uid = config.ids.uids.caddy;
home = caddyDir;
createHome = true;
extraGroups = [ "users" ];
};
users.groups.caddy.gid = config.ids.uids.caddy;
}