[collectd] [PATCH 3/3] postgresql plugin: Check for and report query redefinitions.

Sebastian Harl sh at tokkee.org
Tue Aug 26 16:16:55 CEST 2008


Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/postgresql.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/postgresql.c b/src/postgresql.c
index 409a5de..e17255e 100644
--- a/src/postgresql.c
+++ b/src/postgresql.c
@@ -774,6 +774,20 @@ static int c_psql_config_query (oconfig_item_t *ci)
 			log_warn ("Ignoring unknown config key \"%s\".", c->key);
 	}
 
+	for (i = 0; i < queries_num - 1; ++i) {
+		c_psql_query_t *q = queries + i;
+
+		if ((0 == strcasecmp (q->name, query->name))
+				&& (q->min_pg_version <= query->max_pg_version)
+				&& (query->min_pg_version <= q->max_pg_version)) {
+			log_err ("Ignoring redefinition (with overlapping version ranges) "
+					"of query \"%s\".", query->name);
+			c_psql_query_delete (query);
+			--queries_num;
+			return 1;
+		}
+	}
+
 	if (query->min_pg_version > query->max_pg_version) {
 		log_err ("Query \"%s\": MinPGVersion > MaxPGVersion.",
 				query->name);
-- 
1.6.0.90.g436ed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080826/681891dc/attachment.pgp 


More information about the collectd mailing list