Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2c3f18721e2f
Choose a base ref
...
head repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 594dfcd63b0e
Choose a head ref
  • 19 commits
  • 25 files changed
  • 11 contributors

Commits on Jul 8, 2019

  1. gitlab-runner: 11.11.2 -> 12.0.2

    12.0.1 fixes an issue with git submodule fetching
    12.0.2 fixes an issue with concurrent updated
    bachp committed Jul 8, 2019
    Copy the full SHA
    e928aa6 View commit details

Commits on Jul 11, 2019

  1. nixos/dhcpcd: Before network-online.target

    Instead of network.target. Fixes #60900 (delayed boot).
    gloaming committed Jul 11, 2019
    Copy the full SHA
    2ae58df View commit details
  2. Copy the full SHA
    e2b348d View commit details
  3. electrum: 3.3.7 -> 3.3.8

    arcnmx committed Jul 11, 2019
    Copy the full SHA
    769f992 View commit details
  4. electrum: optional qt5 and darwin fixes

    qt5 is often broken on darwin, and it's a massive closure when there's
    a curses interface and CLI to use instead.
    arcnmx committed Jul 11, 2019
    Copy the full SHA
    36f9da4 View commit details
  5. zabbix: zabbix.agent, zabbix.proxy-mysql, zabbix.proxy-pgsql, zabbix.…

    …proxy-sqlite, zabbix.server-mysql, zabbix.server-pgsql, zabbix.web: init at 3.0, 4.0, and 4.2
    aanderse committed Jul 11, 2019
    Copy the full SHA
    9a4456f View commit details
  6. Copy the full SHA
    6891fb4 View commit details
  7. Copy the full SHA
    70092c9 View commit details
  8. Copy the full SHA
    4191c80 View commit details

Commits on Jul 12, 2019

  1. SDL_gpu: init at 20190124

    Philipp Middendorf committed Jul 12, 2019
    Copy the full SHA
    e72a02e View commit details
  2. Merge pull request #64636 from arcnmx/electrum-update

    electrum 3.3.8, optional qt, darwin fixes
    joachifm authored Jul 12, 2019
    Copy the full SHA
    f8a9a50 View commit details
  3. Merge pull request #62665 from vanschelven/pytest-flask

    pythonPackages.pytest-flask: init at 0.15.0
    worldofpeace authored Jul 12, 2019
    Copy the full SHA
    db43e58 View commit details
  4. Merge pull request #63844 from aanderse/zabbix-cleanup

    nixos/zabbix: overhaul package & module
    aanderse authored Jul 12, 2019
    Copy the full SHA
    c13fbe0 View commit details
  5. Merge pull request #63608 from plapadoo/sdl-gpu-init

    SDL_gpu: init at 20190124
    aanderse authored Jul 12, 2019
    Copy the full SHA
    2519fe3 View commit details
  6. gitlab-runner: 11.11.2 -> 12.0.2 (#63771)

     gitlab-runner: 11.11.2 -> 12.0.2
    flokli authored Jul 12, 2019
    Copy the full SHA
    3019a68 View commit details
  7. Merge pull request #64621 from gloaming/dhcpcd-before-network-online

    nixos/dhcpcd: Before network-online.target
    flokli authored Jul 12, 2019
    Copy the full SHA
    a234b91 View commit details
  8. Copy the full SHA
    aab4806 View commit details
  9. Merge pull request #63496 from tadeokondrak/discord-rpc/init/3.4.0

    discord-rpc: init at 3.4.0
    aanderse authored Jul 12, 2019
    Copy the full SHA
    cc9ec8a View commit details
  10. axel: 2.17.1 -> 2.17.3

    xrelkd authored and FRidh committed Jul 12, 2019
    Copy the full SHA
    594dfcd View commit details
6 changes: 3 additions & 3 deletions nixos/doc/manual/release-notes/rl-1909.xml
Original file line number Diff line number Diff line change
@@ -137,9 +137,9 @@
<listitem>
<para>
Several of the apache subservices have been replaced with full NixOS
modules including LimeSurvey and WordPress.
These modules can be enabled using the <option>services.limesurvey.enable</option>
and <option>services.wordpress.enable</option> options.
modules including LimeSurvey, WordPress, and Zabbix.
These modules can be enabled using the <option>services.limesurvey.enable</option>,
<option>services.wordpress.enable</option>, and <option>services.zabbixWeb.enable</option> options.
</para>
</listitem>
<listitem>
2 changes: 1 addition & 1 deletion nixos/modules/misc/ids.nix
Original file line number Diff line number Diff line change
@@ -516,7 +516,7 @@
tss = 176;
#memcached = 177; # unused, removed 2018-01-03
#ntp = 179; # unused
#zabbix = 180; # unused
zabbix = 180;
#redis = 181; # unused, removed 2018-01-03
#unifi = 183; # unused
#uptimed = 184; # unused
2 changes: 2 additions & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
@@ -516,6 +516,7 @@
./services/monitoring/uptime.nix
./services/monitoring/vnstat.nix
./services/monitoring/zabbix-agent.nix
./services/monitoring/zabbix-proxy.nix
./services/monitoring/zabbix-server.nix
./services/network-filesystems/beegfs.nix
./services/network-filesystems/cachefilesd.nix
@@ -782,6 +783,7 @@
./services/web-apps/virtlyst.nix
./services/web-apps/wordpress.nix
./services/web-apps/youtrack.nix
./services/web-apps/zabbix.nix
./services/web-servers/apache-httpd/default.nix
./services/web-servers/caddy.nix
./services/web-servers/fcgiwrap.nix
4 changes: 4 additions & 0 deletions nixos/modules/rename.nix
Original file line number Diff line number Diff line change
@@ -171,6 +171,9 @@ with lib;
The starting time can be configured via <literal>services.postgresqlBackup.startAt</literal>.
'')

# zabbixServer
(mkRenamedOptionModule [ "services" "zabbixServer" "dbServer" ] [ "services" "zabbixServer" "database" "host" ])

# Profile splitting
(mkRenamedOptionModule [ "virtualisation" "growPartition" ] [ "boot" "growPartition" ])

@@ -214,6 +217,7 @@ with lib;
(mkRemovedOptionModule [ "services" "winstone" ] "The corresponding package was removed from nixpkgs.")
(mkRemovedOptionModule [ "services" "mysql" "pidDir" ] "Don't wait for pidfiles, describe dependencies through systemd")
(mkRemovedOptionModule [ "services" "mysql" "rootPassword" ] "Use socket authentication or set the password outside of the nix store.")
(mkRemovedOptionModule [ "services" "zabbixServer" "dbPassword" ] "Use services.zabbixServer.database.passwordFile instead.")

# ZSH
(mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])
163 changes: 104 additions & 59 deletions nixos/modules/services/monitoring/zabbix-agent.nix
Original file line number Diff line number Diff line change
@@ -1,112 +1,157 @@
# Zabbix agent daemon.
{ config, lib, pkgs, ... }:

with lib;

let

cfg = config.services.zabbixAgent;

zabbix = cfg.package;

stateDir = "/run/zabbix";

logDir = "/var/log/zabbix";

pidFile = "${stateDir}/zabbix_agentd.pid";
inherit (lib) mkDefault mkEnableOption mkIf mkOption;
inherit (lib) attrValues concatMapStringsSep literalExample optionalString types;

configFile = pkgs.writeText "zabbix_agentd.conf"
''
Server = ${cfg.server}
user = "zabbix-agent";
group = "zabbix-agent";

LogFile = ${logDir}/zabbix_agentd
PidFile = ${pidFile}
StartAgents = 1
moduleEnv = pkgs.symlinkJoin {
name = "zabbix-agent-module-env";
paths = attrValues cfg.modules;
};

${config.services.zabbixAgent.extraConfig}
'';
configFile = pkgs.writeText "zabbix_agent.conf" ''
LogType = console
Server = ${cfg.server}
ListenIP = ${cfg.listen.ip}
ListenPort = ${toString cfg.listen.port}
${optionalString (cfg.modules != {}) "LoadModulePath = ${moduleEnv}/lib"}
${concatMapStringsSep "\n" (name: "LoadModule = ${name}") (builtins.attrNames cfg.modules)}
${cfg.extraConfig}
'';

in

{

###### interface
# interface

options = {

services.zabbixAgent = {
enable = mkEnableOption "the Zabbix Agent";

enable = mkOption {
default = false;
package = mkOption {
type = types.package;
default = pkgs.zabbix.agent;
defaultText = "pkgs.zabbix.agent";
description = "The Zabbix package to use.";
};

extraPackages = mkOption {
type = types.listOf types.package;
default = with pkgs; [ nettools ];
defaultText = "[ nettools ]";
example = "[ nettools mysql ]";
description = ''
Whether to run the Zabbix monitoring agent on this machine.
It will send monitoring data to a Zabbix server.
Packages to be added to the Zabbix <envar>PATH</envar>.
Typically used to add executables for scripts, but can be anything.
'';
};

package = mkOption {
type = types.attrs; # Note: pkgs.zabbixXY isn't a derivation, but an attrset of { server = ...; agent = ...; }.
default = pkgs.zabbix;
defaultText = "pkgs.zabbix";
example = literalExample "pkgs.zabbix34";
description = ''
The Zabbix package to use.
modules = mkOption {
type = types.attrsOf types.package;
description = "A set of modules to load.";
default = {};
example = literalExample ''
{
"dummy.so" = pkgs.stdenv.mkDerivation {
name = "zabbix-dummy-module-''${cfg.package.version}";
src = cfg.package.src;
buildInputs = [ cfg.package ];
sourceRoot = "zabbix-''${cfg.package.version}/src/modules/dummy";
installPhase = '''
mkdir -p $out/lib
cp dummy.so $out/lib/
''';
};
}
'';
};

server = mkOption {
default = "127.0.0.1";
type = types.str;
description = ''
The IP address or hostname of the Zabbix server to connect to.
'';
};

listen = {
ip = mkOption {
type = types.str;
default = "0.0.0.0";
description = ''
List of comma delimited IP addresses that the agent should listen on.
'';
};

port = mkOption {
type = types.port;
default = 10050;
description = ''
Agent will listen on this port for connections from the server.
'';
};
};

openFirewall = mkOption {
type = types.bool;
default = false;
description = ''
Open ports in the firewall for the Zabbix Agent.
'';
};

# TODO: for bonus points migrate this to https://github.com/NixOS/rfcs/pull/42
extraConfig = mkOption {
default = "";
type = types.lines;
description = ''
Configuration that is injected verbatim into the configuration file.
Configuration that is injected verbatim into the configuration file. Refer to
<link xlink:href="https://www.zabbix.com/documentation/current/manual/appendix/config/zabbix_agentd"/>
for details on supported values.
'';
};

};

};


###### implementation
# implementation

config = mkIf cfg.enable {

users.users = mkIf (!config.services.zabbixServer.enable) (singleton
{ name = "zabbix";
uid = config.ids.uids.zabbix;
description = "Zabbix daemon user";
});
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.listen.port ];
};

systemd.services."zabbix-agent" =
{ description = "Zabbix Agent";
users.users.${user} = {
description = "Zabbix Agent daemon user";
inherit group;
};

wantedBy = [ "multi-user.target" ];
users.groups.${group} = { };

path = [ pkgs.nettools ];
systemd.services."zabbix-agent" = {
description = "Zabbix Agent";

preStart =
''
mkdir -m 0755 -p ${stateDir} ${logDir}
chown zabbix ${stateDir} ${logDir}
'';
wantedBy = [ "multi-user.target" ];

serviceConfig.ExecStart = "@${zabbix.agent}/sbin/zabbix_agentd zabbix_agentd --config ${configFile}";
serviceConfig.Type = "forking";
serviceConfig.RemainAfterExit = true;
serviceConfig.Restart = "always";
serviceConfig.RestartSec = 2;
};
path = [ "/run/wrappers" ] ++ cfg.extraPackages;

serviceConfig = {
ExecStart = "@${cfg.package}/sbin/zabbix_agentd zabbix_agentd -f --config ${configFile}";
Restart = "always";
RestartSec = 2;

environment.systemPackages = [ zabbix.agent ];
User = user;
Group = group;
PrivateTmp = true;
};
};

};

Loading