b52ea4eef6f318f5b6cee60f810e4a69fff88c0b
1 /**
2 * collectd - src/oracle.c
3 * Copyright (C) 2008,2009 noris network AG
4 * Copyright (C) 2012 Florian octo Forster
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; only version 2 of the License is applicable.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Linking src/oracle.c ("the oracle plugin") statically or dynamically with
20 * other modules is making a combined work based on the oracle plugin. Thus,
21 * the terms and conditions of the GNU General Public License cover the whole
22 * combination.
23 *
24 * In addition, as a special exception, the copyright holders of the oracle
25 * plugin give you permission to combine the oracle plugin with free software
26 * programs or libraries that are released under the GNU LGPL and with code
27 * included in the standard release of the Oracle® Call Interface (OCI) under
28 * the Oracle® Technology Network (OTN) License (or modified versions of such
29 * code, with unchanged license). You may copy and distribute such a system
30 * following the terms of the GNU GPL for the oracle plugin and the licenses of
31 * the other code concerned.
32 *
33 * Note that people who make modified versions of the oracle plugin are not
34 * obligated to grant this special exception for their modified versions; it is
35 * their choice whether to do so. The GNU General Public License gives
36 * permission to release a modified version without this exception; this
37 * exception also makes it possible to release a modified version which carries
38 * forward this exception. However, without this exception the OTN License does
39 * not allow linking with code licensed under the GNU General Public License.
40 *
41 * Oracle® is a registered trademark of Oracle Corporation and/or its
42 * affiliates. Other names may be trademarks of their respective owners.
43 *
44 * Authors:
45 * Florian octo Forster <octo at collectd.org>
46 **/
48 #include "collectd.h"
50 #include "common.h"
51 #include "plugin.h"
52 #include "utils_db_query.h"
54 #include <oci.h>
56 /*
57 * Data types
58 */
59 struct o_database_s {
60 char *name;
61 char *host;
62 char *connect_id;
63 char *username;
64 char *password;
66 udb_query_preparation_area_t **q_prep_areas;
67 udb_query_t **queries;
68 size_t queries_num;
70 OCISvcCtx *oci_service_context;
71 };
72 typedef struct o_database_s o_database_t;
74 /*
75 * Global variables
76 */
77 static udb_query_t **queries = NULL;
78 static size_t queries_num = 0;
79 static o_database_t **databases = NULL;
80 static size_t databases_num = 0;
82 OCIEnv *oci_env = NULL;
83 OCIError *oci_error = NULL;
85 /*
86 * Functions
87 */
88 static void o_report_error(const char *where, /* {{{ */
89 const char *db_name, const char *query_name,
90 const char *what, OCIError *eh) {
91 char buffer[2048];
92 sb4 error_code;
93 int status;
95 if (db_name == NULL)
96 db_name = "(none)";
97 if (query_name == NULL)
98 query_name = "(none)";
100 /* An operation may cause / return multiple errors. Loop until we have
101 * handled all errors available (with a fail-save limit of 16). */
102 for (unsigned int record_number = 1; record_number <= 16; record_number++) {
103 memset(buffer, 0, sizeof(buffer));
104 error_code = -1;
106 status = OCIErrorGet(eh, (ub4)record_number,
107 /* sqlstate = */ NULL, &error_code, (text *)&buffer[0],
108 (ub4)sizeof(buffer), OCI_HTYPE_ERROR);
109 buffer[sizeof(buffer) - 1] = 0;
111 if (status == OCI_NO_DATA)
112 return;
114 if (status == OCI_SUCCESS) {
115 size_t buffer_length;
117 buffer_length = strlen(buffer);
118 while ((buffer_length > 0) && (buffer[buffer_length - 1] < 32)) {
119 buffer_length--;
120 buffer[buffer_length] = 0;
121 }
123 ERROR("oracle plugin: %s (db = %s, query = %s): %s failed: %s", where,
124 db_name, query_name, what, buffer);
125 } else {
126 ERROR("oracle plugin: %s (db = %s, query = %s): %s failed. "
127 "Additionally, OCIErrorGet failed with status %i.",
128 where, db_name, query_name, what, status);
129 return;
130 }
131 }
132 } /* }}} void o_report_error */
134 static void o_database_free(o_database_t *db) /* {{{ */
135 {
136 if (db == NULL)
137 return;
139 sfree(db->name);
140 sfree(db->connect_id);
141 sfree(db->username);
142 sfree(db->password);
143 sfree(db->queries);
145 if (db->q_prep_areas != NULL)
146 for (size_t i = 0; i < db->queries_num; ++i)
147 udb_query_delete_preparation_area(db->q_prep_areas[i]);
148 free(db->q_prep_areas);
150 sfree(db);
151 } /* }}} void o_database_free */
153 /* Configuration handling functions {{{
154 *
155 * <Plugin oracle>
156 * <Query "plugin_instance0">
157 * Statement "SELECT name, value FROM table"
158 * <Result>
159 * Type "gauge"
160 * InstancesFrom "name"
161 * ValuesFrom "value"
162 * </Result>
163 * </Query>
164 *
165 * <Database "plugin_instance1">
166 * ConnectID "db01"
167 * Username "oracle"
168 * Password "secret"
169 * Query "plugin_instance0"
170 * </Database>
171 * </Plugin>
172 */
174 static int o_config_add_database(oconfig_item_t *ci) /* {{{ */
175 {
176 o_database_t *db;
177 int status;
179 if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) {
180 WARNING("oracle plugin: The `Database' block "
181 "needs exactly one string argument.");
182 return (-1);
183 }
185 db = calloc(1, sizeof(*db));
186 if (db == NULL) {
187 ERROR("oracle plugin: calloc failed.");
188 return (-1);
189 }
190 db->name = NULL;
191 db->host = NULL;
192 db->connect_id = NULL;
193 db->username = NULL;
194 db->password = NULL;
196 status = cf_util_get_string(ci, &db->name);
197 if (status != 0) {
198 sfree(db);
199 return (status);
200 }
202 /* Fill the `o_database_t' structure.. */
203 for (int i = 0; i < ci->children_num; i++) {
204 oconfig_item_t *child = ci->children + i;
206 if (strcasecmp("ConnectID", child->key) == 0)
207 status = cf_util_get_string(child, &db->connect_id);
208 else if (strcasecmp("Host", child->key) == 0)
209 status = cf_util_get_string(child, &db->host);
210 else if (strcasecmp("Username", child->key) == 0)
211 status = cf_util_get_string(child, &db->username);
212 else if (strcasecmp("Password", child->key) == 0)
213 status = cf_util_get_string(child, &db->password);
214 else if (strcasecmp("Query", child->key) == 0)
215 status = udb_query_pick_from_list(child, queries, queries_num,
216 &db->queries, &db->queries_num);
217 else {
218 WARNING("oracle plugin: Option `%s' not allowed here.", child->key);
219 status = -1;
220 }
222 if (status != 0)
223 break;
224 }
226 /* Check that all necessary options have been given. */
227 while (status == 0) {
228 if (db->connect_id == NULL) {
229 WARNING("oracle plugin: `ConnectID' not given for query `%s'", db->name);
230 status = -1;
231 }
232 if (db->username == NULL) {
233 WARNING("oracle plugin: `Username' not given for query `%s'", db->name);
234 status = -1;
235 }
236 if (db->password == NULL) {
237 WARNING("oracle plugin: `Password' not given for query `%s'", db->name);
238 status = -1;
239 }
241 break;
242 } /* while (status == 0) */
244 while ((status == 0) && (db->queries_num > 0)) {
245 db->q_prep_areas = (udb_query_preparation_area_t **)calloc(
246 db->queries_num, sizeof(*db->q_prep_areas));
248 if (db->q_prep_areas == NULL) {
249 WARNING("oracle plugin: calloc failed");
250 status = -1;
251 break;
252 }
254 for (int i = 0; i < db->queries_num; ++i) {
255 db->q_prep_areas[i] = udb_query_allocate_preparation_area(db->queries[i]);
257 if (db->q_prep_areas[i] == NULL) {
258 WARNING("oracle plugin: udb_query_allocate_preparation_area failed");
259 status = -1;
260 break;
261 }
262 }
264 break;
265 }
267 /* If all went well, add this query to the list of queries within the
268 * database structure. */
269 if (status == 0) {
270 o_database_t **temp;
272 temp = realloc(databases, sizeof(*databases) * (databases_num + 1));
273 if (temp == NULL) {
274 ERROR("oracle plugin: realloc failed");
275 status = -1;
276 } else {
277 databases = temp;
278 databases[databases_num] = db;
279 databases_num++;
280 }
281 }
283 if (status != 0) {
284 o_database_free(db);
285 return (-1);
286 }
288 return (0);
289 } /* }}} int o_config_add_database */
291 static int o_config(oconfig_item_t *ci) /* {{{ */
292 {
293 for (int i = 0; i < ci->children_num; i++) {
294 oconfig_item_t *child = ci->children + i;
295 if (strcasecmp("Query", child->key) == 0)
296 udb_query_create(&queries, &queries_num, child,
297 /* callback = */ NULL);
298 else if (strcasecmp("Database", child->key) == 0)
299 o_config_add_database(child);
300 else {
301 WARNING("oracle plugin: Ignoring unknown config option `%s'.",
302 child->key);
303 }
305 if (queries_num > 0) {
306 DEBUG("oracle plugin: o_config: queries_num = %zu; queries[0] = %p; "
307 "udb_query_get_user_data (queries[0]) = %p;",
308 queries_num, (void *)queries[0],
309 udb_query_get_user_data(queries[0]));
310 }
311 } /* for (ci->children) */
313 return (0);
314 } /* }}} int o_config */
316 /* }}} End of configuration handling functions */
318 static int o_init(void) /* {{{ */
319 {
320 int status;
322 if (oci_env != NULL)
323 return (0);
325 status = OCIEnvCreate(&oci_env,
326 /* mode = */ OCI_THREADED,
327 /* context = */ NULL,
328 /* malloc = */ NULL,
329 /* realloc = */ NULL,
330 /* free = */ NULL,
331 /* user_data_size = */ 0,
332 /* user_data_ptr = */ NULL);
333 if (status != 0) {
334 ERROR("oracle plugin: OCIEnvCreate failed with status %i.", status);
335 return (-1);
336 }
338 status = OCIHandleAlloc(oci_env, (void *)&oci_error, OCI_HTYPE_ERROR,
339 /* user_data_size = */ 0, /* user_data = */ NULL);
340 if (status != OCI_SUCCESS) {
341 ERROR("oracle plugin: OCIHandleAlloc (OCI_HTYPE_ERROR) failed "
342 "with status %i.",
343 status);
344 return (-1);
345 }
347 return (0);
348 } /* }}} int o_init */
350 static int o_read_database_query(o_database_t *db, /* {{{ */
351 udb_query_t *q,
352 udb_query_preparation_area_t *prep_area) {
353 char **column_names;
354 char **column_values;
355 size_t column_num;
357 OCIStmt *oci_statement;
359 /* List of `OCIDefine' pointers. These defines map columns to the buffer
360 * space declared above. */
361 OCIDefine **oci_defines;
363 int status;
365 oci_statement = udb_query_get_user_data(q);
367 /* Prepare the statement */
368 if (oci_statement == NULL) /* {{{ */
369 {
370 const char *statement;
372 statement = udb_query_get_statement(q);
373 assert(statement != NULL);
375 status = OCIHandleAlloc(oci_env, (void *)&oci_statement, OCI_HTYPE_STMT,
376 /* user_data_size = */ 0, /* user_data = */ NULL);
377 if (status != OCI_SUCCESS) {
378 o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
379 "OCIHandleAlloc", oci_error);
380 oci_statement = NULL;
381 return (-1);
382 }
384 status = OCIStmtPrepare(oci_statement, oci_error, (text *)statement,
385 (ub4)strlen(statement),
386 /* language = */ OCI_NTV_SYNTAX,
387 /* mode = */ OCI_DEFAULT);
388 if (status != OCI_SUCCESS) {
389 o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
390 "OCIStmtPrepare", oci_error);
391 OCIHandleFree(oci_statement, OCI_HTYPE_STMT);
392 oci_statement = NULL;
393 return (-1);
394 }
395 udb_query_set_user_data(q, oci_statement);
397 DEBUG("oracle plugin: o_read_database_query (%s, %s): "
398 "Successfully allocated statement handle.",
399 db->name, udb_query_get_name(q));
400 } /* }}} */
402 assert(oci_statement != NULL);
404 /* Execute the statement */
405 status = OCIStmtExecute(db->oci_service_context, /* {{{ */
406 oci_statement, oci_error,
407 /* iters = */ 0,
408 /* rowoff = */ 0,
409 /* snap_in = */ NULL, /* snap_out = */ NULL,
410 /* mode = */ OCI_DEFAULT);
411 if (status != OCI_SUCCESS) {
412 o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
413 "OCIStmtExecute", oci_error);
414 return (-1);
415 } /* }}} */
417 /* Acquire the number of columns returned. */
418 do /* {{{ */
419 {
420 ub4 param_counter = 0;
421 status = OCIAttrGet(oci_statement, OCI_HTYPE_STMT, /* {{{ */
422 ¶m_counter, /* size pointer = */ NULL,
423 OCI_ATTR_PARAM_COUNT, oci_error);
424 if (status != OCI_SUCCESS) {
425 o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
426 "OCIAttrGet", oci_error);
427 return (-1);
428 } /* }}} */
430 column_num = (size_t)param_counter;
431 } while (0); /* }}} */
433 /* Allocate the following buffers:
434 *
435 * +---------------+-----------------------------------+
436 * ! Name ! Size !
437 * +---------------+-----------------------------------+
438 * ! column_names ! column_num x DATA_MAX_NAME_LEN !
439 * ! column_values ! column_num x DATA_MAX_NAME_LEN !
440 * ! oci_defines ! column_num x sizeof (OCIDefine *) !
441 * +---------------+-----------------------------------+
442 *
443 * {{{ */
444 #define NUMBER_BUFFER_SIZE 64
446 #define FREE_ALL \
447 if (column_names != NULL) { \
448 sfree(column_names[0]); \
449 sfree(column_names); \
450 } \
451 if (column_values != NULL) { \
452 sfree(column_values[0]); \
453 sfree(column_values); \
454 } \
455 sfree(oci_defines)
457 #define ALLOC_OR_FAIL(ptr, ptr_size) \
458 do { \
459 size_t alloc_size = (size_t)((ptr_size)); \
460 (ptr) = calloc(1, alloc_size); \
461 if ((ptr) == NULL) { \
462 FREE_ALL; \
463 ERROR("oracle plugin: o_read_database_query: calloc failed."); \
464 return (-1); \
465 } \
466 } while (0)
468 /* Initialize everything to NULL so the above works. */
469 column_names = NULL;
470 column_values = NULL;
471 oci_defines = NULL;
473 ALLOC_OR_FAIL(column_names, column_num * sizeof(char *));
474 ALLOC_OR_FAIL(column_names[0], column_num * DATA_MAX_NAME_LEN * sizeof(char));
475 for (size_t i = 1; i < column_num; i++)
476 column_names[i] = column_names[i - 1] + DATA_MAX_NAME_LEN;
478 ALLOC_OR_FAIL(column_values, column_num * sizeof(char *));
479 ALLOC_OR_FAIL(column_values[0],
480 column_num * DATA_MAX_NAME_LEN * sizeof(char));
481 for (size_t i = 1; i < column_num; i++)
482 column_values[i] = column_values[i - 1] + DATA_MAX_NAME_LEN;
484 ALLOC_OR_FAIL(oci_defines, column_num * sizeof(OCIDefine *));
485 /* }}} End of buffer allocations. */
487 /* ``Define'' the returned data, i. e. bind the columns to the buffers
488 * allocated above. */
489 for (size_t i = 0; i < column_num; i++) /* {{{ */
490 {
491 char *column_name;
492 ub4 column_name_length;
493 OCIParam *oci_param;
495 oci_param = NULL;
497 status = OCIParamGet(oci_statement, OCI_HTYPE_STMT, oci_error,
498 (void *)&oci_param, (ub4)(i + 1));
499 if (status != OCI_SUCCESS) {
500 /* This is probably alright */
501 DEBUG("oracle plugin: o_read_database_query: status = %#x (= %i);",
502 status, status);
503 o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
504 "OCIParamGet", oci_error);
505 status = OCI_SUCCESS;
506 break;
507 }
509 column_name = NULL;
510 column_name_length = 0;
511 status = OCIAttrGet(oci_param, OCI_DTYPE_PARAM, &column_name,
512 &column_name_length, OCI_ATTR_NAME, oci_error);
513 if (status != OCI_SUCCESS) {
514 OCIDescriptorFree(oci_param, OCI_DTYPE_PARAM);
515 o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
516 "OCIAttrGet (OCI_ATTR_NAME)", oci_error);
517 continue;
518 }
520 OCIDescriptorFree(oci_param, OCI_DTYPE_PARAM);
521 oci_param = NULL;
523 /* Copy the name to column_names. Warning: The ``string'' returned by OCI
524 * may not be null terminated! */
525 memset(column_names[i], 0, DATA_MAX_NAME_LEN);
526 if (column_name_length >= DATA_MAX_NAME_LEN)
527 column_name_length = DATA_MAX_NAME_LEN - 1;
528 memcpy(column_names[i], column_name, column_name_length);
529 column_names[i][column_name_length] = 0;
531 DEBUG("oracle plugin: o_read_database_query: column_names[%zu] = %s; "
532 "column_name_length = %" PRIu32 ";",
533 i, column_names[i], (uint32_t)column_name_length);
535 status = OCIDefineByPos(oci_statement, &oci_defines[i], oci_error,
536 (ub4)(i + 1), column_values[i], DATA_MAX_NAME_LEN,
537 SQLT_STR, NULL, NULL, NULL, OCI_DEFAULT);
538 if (status != OCI_SUCCESS) {
539 o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
540 "OCIDefineByPos", oci_error);
541 continue;
542 }
543 } /* for (j = 1; j <= param_counter; j++) */
544 /* }}} End of the ``define'' stuff. */
546 status = udb_query_prepare_result(
547 q, prep_area, (db->host != NULL) ? db->host : hostname_g,
548 /* plugin = */ "oracle", db->name, column_names, column_num,
549 /* interval = */ 0);
550 if (status != 0) {
551 ERROR("oracle plugin: o_read_database_query (%s, %s): "
552 "udb_query_prepare_result failed.",
553 db->name, udb_query_get_name(q));
554 FREE_ALL;
555 return (-1);
556 }
558 /* Fetch and handle all the rows that matched the query. */
559 while (42) /* {{{ */
560 {
561 status = OCIStmtFetch2(oci_statement, oci_error,
562 /* nrows = */ 1, /* orientation = */ OCI_FETCH_NEXT,
563 /* fetch offset = */ 0, /* mode = */ OCI_DEFAULT);
564 if (status == OCI_NO_DATA) {
565 status = OCI_SUCCESS;
566 break;
567 } else if ((status != OCI_SUCCESS) && (status != OCI_SUCCESS_WITH_INFO)) {
568 o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
569 "OCIStmtFetch2", oci_error);
570 break;
571 }
573 status = udb_query_handle_result(q, prep_area, column_values);
574 if (status != 0) {
575 WARNING("oracle plugin: o_read_database_query (%s, %s): "
576 "udb_query_handle_result failed.",
577 db->name, udb_query_get_name(q));
578 }
579 } /* }}} while (42) */
581 /* DEBUG ("oracle plugin: o_read_database_query: This statement succeeded:
582 * %s", q->statement); */
583 FREE_ALL;
585 return (0);
586 #undef FREE_ALL
587 #undef ALLOC_OR_FAIL
588 } /* }}} int o_read_database_query */
590 static int o_read_database(o_database_t *db) /* {{{ */
591 {
592 int status;
594 if (db->oci_service_context != NULL) {
595 OCIServer *server_handle;
596 ub4 connection_status;
598 server_handle = NULL;
599 status = OCIAttrGet((void *)db->oci_service_context, OCI_HTYPE_SVCCTX,
600 (void *)&server_handle, /* size pointer = */ NULL,
601 OCI_ATTR_SERVER, oci_error);
602 if (status != OCI_SUCCESS) {
603 o_report_error("o_read_database", db->name, NULL, "OCIAttrGet",
604 oci_error);
605 return (-1);
606 }
608 if (server_handle == NULL) {
609 connection_status = OCI_SERVER_NOT_CONNECTED;
610 } else /* if (server_handle != NULL) */
611 {
612 connection_status = 0;
613 status = OCIAttrGet((void *)server_handle, OCI_HTYPE_SERVER,
614 (void *)&connection_status, /* size pointer = */ NULL,
615 OCI_ATTR_SERVER_STATUS, oci_error);
616 if (status != OCI_SUCCESS) {
617 o_report_error("o_read_database", db->name, NULL, "OCIAttrGet",
618 oci_error);
619 return (-1);
620 }
621 }
623 if (connection_status != OCI_SERVER_NORMAL) {
624 INFO("oracle plugin: Connection to %s lost. Trying to reconnect.",
625 db->name);
626 OCIHandleFree(db->oci_service_context, OCI_HTYPE_SVCCTX);
627 db->oci_service_context = NULL;
628 }
629 } /* if (db->oci_service_context != NULL) */
631 if (db->oci_service_context == NULL) {
632 status = OCILogon(oci_env, oci_error, &db->oci_service_context,
633 (OraText *)db->username, (ub4)strlen(db->username),
634 (OraText *)db->password, (ub4)strlen(db->password),
635 (OraText *)db->connect_id, (ub4)strlen(db->connect_id));
636 if ((status != OCI_SUCCESS) && (status != OCI_SUCCESS_WITH_INFO)) {
637 char errfunc[256];
639 ssnprintf(errfunc, sizeof(errfunc), "OCILogon(\"%s\")", db->connect_id);
641 o_report_error("o_read_database", db->name, NULL, errfunc, oci_error);
642 DEBUG("oracle plugin: OCILogon (%s): db->oci_service_context = %p;",
643 db->connect_id, db->oci_service_context);
644 db->oci_service_context = NULL;
645 return (-1);
646 } else if (status == OCI_SUCCESS_WITH_INFO) {
647 /* TODO: Print NOTIFY message. */
648 }
649 assert(db->oci_service_context != NULL);
650 }
652 DEBUG("oracle plugin: o_read_database: db->connect_id = %s; "
653 "db->oci_service_context = %p;",
654 db->connect_id, db->oci_service_context);
656 for (size_t i = 0; i < db->queries_num; i++)
657 o_read_database_query(db, db->queries[i], db->q_prep_areas[i]);
659 return (0);
660 } /* }}} int o_read_database */
662 static int o_read(void) /* {{{ */
663 {
664 size_t i;
666 for (i = 0; i < databases_num; i++)
667 o_read_database(databases[i]);
669 return (0);
670 } /* }}} int o_read */
672 static int o_shutdown(void) /* {{{ */
673 {
674 size_t i;
676 for (i = 0; i < databases_num; i++)
677 if (databases[i]->oci_service_context != NULL) {
678 OCIHandleFree(databases[i]->oci_service_context, OCI_HTYPE_SVCCTX);
679 databases[i]->oci_service_context = NULL;
680 }
682 for (i = 0; i < queries_num; i++) {
683 OCIStmt *oci_statement;
685 oci_statement = udb_query_get_user_data(queries[i]);
686 if (oci_statement != NULL) {
687 OCIHandleFree(oci_statement, OCI_HTYPE_STMT);
688 udb_query_set_user_data(queries[i], NULL);
689 }
690 }
692 OCIHandleFree(oci_env, OCI_HTYPE_ENV);
693 oci_env = NULL;
695 udb_query_free(queries, queries_num);
696 queries = NULL;
697 queries_num = 0;
699 return (0);
700 } /* }}} int o_shutdown */
702 void module_register(void) /* {{{ */
703 {
704 plugin_register_complex_config("oracle", o_config);
705 plugin_register_init("oracle", o_init);
706 plugin_register_read("oracle", o_read);
707 plugin_register_shutdown("oracle", o_shutdown);
708 } /* }}} void module_register */