mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31:34 +01:00
grafana: Add victorialogs dashboard
This commit is contained in:
parent
d7d28fa19f
commit
387af935d1
4 changed files with 41 additions and 10 deletions
|
|
@ -63,8 +63,9 @@
|
|||
victorialogs.enable = true;
|
||||
};
|
||||
dashboards = {
|
||||
nodeExporter.enable = true;
|
||||
victoriametrics.enable = true;
|
||||
nodeExporter = true;
|
||||
victoriametrics = true;
|
||||
victorialogs = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -81,7 +82,10 @@
|
|||
alloy = {
|
||||
enable = true;
|
||||
domain = "alloy-${config.networking.hostName}.${tailscaleDomain}";
|
||||
collect.hostMetrics = true;
|
||||
collect = {
|
||||
hostMetrics = true;
|
||||
victorialogsMetrics = true;
|
||||
};
|
||||
};
|
||||
|
||||
caddy.virtualHosts =
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ in
|
|||
};
|
||||
collect = {
|
||||
hostMetrics = lib.mkEnableOption "";
|
||||
victorialogsMetrics = lib.mkEnableOption "";
|
||||
sshdLogs = lib.mkEnableOption "";
|
||||
};
|
||||
};
|
||||
|
|
@ -56,10 +57,10 @@ in
|
|||
}
|
||||
'';
|
||||
|
||||
"alloy/node-exporter.alloy" = lib.mkIf cfg.collect.hostMetrics {
|
||||
"alloy/host-metrics.alloy" = lib.mkIf cfg.collect.hostMetrics {
|
||||
text = ''
|
||||
prometheus.exporter.unix "default" {
|
||||
enable_collectors = [ "systemd" ]
|
||||
enable_collectors = ["systemd"]
|
||||
}
|
||||
|
||||
prometheus.scrape "node_exporter" {
|
||||
|
|
@ -70,6 +71,18 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
"alloy/victorialogs-metrics.alloy" = lib.mkIf cfg.collect.victorialogsMetrics {
|
||||
text = ''
|
||||
prometheus.scrape "victorialogs" {
|
||||
targets = [{
|
||||
__address__ = "localhost:${builtins.toString config.custom.services.victorialogs.port}",
|
||||
}]
|
||||
forward_to = [prometheus.remote_write.default.receiver]
|
||||
scrape_interval = "15s"
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
"alloy/sshd-logs.alloy" = lib.mkIf cfg.collect.sshdLogs {
|
||||
text = ''
|
||||
loki.source.journal "sshd" {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,9 @@ in
|
|||
};
|
||||
};
|
||||
dashboards = {
|
||||
nodeExporter.enable = lib.mkEnableOption "";
|
||||
victoriametrics.enable = lib.mkEnableOption "";
|
||||
nodeExporter = lib.mkEnableOption "";
|
||||
victoriametrics = lib.mkEnableOption "";
|
||||
victorialogs = lib.mkEnableOption "";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -122,7 +123,7 @@ in
|
|||
|
||||
environment.etc = {
|
||||
"grafana-dashboards/node-exporter-full.json" = {
|
||||
enable = cfg.dashboards.nodeExporter.enable;
|
||||
enable = cfg.dashboards.nodeExporter;
|
||||
source = pkgs.fetchurl {
|
||||
name = "node-exporter-full.json";
|
||||
url = "https://grafana.com/api/dashboards/1860/revisions/41/download";
|
||||
|
|
@ -130,13 +131,21 @@ in
|
|||
};
|
||||
};
|
||||
"grafana-dashboards/victoriametrics-single-node.json" = {
|
||||
enable = cfg.dashboards.victoriametrics.enable;
|
||||
enable = cfg.dashboards.victoriametrics;
|
||||
source = pkgs.fetchurl {
|
||||
name = "victoriametrics-single-node.json";
|
||||
url = "https://grafana.com/api/dashboards/10229/revisions/41/download";
|
||||
hash = "sha256-mwtah8A2w81WZjf5bUXoTJfS1R9UX+tua2PiDrBKJCQ=";
|
||||
};
|
||||
};
|
||||
"grafana-dashboards/victorialogs-single-node.json" = {
|
||||
enable = cfg.dashboards.victorialogs;
|
||||
source = pkgs.fetchurl {
|
||||
name = "victorialogs-single-node.json";
|
||||
url = "https://grafana.com/api/dashboards/22084/revisions/8/download";
|
||||
hash = "sha256-/a3Rbp/6oyiLBnQtGupyFZW+fIHQfkyKRRTyfofxVTM=";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,12 @@ in
|
|||
|
||||
services.victorialogs = {
|
||||
enable = true;
|
||||
package = pkgs-unstable.victorialogs;
|
||||
package = pkgs-unstable.victorialogs.overrideAttrs (
|
||||
_: previousAttrs: {
|
||||
version = "victoria-logs-" + previousAttrs.version;
|
||||
__intentionallyOverridingVersion = true;
|
||||
}
|
||||
);
|
||||
listenAddress = "localhost:${builtins.toString cfg.port}";
|
||||
extraOptions = [ "-retention.maxDiskSpaceUsageBytes=${cfg.maxDiskSpaceUsage}" ];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue