ngosang / restic-exporter

Prometheus exporter for the Restic backup system
MIT License
84 stars 18 forks source link

Error: time data '2022-12-07T10:19:24' does not match format '%Y-%m-%dT%H:%M:%S%z' #1

Closed ngosang closed 1 year ago

ngosang commented 1 year ago

I saw this error after using the Android App for Restic. It includes Restic 0.12 and the repository was created with Restic 0.13 ? => https://github.com/lhns/restic-android

image

ERROR    Unable to collect metrics from Restic. Error: time data '2022-12-07T10:19:24' does not match format '%Y-%m-%dT%H:%M:%S%z'
martonivan commented 1 year ago

Hello,

I've faced the very same issue. I was using the current github image on a recently created restic (restic 0.12.1 compiled with go1.17 on linux/amd64; directly from Ubuntu repo) repository on Linux (Linux docker-1 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux).

restic output for that variable is: '2023-02-01T14:14:19.30760523Z' after your transformation this becomes: '2023-02-01T14:14:19'

What's the point in the regexp in line https://github.com/ngosang/restic-exporter/blob/main/restic-exporter.py#L100?

Why not removing the trailing numbers after the period only?

ngosang commented 1 year ago

Fixed in 84190584b8b48f4c7db9db6f655a35490c6d4553 / Release 1.1.0