From d04f56f4c190a97283903e62e000d9e9b2ad465a Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 28 Mar 2021 20:41:22 +0200 Subject: [PATCH] scrape: add luftqualitaet --- flake.lock | 8 ++++---- hosts/containers/scrape/default.nix | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 425cb73f..45c9afd2 100644 --- a/flake.lock +++ b/flake.lock @@ -43,11 +43,11 @@ "scrapers": { "flake": false, "locked": { - "lastModified": 1616616238, - "narHash": "sha256-BbZU0kTn0YNvO9IFmvZdbrHuh71R/4ducg51h4gvj7o=", + "lastModified": 1616689077, + "narHash": "sha256-eTj9yoOzBj7JUCMjxKr9XibQ0ZpoS6Ac0VP/CfaIwi8=", "ref": "master", - "rev": "b9775fd9a117f9c0e723fe482b778be0edfa958d", - "revCount": 26, + "rev": "f6c9b1c1f25a0d03a4c28710a866759107162adc", + "revCount": 27, "type": "git", "url": "https://gitea.c3d2.de/astro/scrapers.git" }, diff --git a/hosts/containers/scrape/default.nix b/hosts/containers/scrape/default.nix index 8f7ff7dd..ca9cf298 100644 --- a/hosts/containers/scrape/default.nix +++ b/hosts/containers/scrape/default.nix @@ -8,6 +8,7 @@ let "1099" = "10.200.4.80"; "1864" = "10.200.7.80"; }; + luftqualitaetStations = [ "1672" "1649" "1680" "1639" ]; in { c3d2.isInHq = false; @@ -35,6 +36,13 @@ in { host = freifunkNodes.${nodeId}; }; }; + makeLuftScraper = station: { + name = "scrape-luftqualitaet${station}"; + value = makeService { + script = "luftqualitaet"; + host = station; + }; + }; in { scrape-xeri = makeService { script = "xerox"; @@ -59,7 +67,9 @@ in { script = "impfee"; }; } // builtins.listToAttrs - (map makeNodeScraper (builtins.attrNames freifunkNodes)); + (map makeNodeScraper (builtins.attrNames freifunkNodes) ++ + map makeLuftScraper luftqualitaetStations + ); systemd.timers = let makeTimer = service: interval: { @@ -73,6 +83,12 @@ in { inherit name; value = makeTimer name "minutely"; }; + makeLuftScraperTimer = station: + let name = "scrape-luftqualitaet${station}"; + in { + inherit name; + value = makeTimer name "hourly"; + }; in { scrape-xeri = makeTimer "scrape-xeri.service" "minutely"; scrape-roxi = makeTimer "scrape-roxi.service" "minutely"; @@ -80,7 +96,9 @@ in { scrape-matemat = makeTimer "scrape-matemat.service" "minutely"; scrape-impfee = makeTimer "scrape-impfee.service" "minutely"; } // builtins.listToAttrs - (map makeNodeScraperTimer (builtins.attrNames freifunkNodes)); + (map makeNodeScraperTimer (builtins.attrNames freifunkNodes) ++ + (map makeLuftScraperTimer luftqualitaetStations) + ); # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database