summaryrefslogtreecommitdiffstats
path: root/lass/3modules/telegraf.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-02-04 14:31:47 +0100
committermakefu <github@syntax-fehler.de>2017-02-04 14:31:47 +0100
commitd6c9edd9dc860d560d4ea7a727962aaf93d09322 (patch)
treeaefb49a9372b959cd722bdfcf51001783cda8bb1 /lass/3modules/telegraf.nix
parentd2df5375e705e55764b4cacd4ea32dffcb4c6041 (diff)
parent8daef993dcb6149a02c72a4895d6e808a6c6a8d4 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/3modules/telegraf.nix')
-rw-r--r--lass/3modules/telegraf.nix39
1 files changed, 28 insertions, 11 deletions
diff --git a/lass/3modules/telegraf.nix b/lass/3modules/telegraf.nix
index 64b323460..0b3be2d69 100644
--- a/lass/3modules/telegraf.nix
+++ b/lass/3modules/telegraf.nix
@@ -21,26 +21,43 @@ let
type = types.str;
default = "telegraf";
};
+ outputs = mkOption {
+ type = types.str;
+ default = ''
+ [outputs.influxdb]
+ urls = ["http://localhost:8086"]
+ database = "telegraf_db"
+ user_agent = "telegraf"
+ '';
+ };
+ inputs = mkOption {
+ type = with types; listOf str;
+ default = [
+ ''
+ [cpu]
+ percpu = false
+ totalcpu = true
+ drop = ["cpu_time"]
+ ''
+ ];
+ };
+ interval = mkOption {
+ type = types.str;
+ default = "10s";
+ };
config = mkOption {
type = types.str;
#TODO: find a good default
default = ''
[agent]
- interval = "1s"
+ interval = "${cfg.interval}"
[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";
};