summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/stats
diff options
context:
space:
mode:
Diffstat (limited to 'makefu/2configs/stats')
-rw-r--r--makefu/2configs/stats/server.nix6
-rw-r--r--makefu/2configs/stats/telegraf/default.nix20
-rw-r--r--makefu/2configs/stats/telegraf/europastats.nix43
3 files changed, 67 insertions, 2 deletions
diff --git a/makefu/2configs/stats/server.nix b/makefu/2configs/stats/server.nix
index 8f9935658..bb91b4478 100644
--- a/makefu/2configs/stats/server.nix
+++ b/makefu/2configs/stats/server.nix
@@ -2,6 +2,8 @@
with import <stockholm/lib>;
let
+ irc-server = "ni.r";
+ irc-nick = "m-alarm";
collectd-port = 25826;
influx-port = 8086;
grafana-port = 3000; # TODO nginx forward
@@ -37,9 +39,9 @@ in {
echoToIrc = pkgs.writeDash "echo_irc" ''
set -euf
data="$(${pkgs.jq}/bin/jq -r .message)"
- export LOGNAME=malarm
+ export LOGNAME=${irc-nick}
${pkgs.irc-announce}/bin/irc-announce \
- irc.freenode.org 6667 malarm \#krebs-bots "$data" >/dev/null
+ ${irc-server} 6667 ${irc-nick} \#noise "$data" >/dev/null
'';
in {
enable = true;
diff --git a/makefu/2configs/stats/telegraf/default.nix b/makefu/2configs/stats/telegraf/default.nix
new file mode 100644
index 000000000..4da6561d6
--- /dev/null
+++ b/makefu/2configs/stats/telegraf/default.nix
@@ -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";
+ }];
+ };
+ };
+ };
+}
diff --git a/makefu/2configs/stats/telegraf/europastats.nix b/makefu/2configs/stats/telegraf/europastats.nix
new file mode 100644
index 000000000..9249280c5
--- /dev/null
+++ b/makefu/2configs/stats/telegraf/europastats.nix
@@ -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"
+ ];
+ }
+ ];
+}