From: Florian Forster Date: Thu, 14 Jun 2012 12:46:03 +0000 (+0200) Subject: oracle plugin: Implement the "Host" option. X-Git-Tag: collectd-5.2.0~89 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=fb064ef2ce197070a2735cf95d7c08d5f3d074a7;p=collectd.git oracle plugin: Implement the "Host" option. --- diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 5fee0d00..66ead9c5 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -3268,6 +3268,11 @@ values submitted to the daemon. Other than that, that name is not used. Defines the "database alias" or "service name" to connect to. Usually, these names are defined in the file named C<$ORACLE_HOME/network/admin/tnsnames.ora>. +=item B I + +Hostname to use when dispatching values for this database. Defaults to using +the global hostname of the I instance. + =item B I Username used for authentication. diff --git a/src/oracle.c b/src/oracle.c index 4415b489..05213e01 100644 --- a/src/oracle.c +++ b/src/oracle.c @@ -59,6 +59,7 @@ struct o_database_s { char *name; + char *host; char *connect_id; char *username; char *password; @@ -223,6 +224,11 @@ static int o_config_add_database (oconfig_item_t *ci) /* {{{ */ return (-1); } memset (db, 0, sizeof (*db)); + db->name = NULL; + db->host = NULL; + db->connect_id = NULL; + db->username = NULL; + db->password = NULL; status = o_config_set_string (&db->name, ci); if (status != 0) @@ -238,6 +244,8 @@ static int o_config_add_database (oconfig_item_t *ci) /* {{{ */ if (strcasecmp ("ConnectID", child->key) == 0) status = o_config_set_string (&db->connect_id, child); + else if (strcasecmp ("Host", child->key) == 0) + status = o_config_set_string (&db->host, child); else if (strcasecmp ("Username", child->key) == 0) status = o_config_set_string (&db->username, child); else if (strcasecmp ("Password", child->key) == 0) @@ -601,7 +609,8 @@ static int o_read_database_query (o_database_t *db, /* {{{ */ } /* for (j = 1; j <= param_counter; j++) */ /* }}} End of the ``define'' stuff. */ - status = udb_query_prepare_result (q, prep_area, hostname_g, + status = udb_query_prepare_result (q, prep_area, + (db->host != NULL) ? db->host : hostname_g, /* plugin = */ "oracle", db->name, column_names, column_num, /* interval = */ 0); if (status != 0)