Module: check_mk
Branch: master
Commit: 25a3ca9632feced097917c3632ccd32fcc493582
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=25a3ca9632feceā¦
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 4 14:06:26 2014 +0100
FIX postgres_sessions: fix empty agent section in case of 0 sessions
This fixes the problem that in some case when 0 sessions are active
the agent section is empty and the inventory will find the check
nomore.
---
.werks/689 | 11 +++++++++++
ChangeLog | 3 ++-
agents/plugins/mk_postgres | 3 +++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.werks/689 b/.werks/689
new file mode 100644
index 0000000..8d40dd2
--- /dev/null
+++ b/.werks/689
@@ -0,0 +1,11 @@
+Title: postgres_sessions: fix empty agent section in case of 0 sessions
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1391505669
+
+This fixes the problem that in some case when 0 sessions are active
+the agent section is empty and the inventory will find the check
+nomore.
diff --git a/ChangeLog b/ChangeLog
index dff5b97..6345c5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -153,8 +153,9 @@
* 0575 FIX: cmciii_lcp_airin, cmciii_lcp_airout, cmciii_lcp_waterin,
cmciii_lcp_waterout: improved handling of warning state...
* 0272 FIX: if checks: port type 56 (fibrechannel) is no longer inventorized per
default...
* 0577 FIX: fileinfo.groups: new date pattern is now available for inventory check as
well
- * 0578 FIX: zypper: check is always registered as soon as mk_zypper plugin detects
zypper tool...
* 0688 FIX: winperf_msx_queues: Support output of Exchange 2013...
+ * 0578 FIX: zypper: check is always registered as soon as mk_zypper plugin detects
zypper tool...
+ * 0689 FIX: postgres_sessions: fix empty agent section in case of 0 sessions...
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/agents/plugins/mk_postgres b/agents/plugins/mk_postgres
index 3d928db..dc92a20 100755
--- a/agents/plugins/mk_postgres
+++ b/agents/plugins/mk_postgres
@@ -17,6 +17,9 @@ do
su - $USER -c "psql --variable ON_ERROR_STOP=1 -d postgres -A -t -F'
'" 2>/dev/null)" && break
done
echo "$OUTPUT"
+# line with number of idle sessions is sometimes missing on Postgre 8.x. This can lead
+# to an altogether empty section and thus the check disappearing.
+echo "$OUTPUT" | grep -q '^t ' || echo "t 0"
echo '<<<postgres_stat_database:sep(59)>>>'
echo 'select datid, datname, numbackends, xact_commit, xact_rollback, blks_read,
blks_hit, tup_returned, tup_fetched, tup_inserted, tup_updated, tup_deleted,
pg_database_size(datname) "datsize" from pg_stat_database;' \