1 { config, lib, pkgs, ... }:
3 cfg = config.services.opentsdb;
5 configFile = pkgs.writeText "opentsdb.conf" cfg.config;
15 enable = lib.mkEnableOption "OpenTSDB";
17 package = lib.mkPackageOption pkgs "opentsdb" { };
23 User account under which OpenTSDB runs.
27 group = lib.mkOption {
31 Group account under which OpenTSDB runs.
36 type = lib.types.port;
39 Which port OpenTSDB listens on.
43 config = lib.mkOption {
44 type = lib.types.lines;
46 tsd.core.auto_create_metrics = true
47 tsd.http.request.enable_chunked = true
50 The contents of OpenTSDB's configuration file
60 config = lib.mkIf config.services.opentsdb.enable {
62 systemd.services.opentsdb = {
63 description = "OpenTSDB Server";
64 wantedBy = [ "multi-user.target" ];
65 requires = [ "hbase.service" ];
67 environment.JAVA_HOME = "${pkgs.jre}";
68 path = [ pkgs.gnuplot ];
72 COMPRESSION=NONE HBASE_HOME=${config.services.hbase.package} ${cfg.package}/share/opentsdb/tools/create_table.sh
76 PermissionsStartOnly = true;
79 ExecStart = "${cfg.package}/bin/tsdb tsd --staticroot=${cfg.package}/share/opentsdb/static --cachedir=/tmp/opentsdb --port=${toString cfg.port} --config=${configFile}";
83 users.users.opentsdb = {
84 description = "OpenTSDB Server user";
86 uid = config.ids.uids.opentsdb;
89 users.groups.opentsdb.gid = config.ids.gids.opentsdb;