X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fpostgresql.c;h=3b702aeef83491d590a631e142f37fec856151c1;hp=56730b47958eecf37183b466224e25d35f9498f3;hb=9f77f493ef7cf6077deaa2385d2392d144cf606f;hpb=9ea04e3e99a0b14e001ad1be6030815a236dc91c diff --git a/src/postgresql.c b/src/postgresql.c index 56730b47..3b702aee 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -139,6 +139,7 @@ typedef struct { char *password; char *instance; + char *plugin_name; char *sslmode; @@ -250,6 +251,8 @@ static c_psql_database_t *c_psql_database_new(const char *name) { db->instance = sstrdup(name); + db->plugin_name = NULL; + db->sslmode = NULL; db->krbsrvname = NULL; @@ -300,6 +303,8 @@ static void c_psql_database_delete(void *data) { sfree(db->instance); + sfree(db->plugin_name); + sfree(db->sslmode); sfree(db->krbsrvname); @@ -539,9 +544,11 @@ static int c_psql_exec_query(c_psql_database_t *db, udb_query_t *q, else host = db->host; - status = - udb_query_prepare_result(q, prep_area, host, "postgresql", db->instance, - column_names, (size_t)column_num, db->interval); + status = udb_query_prepare_result( + q, prep_area, host, + (db->plugin_name != NULL) ? db->plugin_name : "postgresql", + db->instance, column_names, (size_t)column_num, db->interval); + if (0 != status) { log_err("udb_query_prepare_result failed with status %i.", status); BAIL_OUT(-1); @@ -1139,6 +1146,8 @@ static int c_psql_config_database(oconfig_item_t *ci) { cf_util_get_string(c, &db->password); else if (0 == strcasecmp(c->key, "Instance")) cf_util_get_string(c, &db->instance); + else if (0 == strcasecmp (c->key, "Plugin")) + cf_util_get_string (c, &db->plugin_name); else if (0 == strcasecmp(c->key, "SSLMode")) cf_util_get_string(c, &db->sslmode); else if (0 == strcasecmp(c->key, "KRBSrvName"))