mirror of
https://github.com/RGBCube/ncc
synced 2025-07-30 11:37:44 +00:00
Add grafana
This commit is contained in:
parent
336c7d3832
commit
3b6d557aea
4 changed files with 40 additions and 8 deletions
32
hosts/cube/grafana.nix
Normal file
32
hosts/cube/grafana.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ config, ulib, ... }: with ulib;
|
||||
|
||||
let
|
||||
inherit (config.networking) domain;
|
||||
|
||||
fqdn = "metrics.${domain}";
|
||||
in serverSystemConfiguration {
|
||||
age.secrets."cube.mail.password" = {
|
||||
owner = "grafana";
|
||||
group = "grafana";
|
||||
};
|
||||
|
||||
services.grafana = enabled {
|
||||
domain = fqdn;
|
||||
port = 8999;
|
||||
|
||||
settings.security = {
|
||||
admin_email = "metrics@${domain}";
|
||||
admin_password = "$__file{${config.age.secrets."cube.mail.password".path}}";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts.${fqdn} = {
|
||||
forceSSL = true;
|
||||
useACMEHost = domain;
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://0.0.0.0:${toString config.services.grafana.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -32,8 +32,8 @@ in serverSystemConfiguration {
|
|||
job_name = "mail";
|
||||
|
||||
static_configs = [{
|
||||
labels = [ "mail" ];
|
||||
targets = [
|
||||
labels.job = "mail";
|
||||
targets = [
|
||||
"[::]:${toString config.services.prometheus.exporters.dmarc.port}"
|
||||
"[::]:${toString config.services.prometheus.exporters.dovecot.port}"
|
||||
"[::]:${toString config.services.prometheus.exporters.postfix.port}"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, ulib, pkgs, ... }: with ulib;
|
||||
{ config, lib, ulib, pkgs, ... }: with ulib;
|
||||
|
||||
serverSystemConfiguration {
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
|
@ -17,8 +17,8 @@ serverSystemConfiguration {
|
|||
job_name = "nginx";
|
||||
|
||||
static_configs = [{
|
||||
labels = [ "nginx" ];
|
||||
targets = [
|
||||
labels.job = "nginx";
|
||||
targets = [
|
||||
"[::]:${toString config.services.prometheus.exporters.nginxlog.port}"
|
||||
"[::]:${toString config.services.prometheus.exporters.nginx.port}"
|
||||
];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ ulib, ... }: with ulib;
|
||||
{ config, ulib, ... }: with ulib;
|
||||
|
||||
serverSystemConfiguration {
|
||||
services.prometheus = enabled {
|
||||
|
@ -13,8 +13,8 @@ serverSystemConfiguration {
|
|||
job_name = "node";
|
||||
|
||||
static_configs = [{
|
||||
labels = [ "node" ];
|
||||
targets = [ "[::]:${toString config.services.prometheus.exporters.node.port}" ];
|
||||
labels.job = "node";
|
||||
targets = [ "[::]:${toString config.services.prometheus.exporters.node.port}" ];
|
||||
}];
|
||||
}];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue