treewide: use localhost instead of ipv4

This commit is contained in:
Felix Buehler 2024-12-27 20:30:21 +01:00
parent 68a379bb34
commit c105a223a7
24 changed files with 42 additions and 53 deletions

View file

@ -33,7 +33,7 @@ in
job_name = "smartctl";
static_configs = [
{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}" ];
targets = [ "localhost:${toString config.services.prometheus.exporters.smartctl.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -34,7 +34,6 @@ in
prometheus = {
alertmanager = {
enable = true;
listenAddress = "127.0.0.1";
inherit (cfg) port;
configuration = import ./config.nix;
webExternalUrl = "https://alerts.${domain}";
@ -48,7 +47,7 @@ in
job_name = "alertmanager";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};
@ -63,7 +62,7 @@ in
{
name = "Alertmanager";
type = "alertmanager";
url = "http://127.0.0.1:${toString cfg.port}";
url = "http://localhost:${toString cfg.port}";
jsonData = {
implementation = "prometheus";
handleGrafanaManagedAlerts = config.services.prometheus.enable;

View file

@ -25,7 +25,7 @@ in
prometheus.exporters.exportarr-bazarr = {
inherit (config.services.prometheus) enable;
port = port + 1;
url = "http://127.0.0.1:${toString port}";
url = "http://localhost:${toString port}";
inherit (cfg) apiKeyFile;
};
prometheus.scrapeConfigs = [
@ -33,7 +33,7 @@ in
job_name = "bazarr";
static_configs = [
{
targets = [ "127.0.0.1:${toString port + 1}" ];
targets = [ "localhost:${toString port + 1}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -75,7 +75,7 @@ in
}
{
target_label = "__address__";
replacement = "127.0.0.1:${toString config.services.prometheus.exporters.blackbox.port}";
replacement = "localhost:${toString config.services.prometheus.exporters.blackbox.port}";
}
];
}

View file

@ -57,7 +57,7 @@ in
job_name = "blocky";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.httpPort}" ];
targets = [ "localhost:${toString cfg.httpPort}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -48,7 +48,7 @@ in
job_name = "fritzbox";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -44,7 +44,7 @@ in
job_name = "gitea";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -43,7 +43,6 @@ in
domain = "visualization.${domain}";
root_url = "https://visualization.${domain}/";
http_port = cfg.port;
http_addr = "127.0.0.1";
};
security = {
@ -70,7 +69,7 @@ in
job_name = "grafana";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -43,7 +43,6 @@ in
settings = {
domain = "notes.${domain}";
inherit (cfg) port;
host = "127.0.0.1";
protocolUseSSL = true;
db = {
dialect = "sqlite";
@ -58,7 +57,7 @@ in
job_name = "hedgedoc";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -99,7 +99,7 @@ in
unit_system = "metric";
time_zone = cfg.timezone;
external_url = "https://automation.${domain}";
internal_url = "http://127.0.0.1:${toString cfg.port}";
internal_url = "http://localhost:${toString cfg.port}";
};
http = {
server_port = cfg.port;
@ -126,7 +126,7 @@ in
metrics_path = "/api/prometheus";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -36,7 +36,7 @@ in
job_name = "jellyfin";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -90,13 +90,13 @@ in
enable = true;
configuration = {
server = {
http_listen_address = "127.0.0.1";
http_listen_address = "localhost";
http_listen_port = cfg.port;
};
auth_enabled = false;
common = {
instance_addr = "127.0.0.1";
instance_addr = "localhost";
ring.kvstore.store = "inmemory";
replication_factor = 1;
@ -113,7 +113,7 @@ in
local.directory = "${config.services.loki.dataDir}/ruler";
};
rule_path = "${config.services.loki.dataDir}/rules";
alertmanager_url = "http://127.0.0.1:${toString config.my.services.alertmanager.port}";
alertmanager_url = "http://localhost:${toString config.my.services.alertmanager.port}";
enable_alertmanager_v2 = true;
};
@ -151,7 +151,7 @@ in
name = "Loki";
type = "loki";
access = "proxy";
url = "http://127.0.0.1:${toString cfg.port}";
url = "http://localhost:${toString cfg.port}";
}
];
dashboards.settings.providers = [
@ -169,7 +169,7 @@ in
job_name = "loki";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -50,7 +50,6 @@ in
settings = cfg.settings // {
Port = cfg.port;
Address = "127.0.0.1";
MusicFolder = cfg.musicFolder;
LogLevel = "info";
Prometheus.Enabled = config.services.prometheus.enable;
@ -63,7 +62,7 @@ in
job_name = "navidrome";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -121,7 +121,7 @@ in
job_name = "nextcloud";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.exporterPort}" ];
targets = [ "localhost:${toString cfg.exporterPort}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -24,7 +24,7 @@ let
default = null;
example = 8080;
description = ''
Which port to proxy to, through 127.0.0.1, for this virtual host.
Which port to proxy to, through localhost, for this virtual host.
This option is incompatible with `root`.
'';
};
@ -45,7 +45,7 @@ let
example = literalExpression ''
{
locations."/socket" = {
proxyPass = "http://127.0.0.1:8096/";
proxyPass = "http://localhost:8096/";
proxyWebsockets = true;
};
}
@ -89,7 +89,7 @@ in
port = 8096;
extraConfig = {
locations."/socket" = {
proxyPass = "http://127.0.0.1:8096/";
proxyPass = "http://localhost:8096/";
proxyWebsockets = true;
};
};
@ -330,7 +330,7 @@ in
enable = true;
configuration = {
listen = {
addr = "127.0.0.1";
addr = "localhost";
inherit (cfg.sso) port;
};
audit_log = {
@ -403,16 +403,13 @@ in
# services.prometheus = lib.mkIf cfg.monitoring.enable {
prometheus = {
exporters.nginx = {
enable = true;
listenAddress = "127.0.0.1";
};
exporters.nginx.enable = true;
scrapeConfigs = [
{
job_name = "nginx";
static_configs = [
{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}" ];
targets = [ "localhost:${toString config.services.prometheus.exporters.nginx.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -31,7 +31,7 @@ in
default = { };
example = literalExpression ''
{
listen = { addr = "127.0.0.1"; port = 8080; };
listen = { addr = "localhost"; port = 8080; };
providers.token.tokens = {
myuser = "MyToken";

View file

@ -25,11 +25,9 @@ in
];
extraFlags = [ "--collector.textfile.directory=/etc/prometheus-node-exporter-text-files" ];
port = 9100;
listenAddress = "127.0.0.1";
};
systemd = {
enable = true;
listenAddress = "127.0.0.1";
};
};
@ -38,7 +36,7 @@ in
job_name = "node";
static_configs = [
{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ];
labels = {
instance = config.networking.hostName;
};
@ -49,7 +47,7 @@ in
job_name = "systemd";
static_configs = [
{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.systemd.port}" ];
targets = [ "localhost:${toString config.services.prometheus.exporters.systemd.port}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -67,14 +67,14 @@ in
job_name = "immich";
static_configs = [
{
targets = [ "127.0.0.1:${toString (cfg.port + 1)}" ];
targets = [ "localhost:${toString (cfg.port + 1)}" ];
labels = {
instance = config.networking.hostName;
service = "api";
};
}
{
targets = [ "127.0.0.1:${toString (cfg.port + 2)}" ];
targets = [ "localhost:${toString (cfg.port + 2)}" ];
labels = {
instance = config.networking.hostName;
service = "server";

View file

@ -89,7 +89,6 @@ in
enable = true;
webExternalUrl = "https://monitor.${domain}";
inherit (cfg) port;
listenAddress = "127.0.0.1";
inherit (cfg) retentionTime;
@ -124,7 +123,7 @@ in
job_name = "prometheus";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
targets = [ "localhost:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};
@ -140,7 +139,7 @@ in
name = "Prometheus";
type = "prometheus";
isDefault = true;
url = "http://127.0.0.1:${toString config.services.prometheus.port}";
url = "http://localhost:${toString config.services.prometheus.port}";
jsonData = {
prometheusType = "Prometheus";
prometheusVersion = toString pkgs.prometheus.version;

View file

@ -21,7 +21,6 @@ in
enable = true;
configuration = {
server = {
http_listen_address = "127.0.0.1";
http_listen_port = cfg.port;
grpc_listen_port = 0; # without it collides with loki; only used for pushing (not used)
};
@ -30,7 +29,7 @@ in
};
clients = [
{
url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
url = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
}
];
scrape_configs = [

View file

@ -25,7 +25,7 @@ in
prometheus.exporters.exportarr-prowlarr = {
inherit (config.services.prometheus) enable;
port = port + 1;
url = "http://127.0.0.1:${toString port}";
url = "http://localhost:${toString port}";
inherit (cfg) apiKeyFile;
};
prometheus.scrapeConfigs = [
@ -33,7 +33,7 @@ in
job_name = "prowlarr";
static_configs = [
{
targets = [ "127.0.0.1:${toString port + 1}" ];
targets = [ "localhost:${toString port + 1}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -25,7 +25,7 @@ in
prometheus.exporters.exportarr-radarr = {
inherit (config.services.prometheus) enable;
port = port + 1;
url = "http://127.0.0.1:${toString port}";
url = "http://localhost:${toString port}";
inherit (cfg) apiKeyFile;
};
prometheus.scrapeConfigs = [
@ -33,7 +33,7 @@ in
job_name = "radarr";
static_configs = [
{
targets = [ "127.0.0.1:${toString port + 1}" ];
targets = [ "localhost:${toString port + 1}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -25,7 +25,7 @@ in
prometheus.exporters.exportarr-sonarr = {
inherit (config.services.prometheus) enable;
port = port + 1;
url = "http://127.0.0.1:${toString port}";
url = "http://localhost:${toString port}";
inherit (cfg) apiKeyFile;
};
prometheus.scrapeConfigs = [
@ -33,7 +33,7 @@ in
job_name = "sonarr";
static_configs = [
{
targets = [ "127.0.0.1:${toString port + 1}" ];
targets = [ "localhost:${toString port + 1}" ];
labels = {
instance = config.networking.hostName;
};

View file

@ -34,7 +34,7 @@ in
job_name = "docker";
static_configs = [
{
targets = [ "127.0.0.1:${toString config.services.cadvisor.port}" ];
targets = [ "localhost:${toString config.services.cadvisor.port}" ];
labels = {
instance = config.networking.hostName;
};