ma telegraf: init

also add europastats
This commit is contained in:
makefu 2017-09-19 16:37:46 +02:00
parent 4ea52583d1
commit 21c284a2c7
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,20 @@
{...}:
let
url = "http://localhost:8086";
in {
imports = [
./europastats.nix
];
services.telegraf = {
enable = true;
extraConfig = {
agent.debug = true;
outputs = {
influxdb = [{
urls = [ url ];
database = "telegraf";
}];
};
};
};
}

View File

@ -0,0 +1,43 @@
{ pkgs, ...}:
let
pkg = with pkgs.python3Packages;buildPythonPackage rec {
rev = "be31da7";
name = "europastats-${rev}";
propagatedBuildInputs = [
requests2
docopt
];
src = pkgs.fetchgit {
url = "http://cgit.euer.krebsco.de/europastats";
inherit rev;
sha256 = "0qj18vgj9nm6aisyqhk3iz3rf8xp7mn5jc6sfylcaw588a9sjfvc";
};
};
in {
services.telegraf.extraConfig.inputs.exec = [
{
commands = [ "${pkg}/bin/europa-attractions"];
timeout = "1m";
data_format = "json";
name_override = "europawaiting";
interval = "1m";
tag_keys = [
"status"
"type"
"name"
];
}
{
commands = [ "${pkg}/bin/europa-weather"];
timeout = "20s";
data_format = "json";
name_override = "europaweather";
interval = "10m";
tag_keys = [
"type"
"name"
"offset"
];
}
];
}