Module: check_mk
Branch: master
Commit: c87617ace1b83ae82941a9be80ce06e225a5a52a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c87617ace1b83a…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon May 14 10:53:50 2018 +0200
Minor cleanup
Change-Id: Ifad007c254455cdc67a989665440a4d9ee654219
---
checks/postgres_sessions | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/checks/postgres_sessions b/checks/postgres_sessions
index ac7283e..50ea51a 100644
--- a/checks/postgres_sessions
+++ b/checks/postgres_sessions
@@ -45,7 +45,10 @@ def parse_postgres_sessions(info):
if line[0].startswith("[[[") and line[0].endswith("]]]"):
instance_name = line[0][3:-3].upper()
continue
- instance = parsed.setdefault(instance_name, {})
+ instance = parsed.setdefault(instance_name, {
+ "total": 0,
+ "running": 0,
+ })
if line[0].startswith("t"):
instance["total"] = int(line[1])
elif line[0].startswith("f"):
@@ -65,8 +68,8 @@ def check_postgres_sessions(item, params, parsed):
raise MKCounterWrapped("Login into database failed")
data = parsed[item]
- idle = data.get('total', 0)
- running = data.get('running', 0)
+ idle = data['total']
+ running = data['running']
total = idle + running
for key, val in [