From d6f1d3b509b87390a653adea1a7680a2b41a8d36 Mon Sep 17 00:00:00 2001 From: pivaldi Date: Thu, 6 Sep 2018 11:46:15 +0200 Subject: [PATCH] Fix metrics' name --- README.md | 22 +++++++++++----------- borg_exporter.sh | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 46c2f07..e2c3b68 100644 --- a/README.md +++ b/README.md @@ -40,17 +40,17 @@ You must start the node exporter service with the following parameter: `--collec ``` borg_extract_exit_code -bork_hours_from_last_backup -bork_count -bork_files -bork_chunks_unique -bork_chunks_total -bork_last_size -bork_last_size_compressed -bork_last_size_dedup -bork_total_size -bork_total_size_compressed -bork_total_size_dedup +borg_hours_from_last_backup +borg_archives_count +borg_files_count +borg_chunks_unique +borg_chunks_total +borg_last_size +borg_last_size_compressed +borg_last_size_dedup +borg_total_size +borg_total_size_compressed +borg_total_size_dedup ``` ### Grafana dashboard diff --git a/borg_exporter.sh b/borg_exporter.sh index 9e68d58..2ba8968 100755 --- a/borg_exporter.sh +++ b/borg_exporter.sh @@ -27,11 +27,11 @@ BORG_EXTRACT_EXIT_CODE=$(BORG_PASSPHRASE="$BORG_PASSPHRASE" borg extract --dry-r BORG_INFO=$(BORG_PASSPHRASE="$BORG_PASSPHRASE" borg info "$REPOSITORY::$LAST_ARCHIVE_NAME") echo "borg_extract_exit_code{host=\"${HOSTNAME}\"} $BORG_EXTRACT_EXIT_CODE" >> $TMP_FILE -echo "bork_hours_from_last_backup{host=\"${HOSTNAME}\"} $NB_HOUR_FROM_LAST_BCK" >> $TMP_FILE -echo "bork_count{host=\"${HOSTNAME}\"} $COUNTER" >> $TMP_FILE -echo "bork_files{host=\"${HOSTNAME}\"} $(echo "$BORG_INFO" | grep "Number of files" | awk '{print $4}')" >> $TMP_FILE -echo "bork_chunks_unique{host=\"${HOSTNAME}\"} $(echo "$BORG_INFO" | grep "Chunk index" | awk '{print $3}')" >> $TMP_FILE -echo "bork_chunks_total{host=\"${HOSTNAME}\"} $(echo "$BORG_INFO" | grep "Chunk index" | awk '{print $4}')" >> $TMP_FILE +echo "borg_hours_from_last_backup{host=\"${HOSTNAME}\"} $NB_HOUR_FROM_LAST_BCK" >> $TMP_FILE +echo "borg_archives_count{host=\"${HOSTNAME}\"} $COUNTER" >> $TMP_FILE +echo "borg_files_count{host=\"${HOSTNAME}\"} $(echo "$BORG_INFO" | grep "Number of files" | awk '{print $4}')" >> $TMP_FILE +echo "borg_chunks_unique{host=\"${HOSTNAME}\"} $(echo "$BORG_INFO" | grep "Chunk index" | awk '{print $3}')" >> $TMP_FILE +echo "borg_chunks_total{host=\"${HOSTNAME}\"} $(echo "$BORG_INFO" | grep "Chunk index" | awk '{print $4}')" >> $TMP_FILE function calc_bytes { NUM=$1 @@ -62,11 +62,11 @@ TOTAL_SIZE_COMPRESSED=$(calc_bytes $(echo "$BORG_INFO" |grep "All archives" |awk TOTAL_SIZE_DEDUP=$(calc_bytes $(echo "$BORG_INFO" |grep "All archives" |awk '{print $7}') $(echo "$BORG_INFO" |grep "All archives" |awk '{print $8}')) -echo "bork_last_size{host=\"${HOSTNAME}\"} $LAST_SIZE" >> $TMP_FILE -echo "bork_last_size_compressed{host=\"${HOSTNAME}\"} $LAST_SIZE_COMPRESSED" >> $TMP_FILE -echo "bork_last_size_dedup{host=\"${HOSTNAME}\"} $LAST_SIZE_DEDUP" >> $TMP_FILE -echo "bork_total_size{host=\"${HOSTNAME}\"} $TOTAL_SIZE" >> $TMP_FILE -echo "bork_total_size_compressed{host=\"${HOSTNAME}\"} $TOTAL_SIZE_COMPRESSED" >> $TMP_FILE -echo "bork_total_size_dedup{host=\"${HOSTNAME}\"} $TOTAL_SIZE_DEDUP" >> $TMP_FILE +echo "borg_last_size{host=\"${HOSTNAME}\"} $LAST_SIZE" >> $TMP_FILE +echo "borg_last_size_compressed{host=\"${HOSTNAME}\"} $LAST_SIZE_COMPRESSED" >> $TMP_FILE +echo "borg_last_size_dedup{host=\"${HOSTNAME}\"} $LAST_SIZE_DEDUP" >> $TMP_FILE +echo "borg_total_size{host=\"${HOSTNAME}\"} $TOTAL_SIZE" >> $TMP_FILE +echo "borg_total_size_compressed{host=\"${HOSTNAME}\"} $TOTAL_SIZE_COMPRESSED" >> $TMP_FILE +echo "borg_total_size_dedup{host=\"${HOSTNAME}\"} $TOTAL_SIZE_DEDUP" >> $TMP_FILE mv $TMP_FILE $PROM_FILE