summary refs log tree commit diff
path: root/pkgs/tools/system/collectd/plugins.nix
blob: f1a87847a5ced6b48803fa1fdf7d35ba6d2c2fb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
{ stdenv
, curl
, darwin
, hiredis
, iptables
, jdk
, libatasmart
, libdbi
, libgcrypt
, libmemcached, cyrus_sasl
, libmodbus
, libmicrohttpd
, libmnl
, libmysqlclient
, libnotify, gdk-pixbuf
, liboping
, libpcap
, libsigrok
, libvirt
, libxml2
, libapparmor, libcap_ng, numactl
, lvm2
, lua
, lm_sensors
, mongoc
, mosquitto
, net-snmp
, postgresql
, protobufc
, python
, rabbitmq-c
, rdkafka
, riemann_c_client
, rrdtool
, udev
, varnish
, yajl
# Defaults to `null` for all supported plugins,
# list of plugin names for a custom build
, enabledPlugins ? null
, ...
}:

let
  # All plugins and their dependencies.
  # Please help complete this!
  plugins = {
    aggregation = {};
    amqp = {
      buildInputs = [ yajl ] ++
        stdenv.lib.optionals stdenv.isLinux [ rabbitmq-c ];
    };
    apache = {
      buildInputs = [ curl ];
    };
    apcups = {};
    apple_sensors = {};
    aquaero = {};
    ascent = {
      buildInputs = [ curl libxml2 ];
    };
    barometer = {};
    battery = {
      buildInputs = stdenv.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 = stdenv.lib.optionals stdenv.isLinux [
        udev
      ] ++ stdenv.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
      ] ++ stdenv.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 = stdenv.lib.optionals stdenv.isLinux [ libmodbus ];
    };
    mqtt = {
      buildInputs = [ mosquitto ];
    };
    multimeter = {};
    mysql = {
      buildInputs = stdenv.lib.optionals (libmysqlclient != null) [
        libmysqlclient
      ];
    };
    netapp = {};
    netlink = {
      buildInputs = [
        libpcap
      ] ++ stdenv.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 = {};
    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 = stdenv.lib.optionals stdenv.isLinux [ lm_sensors ];
    };
    serial = {};
    sigrok = {
      buildInputs = stdenv.lib.optionals stdenv.isLinux [ libsigrok udev ];
    };
    smart = {
      buildInputs = stdenv.lib.optionals stdenv.isLinux [ libatasmart udev ];
    };
    snmp = {
      buildInputs = stdenv.lib.optionals stdenv.isLinux [ net-snmp ];
    };
    snmp_agent = {
      buildInputs = stdenv.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 ] ++
        stdenv.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 = {};
  };

  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))
    );

  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 [];

  buildInputs =
    if enabledPlugins == null
    then builtins.concatMap pluginBuildInputs
      (builtins.attrNames plugins)
    else builtins.concatMap pluginBuildInputs enabledPlugins;
in {
  inherit configureFlags buildInputs;
}