notify-prom-stats.sh 608 B

123456789101112131415
  1. #!/bin/sh -xe
  2. json=`restic stats --json`
  3. [ ! -z $PROM_GW_URL ] && cat <<EOF | curl --data-binary @- $PROM_GW_URL
  4. # TYPE restic_repository_total_size_bytes gauge
  5. # HELP restic_repository_total_size_bytes total size of the repository
  6. `echo -n 'restic_repository_total_size_bytes ' && \
  7. echo $json | grep -o '"total_size":[0-9]*' | grep -o '[0-9]*'`
  8. # TYPE restic_repository_total_files_count gauge
  9. # HELP restic_repository_total_files_count total count of files in the repository
  10. `echo -n 'restic_repository_total_files_count ' && \
  11. echo $json | grep -o '"total_file_count":[0-9]*' | grep -o '[0-9]*'`
  12. EOF