l 3 telegraf: split config into inputs/outputs

This commit is contained in:
lassulus 2017-01-30 22:56:12 +01:00
parent 26b3298f77
commit f0a345d79b

View File

@ -21,6 +21,26 @@ let
type = types.str;
default = "telegraf";
};
outputs = mkOption {
type = types.str;
default = ''
[outputs.influxdb]
urls = ["http://localhost:8086"]
database = "all_data"
user_agent = "telegraf"
'';
};
inputs = mkOption {
type = with types; listOf str;
default = [
''
[cpu]
percpu = false
totalcpu = true
drop = ["cpu_time"]
''
];
};
config = mkOption {
type = types.str;
#TODO: find a good default
@ -30,17 +50,10 @@ let
[outputs]
# Configuration to send data to InfluxDB.
[outputs.influxdb]
urls = ["http://localhost:8086"]
database = "kapacitor_example"
user_agent = "telegraf"
${cfg.outputs}
${concatStringsSep "\n" cfg.inputs}
# Collect metrics about cpu usage
[cpu]
percpu = false
totalcpu = true
drop = ["cpu_time"]
'';
description = "configuration telegraf is started with";
};