scrape: add luftqualitaet

This commit is contained in:
Astro 2021-03-28 20:41:22 +02:00
parent 59d25c2648
commit d04f56f4c1
2 changed files with 24 additions and 6 deletions

View File

@ -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"
},

View File

@ -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