Skip to content
Snippets Groups Projects

Monitoring: Count Tahoe's corruption advisories

Merged Florian Sesser requested to merge 287.publish-tahoe-error-rate-with-prometheus into develop
All threads resolved!
1 file
+ 7
4
Compare changes
  • Side-by-side
  • Inline
# Tahoe Prometheus metrics collector
#
# Scope: Retrieves OpenMetrics from Tahoe and puts them
# where textfile collector can find them.
# Scope: Retrieve metrics from Tahoe and put them where Prometheus'
# node-exporter's textfile collector can find them.
#
# Usage: Import this to every server running Tahoe.
#
@@ -55,14 +55,17 @@ in {
description = "Tahoe metrics gathering service";
after = [ "tahoe.storage.service" ];
startAt = cfg.interval;
path = [ pkgs.curl ];
path = [ pkgs.coreutils pkgs.findutils pkgs.curl ];
restartIfChanged = false;
# Save to a temp file and then move atomically so the
# textfile collector won't read a partial file.
# See https://github.com/prometheus/node_exporter#textfile-collector
script = ''
curl --silent --show-error --fail-with-body --output "${cfg.outFile}.tmp" "${cfg.scrapeEndpoint}"
NUM_CORRUPTION_ADVISORIES=$(find /storage/corruption-advisories/ -type f | wc -l)
echo "tahoe_corruption_advisories_total $NUM_CORRUPTION_ADVISORIES" > "${cfg.outFile}.tmp"
curl --silent --show-error --fail-with-body "${cfg.scrapeEndpoint}" >> "${cfg.outFile}.tmp"
mv "${cfg.outFile}.tmp" "${cfg.outFile}"
'';
};
Loading