Last active
October 21, 2019 08:22
-
-
Save Nurlan199206/87e9a2c1236abf5fdb6ce397d4d09eb2 to your computer and use it in GitHub Desktop.
Кастомная метрика
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Adjust as needed. | |
#https://www.robustperception.io/using-the-textfile-collector-from-a-shell-script | |
TEXTFILE_COLLECTOR_DIR=/var/lib/node_exporter/textfile_collector/ | |
# Note the start time of the script. | |
# Your code goes here. | |
sleep 10 | |
# Write out metrics to a temporary file. | |
END="$(cat /var/log/cron | wc -l)" | |
cat << EOF > "$TEXTFILE_COLLECTOR_DIR/test.prom.$$" | |
test $END | |
EOF | |
# Rename the temporary file atomically. | |
# This avoids the node exporter seeing half a file. | |
mv "$TEXTFILE_COLLECTOR_DIR/test.prom.$$" \ | |
"$TEXTFILE_COLLECTOR_DIR/test.prom" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment