Skip to content

Instantly share code, notes, and snippets.

@AGx10k
Last active March 24, 2020 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AGx10k/cdc8ebbc1204a21c0a4a9ee93dc4dcbd to your computer and use it in GitHub Desktop.
Save AGx10k/cdc8ebbc1204a21c0a4a9ee93dc4dcbd to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Expose directory usage metrics, passed as an argument.
#
# Usage: add this to crontab:
#
# */5 * * * * prometheus directory-size.sh /var/lib/prometheus | sponge /var/lib/node_exporter/directory_size.prom
#
# sed pattern taken from https://www.robustperception.io/monitoring-directory-sizes-with-the-textfile-collector/
#
# Author: Antoine Beaupré <anarcat@debian.org>
echo "# HELP QKC_miner_threads gauge miner threads running for QuarkChain miner"
echo "# TYPE QKC_miner_threads gauge"
main_pid=$(docker top quarkchain-miner | grep ethminer | awk '{print $2}')
miner_threads=$(grep "Name:" /proc/${main_pid}/task/*/status | grep -e "\bminer" | wc -l)
echo "QKC_miner_threads ${miner_threads}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment