summaryrefslogtreecommitdiffstats
path: root/plugins/check_dbi.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2023-09-17 23:15:59 +0200
committerGitHub <noreply@github.com>2023-09-17 23:15:59 +0200
commitd3e07d2b5734149c1314cb98b48dd1adebd62686 (patch)
treea924b49927ae1925a7e0893d31e0c9c6abd3228e /plugins/check_dbi.c
parent495c4c9adfa482303b31cdac7d28adda82d2d2ed (diff)
parent2ddc75e69db5a3dd379c896d8420c9af20ec1cee (diff)
downloadmonitoring-plugins-d3e07d2.tar.gz
Merge branch 'master' into dev/check_ssh-patches
Diffstat (limited to 'plugins/check_dbi.c')
-rw-r--r--plugins/check_dbi.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/check_dbi.c b/plugins/check_dbi.c
index ced13d05..c24ca248 100644
--- a/plugins/check_dbi.c
+++ b/plugins/check_dbi.c
@@ -141,21 +141,28 @@ main (int argc, char **argv)
141 if (verbose > 2) 141 if (verbose > 2)
142 printf ("Initializing DBI\n"); 142 printf ("Initializing DBI\n");
143 143
144 if (dbi_initialize (NULL) < 0) { 144 dbi_inst *instance_p;
145
146 if (dbi_initialize_r(NULL, instance_p) < 0) {
145 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");
146 return STATE_UNKNOWN; 148 return STATE_UNKNOWN;
147 } 149 }
148 150
151 if (instance_p == NULL) {
152 printf ("UNKNOWN - failed to initialize DBI.\n");
153 return STATE_UNKNOWN;
154 }
155
149 if (verbose) 156 if (verbose)
150 printf ("Opening DBI driver '%s'\n", np_dbi_driver); 157 printf ("Opening DBI driver '%s'\n", np_dbi_driver);
151 158
152 driver = dbi_driver_open (np_dbi_driver); 159 driver = dbi_driver_open_r(np_dbi_driver, instance_p);
153 if (! driver) { 160 if (! driver) {
154 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",
155 np_dbi_driver); 162 np_dbi_driver);
156 163
157 printf ("Known drivers:\n"); 164 printf ("Known drivers:\n");
158 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)) {
159 printf (" - %s\n", dbi_driver_get_name (driver)); 166 printf (" - %s\n", dbi_driver_get_name (driver));
160 } 167 }
161 return STATE_UNKNOWN; 168 return STATE_UNKNOWN;
@@ -426,6 +433,7 @@ process_arguments (int argc, char **argv)
426 else 433 else
427 timeout_interval = atoi (optarg); 434 timeout_interval = atoi (optarg);
428 435
436 break;
429 case 'H': /* host */ 437 case 'H': /* host */
430 if (!is_host (optarg)) 438 if (!is_host (optarg))
431 usage2 (_("Invalid hostname/address"), optarg); 439 usage2 (_("Invalid hostname/address"), optarg);