Merge pull request #134352 from astro/collectd

This commit is contained in:
Sandro 2021-08-25 13:57:24 +02:00 committed by GitHub
commit 0f0bce7c43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 86 additions and 292 deletions

@ -6,6 +6,7 @@
, jdk
, libatasmart
, libdbi
, libesmtp
, libgcrypt
, libmemcached, cyrus_sasl
, libmodbus
@ -19,12 +20,14 @@
, libvirt
, libxml2
, libapparmor, libcap_ng, numactl
, lvm2
, lua
, lvm2
, lm_sensors
, mongoc
, mosquitto
, net-snmp
, openldap
, openipmi
, perl
, postgresql
, protobufc
@ -35,7 +38,9 @@
, rrdtool
, udev
, varnish
, xen
, yajl
, IOKit
# Defaults to `null` for all supported plugins,
# list of plugin names for a custom build
, enabledPlugins ? null
@ -43,302 +48,90 @@
}:
let
# All plugins and their dependencies.
# Please help complete this!
# Plugins that have dependencies.
# Please help to extend these!
plugins = {
aggregation = {};
amqp = {
buildInputs = [ yajl ] ++
lib.optionals stdenv.isLinux [ rabbitmq-c ];
};
apache = {
buildInputs = [ curl ];
};
apcups = {};
apple_sensors = {};
aquaero = {};
ascent = {
buildInputs = [ curl libxml2 ];
};
barometer = {};
battery = {
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.IOKit
];
};
bind = {
buildInputs = [ curl libxml2 ];
};
ceph = {
buildInputs = [ yajl ];
};
cgroups = {};
chrony = {};
conntrack = {};
contextswitch = {};
cpu = {};
cpufreq = {};
cpusleep = {};
csv = {};
curl = {
buildInputs = [ curl ];
};
curl_json = {
buildInputs = [ curl yajl ];
};
curl_xml = {
buildInputs = [ curl libxml2 ];
};
dbi = {
buildInputs = [ libdbi ];
};
df = {};
disk = {
buildInputs = lib.optionals stdenv.isLinux [
udev
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.IOKit
];
};
dns = {
buildInputs = [ libpcap ];
};
dpdkevents = {};
dpdkstat = {};
drbd = {};
email = {};
entropy = {};
ethstat = {};
exec = {};
fhcount = {};
filecount = {};
fscache = {};
gmond = {};
gps = {};
grpc = {};
hddtemp = {};
hugepages = {};
intel_pmu = {};
intel_rdt = {};
interface = {};
ipc = {};
ipmi = {};
iptables = {
buildInputs = [
libpcap
] ++ lib.optionals stdenv.isLinux [
iptables libmnl
];
};
ipvs = {};
irq = {};
java = {
buildInputs = [ jdk libgcrypt libxml2 ];
};
load = {};
logfile = {};
log_logstash = {
buildInputs = [ yajl ];
};
lpar = {};
lua = {
buildInputs = [ lua ];
};
lvm = {};
madwifi = {};
match_empty_counter = {};
match_hashed = {};
match_regex = {};
match_timediff = {};
match_value = {};
mbmon = {};
mcelog = {};
md = {};
memcachec = {
buildInputs = [ libmemcached cyrus_sasl ];
};
memcached = {};
memory = {};
mic = {};
modbus = {
buildInputs = lib.optionals stdenv.isLinux [ libmodbus ];
};
mqtt = {
buildInputs = [ mosquitto ];
};
multimeter = {};
mysql = {
buildInputs = lib.optionals (libmysqlclient != null) [
libmysqlclient
];
};
netapp = {};
netlink = {
buildInputs = [
libpcap
] ++ lib.optionals stdenv.isLinux [
libmnl
];
};
network = {
buildInputs = [ libgcrypt ];
};
nfs = {};
nginx = {
buildInputs = [ curl ];
};
notify_desktop = {
buildInputs = [ libnotify gdk-pixbuf ];
};
notify_email = {};
notify_nagios = {};
ntpd = {};
numa = {};
nut = {};
olsrd = {};
onewire = {};
openldap = {};
openvpn = {};
oracle = {};
ovs_events = {
buildInputs = [ yajl ];
};
ovs_stats = {
buildInputs = [ yajl ];
};
perl = {
buildInputs = [ perl ];
};
pf = {};
pinba = {
buildInputs = [ protobufc ];
};
ping = {
buildInputs = [ liboping ];
};
postgresql = {
buildInputs = [ postgresql ];
};
powerdns = {};
processes = {};
protocols = {};
python = {
buildInputs = [ python ];
};
redis = {
buildInputs = [ hiredis ];
};
routeros = {};
rrdcached = {
buildInputs = [ rrdtool libxml2 ];
};
rrdtool = {
buildInputs = [ rrdtool libxml2 ];
};
sensors = {
buildInputs = lib.optionals stdenv.isLinux [ lm_sensors ];
};
serial = {};
sigrok = {
buildInputs = lib.optionals stdenv.isLinux [ libsigrok udev ];
};
smart = {
buildInputs = lib.optionals stdenv.isLinux [ libatasmart udev ];
};
snmp = {
buildInputs = lib.optionals stdenv.isLinux [ net-snmp ];
};
snmp_agent = {
buildInputs = lib.optionals stdenv.isLinux [ net-snmp ];
};
statsd = {};
swap = {};
synproxy = {};
syslog = {};
table = {};
tail_csv = {};
tail = {};
tape = {};
target_notification = {};
target_replace = {};
target_scale = {};
target_set = {};
target_v5upgrade = {};
tcpconns = {};
teamspeak2 = {};
ted = {};
thermal = {};
threshold = {};
tokyotyrant = {};
turbostat = {};
unixsock = {};
uptime = {};
users = {};
uuid = {};
varnish = {
buildInputs = [ curl varnish ];
};
virt = {
buildInputs = [ libvirt libxml2 yajl ] ++
lib.optionals stdenv.isLinux [ lvm2 udev
# those might be no longer required when https://github.com/NixOS/nixpkgs/pull/51767
# is merged
libapparmor numactl libcap_ng
];
};
vmem = {};
vserver = {};
wireless = {};
write_graphite = {};
write_http = {
buildInputs = [ curl yajl ];
};
write_kafka = {
buildInputs = [ yajl rdkafka ];
};
write_log = {
buildInputs = [ yajl ];
};
write_mongodb = {
buildInputs = [ mongoc ];
};
write_prometheus = {
buildInputs = [ protobufc libmicrohttpd ];
};
write_redis = {
buildInputs = [ hiredis ];
};
write_riemann = {
buildInputs = [ protobufc riemann_c_client ];
};
write_sensu = {};
write_tsdb = {};
xencpu = {};
xmms = {};
zfs_arc = {};
zone = {};
zookeeper = {};
amqp.buildInputs = [
yajl
] ++ lib.optionals stdenv.isLinux [ rabbitmq-c ];
apache.buildInputs = [ curl ];
ascent.buildInputs = [ curl libxml2 ];
battery.buildInputs = lib.optionals stdenv.isDarwin [
IOKit
];
bind.buildInputs = [ curl libxml2 ];
ceph.buildInputs = [ yajl ];
curl.buildInputs = [ curl ];
curl_json.buildInputs = [ curl yajl ];
curl_xml.buildInputs = [ curl libxml2 ];
dbi.buildInputs = [ libdbi ];
disk.buildInputs = lib.optionals stdenv.isLinux [
udev
] ++ lib.optionals stdenv.isDarwin [
IOKit
];
dns.buildInputs = [ libpcap ];
ipmi.buildInputs = [ openipmi ];
iptables.buildInputs = [
libpcap
] ++ lib.optionals stdenv.isLinux [
iptables libmnl
];
java.buildInputs = [ jdk libgcrypt libxml2 ];
log_logstash.buildInputs = [ yajl ];
lua.buildInputs = [ lua ];
memcachec.buildInputs = [ libmemcached cyrus_sasl ];
modbus.buildInputs = lib.optionals stdenv.isLinux [ libmodbus ];
mqtt.buildInputs = [ mosquitto ];
mysql.buildInputs = lib.optionals (libmysqlclient != null) [
libmysqlclient
];
netlink.buildInputs = [
libpcap
] ++ lib.optionals stdenv.isLinux [
libmnl
];
network.buildInputs = [ libgcrypt ];
nginx.buildInputs = [ curl ];
notify_desktop.buildInputs = [ libnotify gdk-pixbuf ];
notify_email.buildInputs = [ libesmtp ];
openldap.buildInputs = [ openldap ];
ovs_events.buildInputs = [ yajl ];
ovs_stats.buildInputs = [ yajl ];
perl.buildInputs = [ perl ];
pinba.buildInputs = [ protobufc ];
ping.buildInputs = [ liboping ];
postgresql.buildInputs = [ postgresql ];
python.buildInputs = [ python ];
redis.buildInputs = [ hiredis ];
rrdcached.buildInputs = [ rrdtool libxml2 ];
rrdtool.buildInputs = [ rrdtool libxml2 ];
sensors.buildInputs = lib.optionals stdenv.isLinux [ lm_sensors ];
sigrok.buildInputs = lib.optionals stdenv.isLinux [ libsigrok udev ];
smart.buildInputs = lib.optionals stdenv.isLinux [ libatasmart udev ];
snmp.buildInputs = lib.optionals stdenv.isLinux [ net-snmp ];
snmp_agent.buildInputs = lib.optionals stdenv.isLinux [ net-snmp ];
varnish.buildInputs = [ curl varnish ];
virt.buildInputs = [
libvirt libxml2 yajl
] ++ lib.optionals stdenv.isLinux [ lvm2 udev ];
write_http.buildInputs = [ curl yajl ];
write_kafka.buildInputs = [ yajl rdkafka ];
write_log.buildInputs = [ yajl ];
write_mongodb.buildInputs = [ mongoc ];
write_prometheus.buildInputs = [ protobufc libmicrohttpd ];
write_redis.buildInputs = [ hiredis ];
write_riemann.buildInputs = [ protobufc riemann_c_client ];
xencpu.buildInputs = [ xen ];
};
configureFlags =
if enabledPlugins == null
then []
else (map (plugin: "--enable-${plugin}") enabledPlugins) ++
(map (plugin: "--disable-${plugin}")
(builtins.filter (plugin: ! builtins.elem plugin enabledPlugins)
(builtins.attrNames plugins))
);
configureFlags = lib.optionals (enabledPlugins != null) (
[ "--disable-all-plugins" ]
++ (map (plugin: "--enable-${plugin}") enabledPlugins));
pluginBuildInputs = plugin:
if ! builtins.hasAttr plugin plugins
then throw "Unknown collectd plugin: ${plugin}"
else
let
pluginAttrs = builtins.getAttr plugin plugins;
in
if pluginAttrs ? "buildInputs"
then pluginAttrs.buildInputs
else [];
lib.optionals (plugins ? ${plugin} && plugins.${plugin} ? buildInputs)
plugins.${plugin}.buildInputs;
buildInputs =
if enabledPlugins == null

@ -3788,6 +3788,7 @@ with pkgs;
collectd = callPackage ../tools/system/collectd {
libsigrok = libsigrok_0_3; # not compatible with >= 0.4.0 yet
jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
inherit (darwin.apple_sdk.frameworks) IOKit;
};
collectd-data = callPackage ../tools/system/collectd/data.nix { };