Skip to content

Commit

Permalink
Merge pull request #12 from trampfox/davide-monfrecola-patch-1
Browse files Browse the repository at this point in the history
fix: check if first_backup and last_backup values are available
  • Loading branch information
marcinhlybin committed Aug 6, 2020
2 parents ca6fb1d + f88da3f commit 3083966
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions barman_exporter/barman_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ def barman_servers(self):
return self.servers

def collect_first_backup(self, barman_server):
if barman_server.status['first_backup']:
if barman_server.status['first_backup'] and barman_server.status['first_backup'] != 'None':
first_backup = datetime.strptime(
barman_server.status['first_backup'], "%Y%m%dT%H%M%S")
self.collectors['barman_first_backup'].add_metric(
[barman_server.name], first_backup.strftime("%s"))

def collect_last_backup(self, barman_server):
if barman_server.status['last_backup']:
if barman_server.status['last_backup'] and barman_server.status['last_backup'] != 'None':
last_backup = datetime.strptime(
barman_server.status['last_backup'], "%Y%m%dT%H%M%S")
self.collectors['barman_last_backup'].add_metric(
Expand Down

0 comments on commit 3083966

Please sign in to comment.