Skip to content
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
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf52cd402c7e
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cc9b18f223eb
Choose a head ref
  • 5 commits
  • 3 files changed
  • 2 contributors

Commits on Oct 19, 2019

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    e2283d9 View commit details
  2. Copy the full SHA
    efab039 View commit details
  3. Copy the full SHA
    06abd24 View commit details
  4. Copy the full SHA
    690b3c4 View commit details

Commits on Oct 21, 2019

  1. Merge pull request #71406 from astro/collectd

    collectd: plugins configuration, buildMinimalPackage
    fpletz authored Oct 21, 2019
    Copy the full SHA
    cc9b18f View commit details
Showing with 392 additions and 57 deletions.
  1. +36 −3 nixos/modules/services/monitoring/collectd.nix
  2. +9 −54 pkgs/tools/system/collectd/default.nix
  3. +347 −0 pkgs/tools/system/collectd/plugins.nix
39 changes: 36 additions & 3 deletions nixos/modules/services/monitoring/collectd.nix
Original file line number Diff line number Diff line change
@@ -16,13 +16,29 @@ let
NotifyLevel "OKAY"
</Plugin>
${concatStrings (mapAttrsToList (plugin: pluginConfig: ''
LoadPlugin ${plugin}
<Plugin "${plugin}">
${pluginConfig}
</Plugin>
'') cfg.plugins)}
${concatMapStrings (f: ''
Include "${f}"
Include "${f}"
'') cfg.include}
${cfg.extraConfig}
'';

package =
if cfg.buildMinimalPackage
then minimalPackage
else cfg.package;

minimalPackage = cfg.package.override {
enabledPlugins = [ "syslog" ] ++ builtins.attrNames cfg.plugins;
};

in {
options.services.collectd = with types; {
enable = mkEnableOption "collectd agent";
@@ -33,7 +49,15 @@ in {
description = ''
Which collectd package to use.
'';
type = package;
type = types.package;
};

buildMinimalPackage = mkOption {
default = false;
description = ''
Build a minimal collectd package with only the configured `services.collectd.plugins`
'';
type = types.bool;
};

user = mkOption {
@@ -68,6 +92,15 @@ in {
type = listOf str;
};

plugins = mkOption {
default = {};
example = { cpu = ""; memory = ""; network = "Server 192.168.1.1 25826"; };
description = ''
Attribute set of plugin names to plugin config segments
'';
type = types.attrsOf types.str;
};

extraConfig = mkOption {
default = "";
description = ''
@@ -89,7 +122,7 @@ in {
wantedBy = [ "multi-user.target" ];

serviceConfig = {
ExecStart = "${cfg.package}/sbin/collectd -C ${conf} -f";
ExecStart = "${package}/sbin/collectd -C ${conf} -f";
User = cfg.user;
Restart = "on-failure";
RestartSec = 3;
63 changes: 9 additions & 54 deletions pkgs/tools/system/collectd/default.nix
Original file line number Diff line number Diff line change
@@ -1,45 +1,12 @@
{ stdenv, fetchurl, fetchpatch, darwin
{ stdenv, fetchurl, fetchpatch, darwin, callPackage
, autoreconfHook
, pkgconfig
, curl
, iptables
, jdk
, libapparmor
, libatasmart
, libcap_ng
, libcredis
, libdbi
, libgcrypt
, libmemcached, cyrus_sasl
, libmicrohttpd
, libmodbus
, libnotify, gdk-pixbuf
, liboping
, libpcap
, libsigrok
, libvirt
, libxml2
, libtool
, lm_sensors
, lvm2
, libmysqlclient
, numactl
, postgresql
, protobufc
, python
, rabbitmq-c
, riemann_c_client
, rrdtool
, udev
, varnish
, yajl
, net_snmp
, hiredis
, libmnl
, mosquitto
, rdkafka
, mongoc
}:
, ...
}@args:
let
plugins = callPackage ./plugins.nix args;
in
stdenv.mkDerivation rec {
version = "5.8.1";
pname = "collectd";
@@ -58,27 +25,15 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [ pkgconfig autoreconfHook ];
buildInputs = [
curl libdbi libgcrypt libmemcached
cyrus_sasl libnotify gdk-pixbuf liboping libpcap libvirt
libxml2 postgresql protobufc rrdtool
varnish yajl jdk libtool python hiredis libmicrohttpd
riemann_c_client mosquitto rdkafka mongoc
] ++ stdenv.lib.optionals (libmysqlclient != null) [ libmysqlclient
] ++ stdenv.lib.optionals stdenv.isLinux [
iptables libatasmart libcredis libmodbus libsigrok
lm_sensors lvm2 rabbitmq-c udev net_snmp libmnl
# those might be no longer required when https://github.com/NixOS/nixpkgs/pull/51767
# is merged
libapparmor numactl libcap_ng
libtool
] ++ stdenv.lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.IOKit
darwin.apple_sdk.frameworks.ApplicationServices
];
] ++ plugins.buildInputs;

configureFlags = [
"--localstatedir=/var"
"--disable-werror"
];
] ++ plugins.configureFlags;

# do not create directories in /var during installPhase
postConfigure = ''
Loading