Skip to content
Snippets Groups Projects
Commit cfc67572 authored by Florian Sesser's avatar Florian Sesser
Browse files

Monitoring: Count Tahoe's corruption advisories

parent 3af22871
No related branches found
No related tags found
2 merge requests!351update production,!341Monitoring: Count Tahoe's corruption advisories
Pipeline #2473 passed
This commit is part of merge request !341. Comments created here will be created in the context of that merge request.
# Tahoe Prometheus metrics collector # Tahoe Prometheus metrics collector
# #
# Scope: Retrieves OpenMetrics from Tahoe and puts them # Scope: Retrieve metrics from Tahoe and put them where Prometheus'
# where textfile collector can find them. # node-exporter's textfile collector can find them.
# #
# Usage: Import this to every server running Tahoe. # Usage: Import this to every server running Tahoe.
# #
...@@ -55,14 +55,17 @@ in { ...@@ -55,14 +55,17 @@ in {
description = "Tahoe metrics gathering service"; description = "Tahoe metrics gathering service";
after = [ "tahoe.storage.service" ]; after = [ "tahoe.storage.service" ];
startAt = cfg.interval; startAt = cfg.interval;
path = [ pkgs.curl ]; path = [ pkgs.coreutils pkgs.findutils pkgs.curl ];
restartIfChanged = false; restartIfChanged = false;
# Save to a temp file and then move atomically so the # Save to a temp file and then move atomically so the
# textfile collector won't read a partial file. # textfile collector won't read a partial file.
# See https://github.com/prometheus/node_exporter#textfile-collector # See https://github.com/prometheus/node_exporter#textfile-collector
script = '' 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}" mv "${cfg.outFile}.tmp" "${cfg.outFile}"
''; '';
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment