made zabbix use vars.nix

This commit is contained in:
mc-fucker 2023-01-31 11:29:05 +01:00
parent efad9dfc75
commit 94be939295
3 changed files with 14 additions and 19 deletions

View file

@ -6,8 +6,9 @@
podman = { podman = {
extraOptions = [ extraOptions = [
"--dns=100.100.100.100"
"-l=io.containers.autoupdate=registry" "-l=io.containers.autoupdate=registry"
"--dns=100.100.100.100"
"--dns-search=mc-fucker.vpn.mc-fucker.cool"
]; ];
hostIP = "10.88.0.1"; hostIP = "10.88.0.1";
}; };

View file

@ -6,7 +6,7 @@ in
services.zabbixAgent = { services.zabbixAgent = {
enable = true; enable = true;
server = "mc4"; server = "mc4,10.88.1.0";
#package = pkgs.zabbix.agent2; #package = pkgs.zabbix.agent2;
package = (pkgs.callPackages ../packages/zabbix/agent2.nix {}).${version}; package = (pkgs.callPackages ../packages/zabbix/agent2.nix {}).${version};
settings = { settings = {

View file

@ -1,11 +1,10 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let
db = "zabbix"; cfg = import ./vars.nix;
db_host = "10.88.0.1"; db = cfg.zabbix.db;
version = "latest"; db_host = cfg.podman.hostIP;
port = "8999"; port = cfg.zabbix.port;
domain = "zbx.mc-fucker.cool"; domain = cfg.zabbix.domain;
podman_dns = "--dns=100.100.100.100";
server_ip = "10.88.1.0"; server_ip = "10.88.1.0";
web_ip = "10.88.1.1"; web_ip = "10.88.1.1";
in in
@ -30,31 +29,26 @@ in
}; };
virtualisation.oci-containers.containers.zabbix-server = { virtualisation.oci-containers.containers.zabbix-server = {
image = "zabbix/zabbix-server-pgsql:alpine-6.2-latest"; image = "docker.io/zabbix/zabbix-server-pgsql:alpine-6.2-latest";
environment = { environment = {
DB_SERVER_HOST = db_host; DB_SERVER_HOST = db_host;
POSTGRES_USER = db; POSTGRES_USER = db;
}; };
environmentFiles = [ /etc/nixos/keys/zabbix-env ]; environmentFiles = [ /etc/nixos/keys/zabbix-env ];
extraOptions = [ extraOptions = cfg.podman.extraOptions ++ [ "--ip=${server_ip}" ];
podman_dns
"--ip=${server_ip}"
];
}; };
virtualisation.oci-containers.containers.zabbix-web = { virtualisation.oci-containers.containers.zabbix-web = {
image = "zabbix/zabbix-web-nginx-pgsql:alpine-6.2-latest"; image = "docker.io/zabbix/zabbix-web-nginx-pgsql:alpine-6.2-latest";
environment = { environment = {
DB_SERVER_HOST = db_host; DB_SERVER_HOST = db_host;
POSTGRES_USER = db; POSTGRES_USER = db;
ZBX_SERVER_HOST = server_ip; ZBX_SERVER_HOST = server_ip;
ZBX_SERVER_NAME = "Superbly Managed Networks and Hosting";
PHP_TZ = "Europe/Berlin"; PHP_TZ = "Europe/Berlin";
}; };
environmentFiles = [ /etc/nixos/keys/zabbix-env ]; environmentFiles = [ /etc/nixos/keys/zabbix-env ];
extraOptions = [ extraOptions = cfg.podman.extraOptions ++ [ "--ip=${web_ip}" ];
podman_dns
"--ip=${web_ip}"
];
ports = [ "${port}:8080" ]; ports = [ "${port}:8080" ];
}; };
@ -70,7 +64,7 @@ in
''; '';
}; };
networking.firewall.interfaces.podman0.allowedTCPPorts = [ 5432 ]; networking.firewall.interfaces.podman0.allowedTCPPorts = [ 5432 10050 ];
} }
# vim: set et ts=2 sw=2 ai: # vim: set et ts=2 sw=2 ai: