Move Grafana to hel1

This commit is contained in:
Paul-Henri Froidmont 2024-12-11 05:02:44 +01:00
parent f18644f8a1
commit e7caa4e487
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
6 changed files with 241 additions and 242 deletions

View file

@ -1,6 +1,8 @@
{ config, lib, ... }:
let cfg = config.custom.services.monitoring-exporters;
in {
let
cfg = config.custom.services.monitoring-exporters;
in
{
options.custom.services.monitoring-exporters = {
enable = lib.mkEnableOption "monitoring-exporters";
};
@ -10,11 +12,30 @@ in {
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" "processes" ];
enabledCollectors = [
"systemd"
"processes"
];
};
dmarc = {
enable = true;
debug = true;
imap = {
host = "mail.banditlair.com";
username = "paultrial@banditlair.com";
passwordFile = "/run/credentials/prometheus-dmarc-exporter.service/password";
};
folders = {
inbox = "dmarc_reports";
done = "Archives.dmarc_report_processed";
error = "Archives.dmarc_report_error";
};
};
};
};
systemd.services.prometheus-dmarc-exporter.serviceConfig.LoadCredential = "password:${config.sops.secrets.dmarcExporterPassword.path}";
services.promtail = {
enable = true;
configuration = {
@ -22,7 +43,7 @@ in {
http_listen_port = 3101;
grpc_listen_port = 0;
};
clients = [{ url = "http://10.0.2.3:3100/loki/api/v1/push"; }];
clients = [ { url = "http://127.0.0.1:3100/loki/api/v1/push"; } ];
scrape_configs = [
{
job_name = "journal";
@ -33,21 +54,25 @@ in {
host = "${config.networking.hostName}";
};
};
relabel_configs = [{
source_labels = [ "__journal__systemd_unit" ];
target_label = "unit";
}];
relabel_configs = [
{
source_labels = [ "__journal__systemd_unit" ];
target_label = "unit";
}
];
}
(lib.mkIf config.services.nginx.enable {
job_name = "nginx";
static_configs = [{
targets = [ "localhost" ];
labels = {
job = "nginx";
host = "${config.networking.hostName}";
__path__ = "/var/log/nginx/*.log";
};
}];
static_configs = [
{
targets = [ "localhost" ];
labels = {
job = "nginx";
host = "${config.networking.hostName}";
__path__ = "/var/log/nginx/*.log";
};
}
];
})
];
};