Module: check_mk
Branch: master
Commit: cb830004e8beb4a51241865df31f131d5a179272
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cb830004e8beb4…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Apr 24 10:13:35 2015 +0200
#1243 FIX mk_postgres: Prevent loading of .psqlrc
If the user has a ~/.psqlrc file whit options like \timing on, this leads to unexcpected output by psql.
While this is untestet, that fix is not included in 1.2.6. But you can currently use the git version to test.
---
.werks/1243 | 11 +++++++++++
ChangeLog | 1 +
agents/plugins/mk_postgres | 22 +++++++++++-----------
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/.werks/1243 b/.werks/1243
new file mode 100644
index 0000000..bb857f8
--- /dev/null
+++ b/.werks/1243
@@ -0,0 +1,11 @@
+Title: mk_postgres: Prevent loading of .psqlrc
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1429863051
+Class: fix
+
+If the user has a ~/.psqlrc file whit options like \timing on, this leads to unexcpected output by psql.
+While this is untestet, that fix is not included in 1.2.6. But you can currently use the git version to test.
+
diff --git a/ChangeLog b/ChangeLog
index d2c0133..99ce600 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -342,6 +342,7 @@
* 2069 FIX: netapp_api_disk.summary: fixed one missing disk in summary check...
* 2070 FIX: agent_netapp: fixed exception when a channel has no shelf-list configured
* 2212 FIX: oracle_tablespaces: Fix plugin output in case of detected problem in Autoextend settings...
+ * 1243 FIX: mk_postgres: Prevent loading of .psqlrc...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request, added mailto link for error report...
diff --git a/agents/plugins/mk_postgres b/agents/plugins/mk_postgres
index c4f6b2c..9c9ae52 100755
--- a/agents/plugins/mk_postgres
+++ b/agents/plugins/mk_postgres
@@ -44,9 +44,9 @@ function compare_version_greater_equal() {
echo '<<<postgres_sessions>>>'
# Postgres 9.2 uses 'query' instead of 'current_query'
QNAME="$(echo "select column_name from information_schema.columns where table_name='pg_stat_activity' and column_name in ('query','current_query');" |\
- su - $USER -c "psql -d postgres -t -A -F';'")"
+ su - $USER -c "psql -X -d postgres -t -A -F';'")"
OUTPUT="$(echo "select $QNAME = '<IDLE>', count(*) from pg_stat_activity group by ($QNAME = '<IDLE>');" |\
- su - $USER -c "psql --variable ON_ERROR_STOP=1 -d postgres -A -t -F' '" 2>/dev/null)"
+ su - $USER -c "psql -X --variable ON_ERROR_STOP=1 -d postgres -A -t -F' '" 2>/dev/null)"
echo "$OUTPUT"
# line with number of idle sessions is sometimes missing on Postgre 8.x. This can lead
@@ -55,18 +55,18 @@ 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;' \
- | su - $USER -c "psql -d postgres -A -F';'" | sed '$d'
+ | su - $USER -c "psql -X -d postgres -A -F';'" | sed '$d'
DATABASES="$(echo "SELECT datname FROM pg_database WHERE datistemplate = false;" |\
- su - $USER -c "psql -d postgres -t -A -F';'")"
+ su - $USER -c "psql -X -d postgres -t -A -F';'")"
-POSTGRES_VERSION=$(su - $USER -c "psql -V | egrep -o '[0-9]{1,}\.[0-9]{1,}'")
+POSTGRES_VERSION=$(su - $USER -c "psql -X -V | egrep -o '[0-9]{1,}\.[0-9]{1,}'")
echo '<<<postgres_locks:sep(59)>>>'
echo -e "[databases_start]\n$DATABASES\n[databases_end]"
LOCKS="$(echo "SELECT datname, granted, mode FROM pg_locks l RIGHT JOIN pg_database d ON (d.oid=l.database) WHERE d.datallowconn;" |\
- su - $USER -c "psql -d postgres -A -F';'")"
+ su - $USER -c "psql -X -d postgres -A -F';'")"
echo "$LOCKS" | sed '$d'
@@ -83,7 +83,7 @@ QUERYTIME_QUERY="SELECT datname, datid, usename, client_addr, '' AS state, CO
fi
QUERYTIME="$(echo "$QUERYTIME_QUERY" |\
- su - $USER -c "psql -d postgres -A -F';'")"
+ su - $USER -c "psql -X -d postgres -A -F';'")"
echo "$QUERYTIME" | sed '$d'
# Contains last vacuum time and analyze time
@@ -101,7 +101,7 @@ for db in $DATABASES ; do
AND n.oid = c.relnamespace
AND n.nspname <> 'information_schema'
ORDER BY 3) AS foo;" |\
- su - $USER -c "psql -d $db $FIRST-A -F';'")"
+ su - $USER -c "psql -X -d $db $FIRST-A -F';'")"
LASTVACUUM=$(echo "$LASTVACUUM" | grep -v -e 'COMMIT$' -e 'SET$' -e 'BEGIN$')
if [ -z $FIRST ] ; then
FIRST="-t "
@@ -114,7 +114,7 @@ done
# Postgres version an connection time
echo '<<<postgres_version:sep(1)>>>'
(TIMEFORMAT='%3R'; time echo "SELECT version() AS v" |\
- su - $USER -c "psql -d postgres -t -A -F';'; echo '<<<postgres_conn_time>>>'") 2>&1
+ su - $USER -c "psql -X -d postgres -t -A -F';'; echo '<<<postgres_conn_time>>>'") 2>&1
# Number of current connections per database
echo '<<<postgres_connections:sep(59)>>>'
@@ -140,7 +140,7 @@ ORDER BY datname"
fi
CONNECTIONS="$(echo "$CONNECTIONS_QUERY" |\
- su - $USER -c "psql -d postgres -A -F';'")"
+ su - $USER -c "psql -X -d postgres -A -F';'")"
CONNECTIONS=$(echo "$CONNECTIONS" | grep -v -e 'COMMIT$' -e 'SET$' -e 'BEGIN$')
echo "$CONNECTIONS" | sed '$d'
@@ -295,7 +295,7 @@ fi
FIRST=""
for db in $DATABASES ; do
- RESPONSE="$(echo "$BLOAT_QUERY" | su - $USER -c "psql -d $db $FIRST-A -F';'")"
+ RESPONSE="$(echo "$BLOAT_QUERY" | su - $USER -c "psql -X -d $db $FIRST-A -F';'")"
if [ -z $FIRST ] ; then
FIRST="-t "
echo "$RESPONSE" | sed '$d'
Module: check_mk
Branch: master
Commit: a86e31fe7046faa8e59c94bdad8a84e17dc81b9f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a86e31fe7046fa…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Apr 24 09:33:07 2015 +0200
notify.py: add log message when receiving remote notificatin
---
modules/notify.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/notify.py b/modules/notify.py
index 14c7320..dc18841 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1484,7 +1484,8 @@ def handle_spoolfile(spoolfile):
# We received a forwarded raw notification. We need to process
# this with our local notification rules in order to call one,
# several or no actual plugins.
- notify_log("Got spool file from remote host for local delivery.")
+ notify_log("Got spool file (%s) from remote host for local delivery." %
+ find_host_service(plugin_context))
raw_context = data["context"]
locally_deliver_raw_context(data["context"])
return 0 # No error handling for async delivery
Module: check_mk
Branch: master
Commit: 43435688e03d919a2a68f5e3ab3308cbbb402f41
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43435688e03d91…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 23 16:55:34 2015 +0200
Fixed agent bakery not baking agents for hosts in distributed sites
---
modules/check_mk.py | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 7171263..e1bdb46 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -837,7 +837,10 @@ def get_single_oid(hostname, ipaddress, oid):
# Checks whether or not the given host is a cluster host
def is_cluster(hostname):
- return hostname in all_active_clusters()
+ # all_configured_clusters() needs to be used, because this function affects
+ # the agent bakery, which needs all configured hosts instead of just the hosts
+ # of this site
+ return hostname in all_configured_clusters()
# If host is node of one or more clusters, return a list of the cluster host names.
# If not, return an empty list.
@@ -1308,6 +1311,15 @@ def output_conf_header(outfile):
def all_configured_realhosts():
return strip_tags(all_hosts)
+# Returns a list of all cluster names, regardless if currently
+# disabled or monitored on a remote site. Does not return
+# cluster hosts.
+def all_configured_clusters():
+ return strip_tags(clusters.keys())
+
+def all_configured_hosts():
+ return all_configured_realhosts() + all_configured_clusters()
+
def all_active_hosts():
return all_active_realhosts() + all_active_clusters()
@@ -1317,7 +1329,7 @@ all_hosts_untagged = None
def all_active_realhosts():
global all_hosts_untagged
if all_hosts_untagged == None:
- all_hosts_untagged = filter_active_hosts(strip_tags(all_hosts))
+ all_hosts_untagged = filter_active_hosts(all_configured_realhosts())
return all_hosts_untagged
# Returns a list of all cluster host names to be handled by
@@ -1326,7 +1338,7 @@ all_clusters_untagged = None
def all_active_clusters():
global all_clusters_untagged
if all_clusters_untagged == None:
- all_clusters_untagged = filter_active_hosts(strip_tags(clusters.keys()))
+ all_clusters_untagged = filter_active_hosts(all_configured_clusters())
return all_clusters_untagged
def filter_active_hosts(hostlist):
@@ -1619,7 +1631,7 @@ def convert_host_ruleset(ruleset):
# Directly compute set of all matching hosts here, this
# will avoid recomputation later
- new_rules.append((item, all_matching_hosts(tags, hostlist)))
+ new_rules.append((item, all_matching_hosts(tags, hostlist, with_foreign_hosts=True)))
g_converted_host_rulesets_cache[id(ruleset)] = new_rules
return new_rules
@@ -1754,15 +1766,20 @@ def convert_pattern_list(patterns):
g_hostlist_match_cache = {}
g_global_caches.append('g_hostlist_match_cache')
-def all_matching_hosts(tags, hostlist):
+def all_matching_hosts(tags, hostlist, with_foreign_hosts=False):
cache_id = tuple(tags), tuple(hostlist)
try:
return g_hostlist_match_cache[cache_id]
except KeyError:
pass
+ if with_foreign_hosts:
+ valid_hosts = all_configured_hosts()
+ else:
+ valid_hosts = all_active_hosts()
+
matching = set([])
- for hostname in all_active_hosts():
+ for hostname in valid_hosts:
# When no tag matching is requested, do not filter by tags. Accept all hosts
# and filter only by hostlist
if (not tags or hosttags_match_taglist(tags_of_host(hostname), tags)) and \
Module: check_mk
Branch: master
Commit: 71eb9c6712b6f8ce5d4ae9fb6b4439a28c76e4ac
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=71eb9c6712b6f8…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Thu Apr 23 13:49:42 2015 +0200
modified text for werk 2204
---
.werks/2204 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.werks/2204 b/.werks/2204
index cf8b889..14a3d4f 100644
--- a/.werks/2204
+++ b/.werks/2204
@@ -6,9 +6,9 @@ Version: 1.2.7i1
Date: 1429282443
Class: feature
-The Check_MK HW/SW-Inventory now collections information via SNMP. The first
+The Check_MK HW/SW-Inventory now collects information via SNMP. The first
two implemented plugins are for the basic SNMP information and for the list of
network interfaces (switch ports). The latter are available in a new status
-view where you can search ports for various criteria - e.g. all ports where
+view, where you can search ports for various criteria - e.g. all ports where
the type is Ethernet and that are down for at least one month.
-All you need to do is to active the HW/SW-Inventory on those devices.
+All you need to do is to activate the HW/SW-Inventory for such devices.