summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/stats
diff options
context:
space:
mode:
Diffstat (limited to 'makefu/2configs/stats')
-rw-r--r--makefu/2configs/stats/arafetch.nix24
-rw-r--r--makefu/2configs/stats/telegraf/default.nix10
2 files changed, 27 insertions, 7 deletions
diff --git a/makefu/2configs/stats/arafetch.nix b/makefu/2configs/stats/arafetch.nix
index 6ab9d3774..a078e3646 100644
--- a/makefu/2configs/stats/arafetch.nix
+++ b/makefu/2configs/stats/arafetch.nix
@@ -2,18 +2,19 @@
with import <stockholm/lib>;
let
pkg = with pkgs.python3Packages;buildPythonPackage rec {
- rev = "775d0c2";
+ rev = "cce2394";
name = "arafetch-${rev}";
propagatedBuildInputs = [
requests
docopt
influxdb
beautifulsoup4
+ paho-mqtt
];
src = pkgs.fetchgit {
url = "http://cgit.euer.krebsco.de/arafetch";
inherit rev;
- sha256 = "0z35avn7vmbd1661ca1zkc9i4lwcm03kpwgiqxddpkp1yxhl548p";
+ sha256 = "sha256:0zdz8sqn9n8i69rqngcg7nakmvahf1i5dwajzjpylsh1x5csv2gs";
};
};
home = "/var/lib/arafetch";
@@ -24,13 +25,25 @@ in {
createHome = true;
};
+ systemd.services.ara2mqtt = {
+ startAt = "05:00:00";
+ after = [ "network-online.target" ];
+ path = [ pkg ];
+ serviceConfig = {
+ User = "arafetch";
+ # Restart = "always";
+ WorkingDirectory = home;
+ PrivateTmp = true;
+ ExecStart = pkgs.writeDash "daily-mqtt" ''
+ ara2mqtt db/thales-deutschland.json --cantine thales-deutschland --host localhost
+ '';
+ };
+ };
systemd.services.arafetch = {
startAt = "Mon,Wed,Fri 09:15:00";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
- environment = {
- OUTDIR = home;
- };
+ environment.OUTDIR = home;
path = [ pkg pkgs.git pkgs.wget ];
serviceConfig = {
User = "arafetch";
@@ -38,7 +51,6 @@ in {
WorkingDirectory = home;
PrivateTmp = true;
ExecStart = pkgs.writeDash "start-weekrun" ''
- set -x
weekrun || echo "weekrun failed!"
find $OUTDIR/db -name \*.json | while read path;do
file=''${path##*/}
diff --git a/makefu/2configs/stats/telegraf/default.nix b/makefu/2configs/stats/telegraf/default.nix
index 049a9c037..c60539c71 100644
--- a/makefu/2configs/stats/telegraf/default.nix
+++ b/makefu/2configs/stats/telegraf/default.nix
@@ -1,16 +1,24 @@
{...}:
let
url = "http://localhost:8086";
+ mqtt_server = "localhost:1883";
in {
services.telegraf = {
enable = true;
extraConfig = {
- agent.debug = true;
+ agent.debug = false;
outputs = {
influxdb = [{
urls = [ url ];
database = "telegraf";
}];
+ mqtt = [{
+ servers = [ mqtt_server ];
+ topic_prefix = "/telegraf";
+ data_format = "json";
+ qos = 0;
+ batch = false;
+ }];
};
};
};