raph2i / synology_backup_exporter

Prometheus Exporter for Synology Backup Suite (Active Backup, Hyper Backup, Hyper Backup Vault)
MIT License
4 stars 5 forks source link

Fix exporter if a backup has never completed, closes #2 #5

Closed zxjinn closed 2 years ago

zxjinn commented 2 years ago

Hello again @raph2i! Here's a PR that should close #2

I ran into the issue you documented in #2 where if a backup hadn't completed yet, the exporter blew up. I wasn't sure how you wanted to solve it, so I just set all the empty dates/times to datetime.now

That means the exporter will report

If that's not how you'd approach it (ie you'd rather use a try/except and skip the job or something) then let me know and I can adjust! I thought this was better than just skipping the job completely, and didn't want to set off alarms for having old or broken backups when the reality is: the backup just hadn't completed its first run yet

raph2i commented 2 years ago

Hi @zxjinn , i merged it. DockerHub Image has been updated too