Replace telegraf with node exporter
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@
|
||||
let
|
||||
selfPkgs = inputs.self.packages.${system};
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
inherit (hmConfig.virtualisation.quadlet) volumes containers networks;
|
||||
inherit (hmConfig.virtualisation.quadlet) networks;
|
||||
autheliaClientId = "4R5ofTZgOjO5Nrbcm9f6KqBLZXy8LwPS5s3E3BUfPS2mRy0wSV41XZGLrLgiR4Z0MblyGzW211AHL7GCCaJu5KonLUKyRjoyuiAr";
|
||||
in
|
||||
{
|
||||
@@ -34,7 +34,7 @@ in
|
||||
client_name = "Grafana";
|
||||
client_secret = hmConfig.sops.placeholder."grafana/authelia/digest";
|
||||
redirect_uris = [ "https://stats.karaolidis.com/login/generic_oauth" ];
|
||||
authorization_policy = "admin";
|
||||
authorization_policy = "admin_one_factor";
|
||||
require_pkce = true;
|
||||
pkce_challenge_method = "S256";
|
||||
}
|
||||
@@ -122,87 +122,9 @@ in
|
||||
};
|
||||
|
||||
virtualisation.quadlet = {
|
||||
networks = {
|
||||
grafana.networkConfig.internal = true;
|
||||
# Allow access to host telegraf via non-internal network
|
||||
grafana-prometheus = { };
|
||||
};
|
||||
|
||||
volumes = {
|
||||
"grafana-prometheus-data" = { };
|
||||
"grafana-prometheus-config" = { };
|
||||
};
|
||||
networks.grafana.networkConfig.internal = true;
|
||||
|
||||
containers = {
|
||||
"grafana-prometheus-init" =
|
||||
let
|
||||
prometheusConfig = (pkgs.formats.yaml { }).generate "prometheus.yml" {
|
||||
global = {
|
||||
scrape_interval = "10s";
|
||||
evaluation_interval = "10s";
|
||||
};
|
||||
|
||||
scrape_configs = [
|
||||
{
|
||||
job_name = "telegraf";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "host.containers.internal:9273" ];
|
||||
labels.app = "telegraf";
|
||||
}
|
||||
{
|
||||
targets = [
|
||||
"host.containers.internal:${builtins.toString (9273 + config.users.users.${user}.uid)}"
|
||||
];
|
||||
labels.app = "telegraf-storm";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
containerConfig = {
|
||||
image = "docker-archive:${selfPkgs.docker-yq}";
|
||||
volumes = [
|
||||
"${volumes."grafana-prometheus-config".ref}:/etc/prometheus"
|
||||
"${prometheusConfig}:/etc/prometheus/conf.d/prometheus.yml"
|
||||
];
|
||||
entrypoint = "/bin/bash";
|
||||
exec = [
|
||||
"-c"
|
||||
"yq eval-all '. as $item ireduce ({}; . * $item)' /etc/prometheus/conf.d/*.yml > /etc/prometheus/prometheus.yml"
|
||||
];
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
"grafana-prometheus" = {
|
||||
containerConfig = {
|
||||
image = "docker-archive:${selfPkgs.docker-prometheus}";
|
||||
volumes = [
|
||||
"${volumes."grafana-prometheus-config".ref}:/etc/prometheus"
|
||||
"${volumes."grafana-prometheus-data".ref}:/var/lib/prometheus"
|
||||
];
|
||||
networks = [
|
||||
networks.grafana.ref
|
||||
networks.grafana-prometheus.ref
|
||||
];
|
||||
exec = [
|
||||
"--config.file=/etc/prometheus/prometheus.yml"
|
||||
"--storage.tsdb.path=/var/lib/prometheus"
|
||||
"--storage.tsdb.retention.time=1y"
|
||||
"--log.level=warn"
|
||||
];
|
||||
};
|
||||
|
||||
unitConfig.After = [ "${containers."grafana-prometheus-init"._serviceName}.service" ];
|
||||
};
|
||||
|
||||
grafana = {
|
||||
containerConfig = {
|
||||
image = "docker-archive:${selfPkgs.docker-grafana}";
|
||||
@@ -217,17 +139,12 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
unitConfig.After = [
|
||||
"${containers."grafana-prometheus"._serviceName}.service"
|
||||
"${containers."grafana-image-renderer"._serviceName}.service"
|
||||
];
|
||||
unitConfig.After = [ "sops-nix.service" ];
|
||||
};
|
||||
|
||||
"grafana-image-renderer" = {
|
||||
containerConfig = {
|
||||
image = "docker-archive:${selfPkgs.docker-grafana-image-renderer}";
|
||||
networks = [ networks.grafana.ref ];
|
||||
};
|
||||
grafana-image-renderer.containerConfig = {
|
||||
image = "docker-archive:${selfPkgs.docker-grafana-image-renderer}";
|
||||
networks = [ networks.grafana.ref ];
|
||||
};
|
||||
|
||||
authelia.containerConfig.volumes = [
|
||||
|
Reference in New Issue
Block a user