···524 <link linkend="opt-services.ananicy.enable">services.ananicy</link>.
525 </para>
526 </listitem>
527+ <listitem>
528+ <para>
529+ <link xlink:href="https://github.com/prometheus-community/smartctl_exporter">smartctl_exporter</link>,
530+ a Prometheus exporter for
531+ <link xlink:href="https://en.wikipedia.org/wiki/S.M.A.R.T.">S.M.A.R.T.</link>
532+ data. Available as
533+ <link xlink:href="options.html#opt-services.prometheus.exporters.smartctl.enable">services.prometheus.exporters.smartctl</link>.
534+ </para>
535+ </listitem>
536 </itemizedlist>
537 </section>
538 <section xml:id="sec-release-21.11-incompatibilities">
+2
nixos/doc/manual/release-notes/rl-2111.section.md
···147148- Auto nice daemons [ananicy](https://github.com/Nefelim4ag/Ananicy) and [ananicy-cpp](https://gitlab.com/ananicy-cpp/ananicy-cpp/). Available as [services.ananicy](#opt-services.ananicy.enable).
14900150## Backward Incompatibilities {#sec-release-21.11-incompatibilities}
151152- The NixOS VM test framework, `pkgs.nixosTest`/`make-test-python.nix`, now requires detaching commands such as `succeed("foo &")` and `succeed("foo | xclip -i")` to close stdout.
···147148- Auto nice daemons [ananicy](https://github.com/Nefelim4ag/Ananicy) and [ananicy-cpp](https://gitlab.com/ananicy-cpp/ananicy-cpp/). Available as [services.ananicy](#opt-services.ananicy.enable).
149150+- [smartctl_exporter](https://github.com/prometheus-community/smartctl_exporter), a Prometheus exporter for [S.M.A.R.T.](https://en.wikipedia.org/wiki/S.M.A.R.T.) data. Available as [services.prometheus.exporters.smartctl](options.html#opt-services.prometheus.exporters.smartctl.enable).
151+152## Backward Incompatibilities {#sec-release-21.11-incompatibilities}
153154- The NixOS VM test framework, `pkgs.nixosTest`/`make-test-python.nix`, now requires detaching commands such as `succeed("foo &")` and `succeed("foo | xclip -i")` to close stdout.
···1617buildGoPackage rec {
18 pname = "gitea";
19- version = "1.15.6";
2021 # not fetching directly from the git repo, because that lacks several vendor files for the web UI
22 src = fetchurl {
23 url = "https://github.com/go-gitea/gitea/releases/download/v${version}/gitea-src-${version}.tar.gz";
24- sha256 = "sha256-FMM/iQAxJcymv4jYBzaBXG0Uy8UxHh9gFWB5gzV9cn0=";
25 };
2627 unpackPhase = ''
···1617buildGoPackage rec {
18 pname = "gitea";
19+ version = "1.15.7";
2021 # not fetching directly from the git repo, because that lacks several vendor files for the web UI
22 src = fetchurl {
23 url = "https://github.com/go-gitea/gitea/releases/download/v${version}/gitea-src-${version}.tar.gz";
24+ sha256 = "sha256-Ckg8XKCPnyp4a0kXJrqju2jAJvD4tzjomaeJxlFwYzg=";
25 };
2627 unpackPhase = ''
···1+From e81b06df67b1d42ef915615fafa0b56ef956673b Mon Sep 17 00:00:00 2001
2+From: Andreas Fuchs <asf@boinkor.net>
3+Date: Thu, 11 Feb 2021 17:30:44 -0500
4+Subject: [PATCH] Return the cached value if it's not time to scan again yet
5+6+This should ensure that if we have a valid value cached (which ought
7+to be every time after the first scan), we return it as metrics.
8+9+This fixes the crashes that would happen if queries happened earlier
10+than the re-scan interval allowed.
11+12+Address review feedback: Shorten the time-to-scan logic
13+14+We can express this in a single if statement, so it takes fewer lines
15+to do the "should we check again" check.
16+---
17+ readjson.go | 11 ++---------
18+ 1 file changed, 2 insertions(+), 9 deletions(-)
19+20+diff --git a/readjson.go b/readjson.go
21+index da35448..c9996fd 100644
22+--- a/readjson.go
23++++ b/readjson.go
24+@@ -78,14 +78,7 @@ func readData(device string) (gjson.Result, error) {
25+26+ if _, err := os.Stat(device); err == nil {
27+ cacheValue, cacheOk := jsonCache[device]
28+- timeToScan := false
29+- if cacheOk {
30+- timeToScan = time.Now().After(cacheValue.LastCollect.Add(options.SMARTctl.CollectPeriodDuration))
31+- } else {
32+- timeToScan = true
33+- }
34+-
35+- if timeToScan {
36++ if !cacheOk || time.Now().After(cacheValue.LastCollect.Add(options.SMARTctl.CollectPeriodDuration)) {
37+ json, ok := readSMARTctl(device)
38+ if ok {
39+ jsonCache[device] = JSONCache{JSON: json, LastCollect: time.Now()}
40+@@ -93,7 +86,7 @@ func readData(device string) (gjson.Result, error) {
41+ }
42+ return gjson.Parse(DEFAULT_EMPTY_JSON), fmt.Errorf("smartctl returned bad data for device %s", device)
43+ }
44+- return gjson.Parse(DEFAULT_EMPTY_JSON), fmt.Errorf("Too early collect called for device %s", device)
45++ return cacheValue.JSON, nil
46+ }
47+ return gjson.Parse(DEFAULT_EMPTY_JSON), fmt.Errorf("Device %s unavialable", device)
48+ }
49+--
50+2.33.1
51+