r/rclone • • Jul 04 '21

Python Rclone Backup Script with Telegram, InfluxDB and Grafana Reporting

Hey guys :)

I created a small Python Rclone Backup Script for personal use. I wanted to step up my Rclone game and get statistics and backup summaries in Telegram and Grafana.

You can find the script here: https://gist.github.com/lucanello/1fa285804dff2eeb681d3a86f64cc03b

Grab the Grafana dashboard from here: https://grafana.com/grafana/dashboards/14686

I use the Python subprocess.run() command to execute the rclone commands.

Features:

  • You can execute scripts, commands and database dumps before running a single rclone command

  • It sends automatic error reports and summaries

  • It saves all statistics and operations to an Influx database

  • The data can be used for visualizations in e.g. Grafana

  • You can automate it by using cron

Examples:

Please leave some feedback and help me improve this script! :-)

Thanks and have fun!

41 Upvotes

9 comments sorted by

2

u/rafaelreisr Jul 04 '21

This is Brilliant! Sure will check it out!

1

u/lucanello Jul 04 '21

Thanks buddy! :)

2

u/rafaelreisr Jul 04 '21

I can see myself forking cloudplow and adding the influx/Grafana stats from your script To their code. (Hint, hint). Would be great to get visibility over the daily uploads on my feeder server.

2

u/rafaelreisr Jul 06 '21

I wonder if you could add to the gist the json for the Grafana dash. Saves a lot of time creating all those graphs

1

u/lucanello Jul 06 '21 edited Jul 06 '21

Of course :) I've updated the gist with the exported Grafana .json file

And you can also get the .json from Grafana: https://grafana.com/grafana/dashboards/14686

1

u/jtm2020hyo Mar 26 '22

looks interesting, where can I use this script?

How can I run a rclone command since python?

1

u/lucanello Mar 26 '22

Simply copy the script from the URL and configure your settings (InfluxDB, sources and targets for file transfers). You'll need to install the Python dependencies and are good to go :-) Some more details can be found in this comment: https://gist.github.com/lucanello/1fa285804dff2eeb681d3a86f64cc03b?permalink_comment_id=3904093#gistcomment-3904093 Feel free to ask if you need further assistance.

2

u/seedshare Apr 13 '22

Uau. Thank you for your work. Was looking for this.

1

u/PovilasID Jul 14 '23

Have you considered packaging it into a docker container?

Would it work as conatainer?