summaryrefslogtreecommitdiffstats
path: root/lass/3modules
diff options
context:
space:
mode:
authorlassulus <lass@lassul.us>2017-01-30 22:56:12 +0100
committerlassulus <lass@lassul.us>2017-01-30 22:56:12 +0100
commitf0a345d79b0ab80d2e38baddba7f19e40241c79a (patch)
tree86a05ae540d5cac25afd925a7f5ee7a467355718 /lass/3modules
parent26b3298f774f95806af7b253edeb3624c32cc9a1 (diff)
l 3 telegraf: split config into inputs/outputs
Diffstat (limited to 'lass/3modules')
-rw-r--r--lass/3modules/telegraf.nix33
1 files changed, 23 insertions, 10 deletions
diff --git a/lass/3modules/telegraf.nix b/lass/3modules/telegraf.nix
index 64b323460..a54e71a9d 100644
--- a/lass/3modules/telegraf.nix
+++ b/lass/3modules/telegraf.nix
@@ -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";
};