diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-03-12 20:37:00 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-04-17 22:37:46 (GMT) |
commit | b4e578e2cd835221ee343e56923588828d36f99b (patch) | |
tree | d0614388bfe8a927675b58e19a6acbf8c100496d /plugins/check_dbi.c | |
parent | 41fb615f3de34c3b3a344e74fd9cc24936cd58a6 (diff) | |
download | monitoring-plugins-b4e578e2cd835221ee343e56923588828d36f99b.tar.gz |
Try fixing deprecated functions in libdbi
Diffstat (limited to 'plugins/check_dbi.c')
-rw-r--r-- | plugins/check_dbi.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/check_dbi.c b/plugins/check_dbi.c index ced13d0..bbeb3d6 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; |