Reputation: 754
I have a server (raspberry pi connected to a fritzbox-router via ethernet) with a fresh nixos installation on it. I can connect to it via ssh
(ssh [email protected]
).
I already have some experience with nixos, but not much.
I would like it to run a zabbix server on it and connect have a web interface to connect to (for example at nixos.fritz.box/zabbix
, but I don't really care where).
I found that there are multiple packages for zabbix on https://github.com/NixOS/nixpkgs
:
Also nix search zabbix
gave me hints on zabbix-cli
and zabbixctl
, which I belive are there for managing an existing zabbix installation and therefore not helpfull for my problem.
I looked up zabbix in the options for configuration.nix and found a lot.
Most promissing looking was services.zabbixServer.enable
. I set that to true
in my config and rebuilt it. This seems to have worked:
systemctl status zabbix-server.service
● zabbix-server.service - Zabbix Server
Loaded: loaded (/nix/store/dxm7imx0ryfxdyqq5bj42klprycnpzna-unit-zabbix-server.service/zabbix-server.service; enab>
Active: active (running) since Sat 2020-10-31 17:45:59 UTC; 17h ago
Process: 14883 ExecStartPre=/nix/store/1py4ma02cnarrnx2yhz1gnjgpv4m9v06-unit-script-zabbix-server-pre-start/bin/zab>
Main PID: 14896 (zabbix_server)
IP: 41.4K in, 62.1K out
Tasks: 38 (limit: 4481)
Memory: 33.0M
...
sudo netstat -nap | grep zabbix
[sudo] password for admin:
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 14896/zabbix_server
...
But I still don't know how to connect to a web interface.
I tried to enable zabbix-web (services.zabbixWeb.enable
to true) but ran into an error and I don't know how to resolve it:
sudo nixos-rebuild switch
building Nix...
building the system configuration...
error: The option `services.zabbixWeb.virtualHost' is used but not defined.
I looked through hints on zabbix in the following manuals, but didn't find any hints on zabbix there.:
I would like to have a minimal configuration.nix
that allows to run zabbix server and connect to its webinterface with a browser.
Thanks a lot in advance
Upvotes: 1
Views: 1052
Reputation: 754
Thanks to David Grayson (whos answer I marked as solving to be fair to him) I figured that this is the minimal setup to log in as zabbix.localhost
(with the zabbix default credentials).
services.zabbixServer.enable = true;
services.zabbixWeb = {
enable = true;
virtualHost = {
hostName = "zabbix.localhost";
adminAddr = "webmaster@localhost";
};
};
Also nice to add for having a client on the server:
# technically not needed on the server, but good for testing.
services.zabbixAgent = {
enable = true;
server = "localhost";
};
Upvotes: 2
Reputation: 87386
The error message indicates that services.zabbixWeb.virtualHost
is used but not defined. The solution to this is most likely to define a value for that option. You can find the documentation for services.zabbixWeb.virtualHost
here:
In that file you will see many other options are defined, and you will probably need to set many of them too.
Upvotes: 3