add influx listener to telegraf
This commit is contained in:
parent
72fffad326
commit
fa4fafa7a9
@ -2,6 +2,7 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
mypkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
makeVirtualHost = {
|
makeVirtualHost = {
|
||||||
@ -78,7 +79,7 @@ in {
|
|||||||
|
|
||||||
firewall = {
|
firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [22 111 443 2049 4000 4001 4002 20048];
|
allowedTCPPorts = [22 111 443 2049 4000 4001 4002 9999 20048];
|
||||||
allowedUDPPorts = [53 111 2049 4000 4001 4002 20048];
|
allowedUDPPorts = [53 111 2049 4000 4001 4002 20048];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -97,6 +98,7 @@ in {
|
|||||||
rtl_433
|
rtl_433
|
||||||
dump1090
|
dump1090
|
||||||
rtl-sdr
|
rtl-sdr
|
||||||
|
mypkgs.nixvim
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users."root".openssh.authorizedKeys.keys = [
|
users.users."root".openssh.authorizedKeys.keys = [
|
||||||
@ -258,13 +260,16 @@ in {
|
|||||||
environmentFiles = [config.sops.secrets."telegraf_api_token".path];
|
environmentFiles = [config.sops.secrets."telegraf_api_token".path];
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
inputs = {
|
inputs = {
|
||||||
|
influxdb_v2_listener = {
|
||||||
|
service_address = "127.0.0.1:9998";
|
||||||
|
};
|
||||||
|
|
||||||
prometheus = {
|
prometheus = {
|
||||||
urls = [
|
urls = [
|
||||||
"http://127.0.0.1:${builtins.toString config.services.prometheus.exporters.zfs.port}"
|
"http://127.0.0.1:${builtins.toString config.services.prometheus.exporters.zfs.port}"
|
||||||
"http://127.0.0.1:${builtins.toString config.services.prometheus.exporters.smartctl.port}"
|
"http://127.0.0.1:${builtins.toString config.services.prometheus.exporters.smartctl.port}"
|
||||||
"http://127.0.0.1:${builtins.toString config.services.prometheus.exporters.systemd.port}"
|
"http://127.0.0.1:${builtins.toString config.services.prometheus.exporters.systemd.port}"
|
||||||
"http://127.0.0.1:${builtins.toString config.services.prometheus.exporters.node.port}"
|
"http://127.0.0.1:${builtins.toString config.services.prometheus.exporters.node.port}"
|
||||||
"http://127.0.0.1:8123"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -274,7 +279,7 @@ in {
|
|||||||
token = "\${TELEGRAF_API_TOKEN}";
|
token = "\${TELEGRAF_API_TOKEN}";
|
||||||
organization = "fuckwit.dev";
|
organization = "fuckwit.dev";
|
||||||
bucket = "world";
|
bucket = "world";
|
||||||
timeout = "10s";
|
timeout = "60s";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -283,7 +288,25 @@ in {
|
|||||||
nginx = {
|
nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
clientMaxBodySize = "500m";
|
clientMaxBodySize = "500m";
|
||||||
virtualHosts = makeVirtualHosts [
|
virtualHosts =
|
||||||
|
# Tasmota devices check /health of the influxdb2 server.
|
||||||
|
# Telegraf does not provide this endpoint so we fake it via nginx
|
||||||
|
# https://github.com/influxdata/telegraf/issues/16321
|
||||||
|
{
|
||||||
|
"influxdb-proxy.fuckwit.dev" = {
|
||||||
|
listen = [
|
||||||
|
{
|
||||||
|
port = 9999;
|
||||||
|
addr = "0.0.0.0";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
locations = {
|
||||||
|
"/health".return = "200 ''";
|
||||||
|
"/".proxyPass = "http://127.0.0.1:9998";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// makeVirtualHosts [
|
||||||
{
|
{
|
||||||
subdomain = "jdownloader";
|
subdomain = "jdownloader";
|
||||||
port = 5800;
|
port = 5800;
|
||||||
@ -582,17 +605,17 @@ in {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
qbittorrent-exporter = {
|
# qbittorrent-exporter = {
|
||||||
image = "docker.io/esanchezm/prometheus-qbittorrent-exporter";
|
# image = "docker.io/esanchezm/prometheus-qbittorrent-exporter";
|
||||||
autoStart = true;
|
# autoStart = true;
|
||||||
networks = ["container:gluetun"];
|
# networks = ["container:gluetun"];
|
||||||
dependsOn = ["qbittorrent"];
|
# dependsOn = ["qbittorrent"];
|
||||||
environment = {
|
# environment = {
|
||||||
QBITTORRENT_PORT = "8080";
|
# QBITTORRENT_PORT = "8080";
|
||||||
QBITTORRENT_HOST = "127.0.0.1";
|
# QBITTORRENT_HOST = "127.0.0.1";
|
||||||
EXPORTER_PORT = "8123";
|
# EXPORTER_PORT = "8123";
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
sops-nix,
|
sops-nix,
|
||||||
lanzaboote,
|
lanzaboote,
|
||||||
simple-nixos-mailserver,
|
simple-nixos-mailserver,
|
||||||
|
nixvim,
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
@ -50,7 +51,7 @@
|
|||||||
}:
|
}:
|
||||||
np.lib.nixosSystem {
|
np.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = {mypkgs = customPkgs."${system}";};
|
specialArgs = {mypkgs = customPkgs."${system}" // { nixvim = nixvim.packages.${system}.default;};};
|
||||||
modules =
|
modules =
|
||||||
defaultModules
|
defaultModules
|
||||||
++ [
|
++ [
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
certificateScheme = "acme-nginx";
|
certificateScheme = "acme";
|
||||||
|
acmeCertificateName = "fuckwit.dev";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user