summaryrefslogtreecommitdiffstats
path: root/shared/2configs/collectd-base.nix
blob: b2ec40b285cc1219a8560f141f4bd0a29879b2e0 (plain)
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
{ config, lib, pkgs, ... }:

# TODO: krebs.collectd.plugins
with lib;
let
  connect-time-cfg = with pkgs; writeText "collectd-connect-time.conf" ''
    LoadPlugin python
    <Plugin python>
      ModulePath "${collectd-connect-time}/lib/${python.libPrefix}/site-packages/"
      Import "collectd_connect_time"
      <Module collectd_connect_time>
        target "heidi.retiolum:8080" "localhost" "google.com" "google.de" "omo.retiolum" "gum.retiolum" "gum.krebsco.de"
        interval 10
      </Module>
    </Plugin>
  '';
  graphite-cfg = pkgs.writeText "collectd-graphite.conf" ''
    LoadPlugin write_graphite
    <Plugin "write_graphite">
      <Carbon>
        Host "heidi.retiolum"
        Port "2003"
        Prefix "retiolum."
        EscapeCharacter "_"
        StoreRates false
        AlwaysAppendDS false
      </Carbon>
    </Plugin>
  '';
in {
  imports = [ ];

  nixpkgs.config.packageOverrides = pkgs: with pkgs; {
    collectd = pkgs.collectd.override { python= pkgs.python; };
  };
  services.collectd = {
    enable = true;
    include = [ (toString connect-time-cfg) (toString graphite-cfg) ];
  };

}