summaryrefslogtreecommitdiffstats
path: root/plugins/check_dbi.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_dbi.c')
-rw-r--r--plugins/check_dbi.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/check_dbi.c b/plugins/check_dbi.c
index 826eb8d..c24ca24 100644
--- a/plugins/check_dbi.c
+++ b/plugins/check_dbi.c
@@ -35,6 +35,7 @@ const char *email = "devel@monitoring-plugins.org";
35 35
36#include "common.h" 36#include "common.h"
37#include "utils.h" 37#include "utils.h"
38#include "utils_cmd.h"
38 39
39#include "netutils.h" 40#include "netutils.h"
40 41
@@ -140,21 +141,28 @@ main (int argc, char **argv)
140 if (verbose > 2) 141 if (verbose > 2)
141 printf ("Initializing DBI\n"); 142 printf ("Initializing DBI\n");
142 143
143 if (dbi_initialize (NULL) < 0) { 144 dbi_inst *instance_p;
145
146 if (dbi_initialize_r(NULL, instance_p) < 0) {
144 printf ("UNKNOWN - failed to initialize DBI; possibly you don't have any drivers installed.\n"); 147 printf ("UNKNOWN - failed to initialize DBI; possibly you don't have any drivers installed.\n");
145 return STATE_UNKNOWN; 148 return STATE_UNKNOWN;
146 } 149 }
147 150
151 if (instance_p == NULL) {
152 printf ("UNKNOWN - failed to initialize DBI.\n");
153 return STATE_UNKNOWN;
154 }
155
148 if (verbose) 156 if (verbose)
149 printf ("Opening DBI driver '%s'\n", np_dbi_driver); 157 printf ("Opening DBI driver '%s'\n", np_dbi_driver);
150 158
151 driver = dbi_driver_open (np_dbi_driver); 159 driver = dbi_driver_open_r(np_dbi_driver, instance_p);
152 if (! driver) { 160 if (! driver) {
153 printf ("UNKNOWN - failed to open DBI driver '%s'; possibly it's not installed.\n", 161 printf ("UNKNOWN - failed to open DBI driver '%s'; possibly it's not installed.\n",
154 np_dbi_driver); 162 np_dbi_driver);
155 163
156 printf ("Known drivers:\n"); 164 printf ("Known drivers:\n");
157 for (driver = dbi_driver_list (NULL); driver; driver = dbi_driver_list (driver)) { 165 for (driver = dbi_driver_list_r(NULL, instance_p); driver; driver = dbi_driver_list_r(driver, instance_p)) {
158 printf (" - %s\n", dbi_driver_get_name (driver)); 166 printf (" - %s\n", dbi_driver_get_name (driver));
159 } 167 }
160 return STATE_UNKNOWN; 168 return STATE_UNKNOWN;
@@ -425,6 +433,7 @@ process_arguments (int argc, char **argv)
425 else 433 else
426 timeout_interval = atoi (optarg); 434 timeout_interval = atoi (optarg);
427 435
436 break;
428 case 'H': /* host */ 437 case 'H': /* host */
429 if (!is_host (optarg)) 438 if (!is_host (optarg))
430 usage2 (_("Invalid hostname/address"), optarg); 439 usage2 (_("Invalid hostname/address"), optarg);