Skip to content

Commit

Permalink
Had to make my one total_seconds function.
Browse files Browse the repository at this point in the history
  • Loading branch information
luisilva committed Apr 29, 2016
1 parent afcfd58 commit bc3038c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions graph_rsnap_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def loop_logs(self):
if self.graph_list:
last_time_dict[log] = self.graph_list[-1]
logger.debug("%s" % self.graph_list)
#self.graph_data()
self.graph_data()
self.last_times_dict.update(last_time_dict)

def get_job_times(self):
Expand Down Expand Up @@ -173,7 +173,11 @@ def parse_job_durations(self):
zip(self.end_times, self.start_times)]
for end, times in zip(self.end_times, duration):
end_epoch = end.strftime('%s')
metric = int(times.total_seconds())
self.times = times
self.total_secs()
metric = self.metric
## This only works in Python 2.7.x
#metric = int(times.total_seconds())
graph_list = "%s.%s.%s.%s %s %s\n" \
% (rsnap_service_name, datacenter, self.hostname,
log_name, metric, end_epoch)
Expand All @@ -182,6 +186,9 @@ def parse_job_durations(self):
logger.critical("Can't parse this logs properly. You may want to "
"clear it.: %s" % self.log_path)

def total_secs(self):
self.metric = int((self.times.days * 86400) + self.times.seconds)

def graph_data(self):
# Open Socket and push all the metrics we have accumulated
content = self.graph_list
Expand Down

0 comments on commit bc3038c

Please sign in to comment.