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": { "scrapers": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1616616238, "lastModified": 1616689077,
"narHash": "sha256-BbZU0kTn0YNvO9IFmvZdbrHuh71R/4ducg51h4gvj7o=", "narHash": "sha256-eTj9yoOzBj7JUCMjxKr9XibQ0ZpoS6Ac0VP/CfaIwi8=",
"ref": "master", "ref": "master",
"rev": "b9775fd9a117f9c0e723fe482b778be0edfa958d", "rev": "f6c9b1c1f25a0d03a4c28710a866759107162adc",
"revCount": 26, "revCount": 27,
"type": "git", "type": "git",
"url": "https://gitea.c3d2.de/astro/scrapers.git" "url": "https://gitea.c3d2.de/astro/scrapers.git"
}, },

View File

@ -8,6 +8,7 @@ let
"1099" = "10.200.4.80"; "1099" = "10.200.4.80";
"1864" = "10.200.7.80"; "1864" = "10.200.7.80";
}; };
luftqualitaetStations = [ "1672" "1649" "1680" "1639" ];
in { in {
c3d2.isInHq = false; c3d2.isInHq = false;
@ -35,6 +36,13 @@ in {
host = freifunkNodes.${nodeId}; host = freifunkNodes.${nodeId};
}; };
}; };
makeLuftScraper = station: {
name = "scrape-luftqualitaet${station}";
value = makeService {
script = "luftqualitaet";
host = station;
};
};
in { in {
scrape-xeri = makeService { scrape-xeri = makeService {
script = "xerox"; script = "xerox";
@ -59,7 +67,9 @@ in {
script = "impfee"; script = "impfee";
}; };
} // builtins.listToAttrs } // builtins.listToAttrs
(map makeNodeScraper (builtins.attrNames freifunkNodes)); (map makeNodeScraper (builtins.attrNames freifunkNodes) ++
map makeLuftScraper luftqualitaetStations
);
systemd.timers = let systemd.timers = let
makeTimer = service: interval: { makeTimer = service: interval: {
@ -73,6 +83,12 @@ in {
inherit name; inherit name;
value = makeTimer name "minutely"; value = makeTimer name "minutely";
}; };
makeLuftScraperTimer = station:
let name = "scrape-luftqualitaet${station}";
in {
inherit name;
value = makeTimer name "hourly";
};
in { in {
scrape-xeri = makeTimer "scrape-xeri.service" "minutely"; scrape-xeri = makeTimer "scrape-xeri.service" "minutely";
scrape-roxi = makeTimer "scrape-roxi.service" "minutely"; scrape-roxi = makeTimer "scrape-roxi.service" "minutely";
@ -80,7 +96,9 @@ in {
scrape-matemat = makeTimer "scrape-matemat.service" "minutely"; scrape-matemat = makeTimer "scrape-matemat.service" "minutely";
scrape-impfee = makeTimer "scrape-impfee.service" "minutely"; scrape-impfee = makeTimer "scrape-impfee.service" "minutely";
} // builtins.listToAttrs } // 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 # This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database # compatible, in order to avoid breaking some software such as database