From 57532a762e64ee5d9f20bda1cf4cbaef3580e5b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Sat, 21 Mar 2020 17:16:10 +0100 Subject: [PATCH] Added new global variable 'prometheus_plugin' to specify the loading of the plugin --- include/proxysql_glovars.hpp | 1 + src/main.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/proxysql_glovars.hpp b/include/proxysql_glovars.hpp index 6c4f0f46f..39eb3ce8d 100644 --- a/include/proxysql_glovars.hpp +++ b/include/proxysql_glovars.hpp @@ -59,6 +59,7 @@ class ProxySQL_GlobalVariables { char * execute_on_exit_failure; char * web_interface_plugin; char * ldap_auth_plugin; + std::string prometheus_plugin {""}; struct { unsigned long long start_time; bool gdbg; diff --git a/src/main.cpp b/src/main.cpp index 6bc9c778a..c1018b9ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -852,6 +852,14 @@ void ProxySQL_Main_process_global_variables(int argc, const char **argv) { GloVars.ldap_auth_plugin=strdup(ldap_auth_plugin.c_str()); } } + if (root.exists("prometheus_plugin")==true) { + string prometheus_plugin { "" }; + bool rc { root.lookupValue("prometheus_plugin", prometheus_plugin) }; + + if (rc == true) { + GloVars.prometheus_plugin = prometheus_plugin; + } + } } else { proxy_warning("Unable to open config file %s\n", GloVars.config_file); // issue #705 if (GloVars.__cmd_proxysql_config_file) {