Module: check_mk
Branch: master
Commit: 676c561994016ac71a8de429c14c36f6fb109409
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=676c561994016a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 3 09:25:19 2013 +0100
FIX: mssql_backup: Fixed wrong calculation of backup age in seconds (now python <2.7
supported)
---
checks/mssql_backup | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/checks/mssql_backup b/checks/mssql_backup
index b55d9ce..af4d43f 100644
--- a/checks/mssql_backup
+++ b/checks/mssql_backup
@@ -43,7 +43,9 @@ def check_mssql_backup(item, params, info):
dt = datetime.datetime(*time.strptime(last_backup_date + ' ' +
last_backup_time, '%Y-%m-%d %H:%M:%S')[0:5])
state = 0
- sec_ago = (datetime.datetime.now() - dt).total_seconds()
+ # Would be so nice to use delta.total_seconds(). But we must care about
python < 2.7
+ delta = datetime.datetime.now() - dt
+ sec_ago = (delta.microseconds + (delta.seconds + delta.days * 24 * 3600) *
10**6) / 10**6
if params is not None:
if sec_ago >= params[1]: