diff --git a/pandora_agents/win32/Makefile.am b/pandora_agents/win32/Makefile.am index 3f8b19bd4c..9b22e60a96 100644 --- a/pandora_agents/win32/Makefile.am +++ b/pandora_agents/win32/Makefile.am @@ -1,9 +1,9 @@ bin_PROGRAMS = PandoraAgent if DEBUG -PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_odbc.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp +PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp PandoraAgent_CXXFLAGS=-g -O0 -DCURL_STATICLIB -D__DEBUG__ else -PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_odbc.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc +PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc PandoraAgent_CXXFLAGS=-O2 -DCURL_STATICLIB endif PandoraAgent_LDFLAGS=-static-libgcc -static-libstdc++ diff --git a/pandora_agents/win32/PandoraAgent.dev b/pandora_agents/win32/PandoraAgent.dev index 986c2f15e9..589e5b539e 100644 --- a/pandora_agents/win32/PandoraAgent.dev +++ b/pandora_agents/win32/PandoraAgent.dev @@ -12,7 +12,7 @@ ResourceIncludes= MakeIncludes= Compiler=_@@_ CppCompiler=_@@_ -Linker=-lole32_@@_-loleaut32_@@_-luuid_@@_-lpsapi_@@_-lwsock32_@@_-lz_@@_-liphlpapi_@@_-lnetapi32_@@_-lws2_32_@@_-lcrypto_@@_-lodbc++_@@_-lgdi32_@@_-lcurldll_@@_C:\Dev-Cpp\lib\libboost_regex-mgw-mt-s-1_33_1.lib_@@_ +Linker=-lole32_@@_-loleaut32_@@_-luuid_@@_-lpsapi_@@_-lwsock32_@@_-lz_@@_-liphlpapi_@@_-lnetapi32_@@_-lws2_32_@@_-lcrypto_@@_-lgdi32_@@_-lcurldll_@@_C:\Dev-Cpp\lib\libboost_regex-mgw-mt-s-1_33_1.lib_@@_ IsCpp=1 Icon= ExeOutput= @@ -737,26 +737,6 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit70] -FileName=modules\pandora_module_odbc.cc -CompileCpp=1 -Folder=Modules -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit71] -FileName=modules\pandora_module_odbc.h -CompileCpp=1 -Folder=Modules -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - [Unit72] FileName=modules\pandora_data.h CompileCpp=1 diff --git a/pandora_agents/win32/configure.in b/pandora_agents/win32/configure.in index f2906438da..fea92e4019 100644 --- a/pandora_agents/win32/configure.in +++ b/pandora_agents/win32/configure.in @@ -39,7 +39,6 @@ AC_CHECK_LIB([gdi32], [main], , AC_MSG_ERROR([libgdi32 not found.])) AC_CHECK_LIB([crypto], [main], , AC_MSG_ERROR([libcrypto not found.])) AC_CHECK_LIB([ssl], [main], , AC_MSG_ERROR([libssl not found.])) AC_CHECK_LIB([curl], [main], , AC_MSG_ERROR([libcurl not found.])) -AC_CHECK_LIB([odbc++], [main], , AC_MSG_ERROR([libodbc++ not found.])) # Checks for header files. AC_CHECK_HEADERS([fcntl.h stddef.h stdlib.h string.h sys/socket.h sys/time.h unistd.h wchar.h]) diff --git a/pandora_agents/win32/installer/How_to_create_installer.txt b/pandora_agents/win32/installer/How_to_create_installer.txt index cc978c09f7..9f1c9515ef 100644 --- a/pandora_agents/win32/installer/How_to_create_installer.txt +++ b/pandora_agents/win32/installer/How_to_create_installer.txt @@ -38,7 +38,6 @@ C:\pandora_installer | `-- PUT_SSH_KEYS_HERE |-- libcurl.dll |-- libeay32.dll -|-- libodbc++.dll |-- pandora_agent.conf |-- PandoraAgent.exe |-- util diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 95a52e2aec..24f3ce29ea 100755 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -560,7 +560,6 @@ File ::33B94DB4-C180-92CA-28A9-8E748747A201 -type dir -name tmp -active 0 -paren File ::9A553712-B42A-6A8F-00B1-4E8933B83D00 -type dir -name prop-base -active 0 -parent 33B94DB4-C180-92CA-28A9-8E748747A201 File ::9376A1BB-540D-AF99-82D1-DEEDB5621B31 -type dir -name props -active 0 -parent 33B94DB4-C180-92CA-28A9-8E748747A201 File ::FDE18B19-66AE-E8C6-38A9-FB675E103E81 -type dir -name text-base -active 0 -parent 33B94DB4-C180-92CA-28A9-8E748747A201 -File ::9E5D6A00-E82C-49B4-B654-3F36D4D48A83 -name ../bin/libodbc++.dll -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 File ::8DC9C5E7-7957-7E7A-5603-F78DACBDE9C2 -type dir -name ../bin/collections -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 File ::DC2682C5-68A1-8249-6160-9B1896DAECB9 -type dir -name .svn -active 0 -parent 8DC9C5E7-7957-7E7A-5603-F78DACBDE9C2 File ::F253AE0D-A56D-F650-C7C7-0FC69D2EA3B8 -type dir -name props -active 0 -parent DC2682C5-68A1-8249-6160-9B1896DAECB9 diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index 355b0785fc..9cc6c4758a 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -243,8 +243,6 @@ Pandora_Module::parseModuleKindFromString (string kind) { return MODULE_CPUUSAGE; } else if (kind == module_inventory_str) { return MODULE_INVENTORY; - } else if (kind == module_odbc_str) { - return MODULE_ODBC; } else if (kind == module_logevent_str) { return MODULE_LOGEVENT; } else if (kind == module_wmiquery_str) { diff --git a/pandora_agents/win32/modules/pandora_module.h b/pandora_agents/win32/modules/pandora_module.h index 0241247e6a..429ab67394 100644 --- a/pandora_agents/win32/modules/pandora_module.h +++ b/pandora_agents/win32/modules/pandora_module.h @@ -82,7 +82,6 @@ namespace Pandora_Modules { * freememory in the system */ MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of * freememory in the system */ - MODULE_ODBC, /**< The module performs a SQL query via ODBC */ MODULE_LOGEVENT, /**< The module checks for log events */ MODULE_WMIQUERY, /**< The module runs WQL queries */ MODULE_PERFCOUNTER, /**< The module reads performance counters */ @@ -123,7 +122,6 @@ namespace Pandora_Modules { const string module_freememory_percent_str = "module_freememory_percent"; const string module_cpuusage_str = "module_cpuusage"; const string module_inventory_str = "module_inventory"; - const string module_odbc_str = "module_odbc"; const string module_logevent_str = "module_logevent"; const string module_wmiquery_str = "module_wmiquery"; const string module_perfcounter_str = "module_perfcounter"; diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc index 94a3d99a34..1c8f604579 100644 --- a/pandora_agents/win32/modules/pandora_module_factory.cc +++ b/pandora_agents/win32/modules/pandora_module_factory.cc @@ -30,7 +30,6 @@ #include "pandora_module_freememory_percent.h" #include "pandora_module_cpuusage.h" #include "pandora_module_inventory.h" -#include "pandora_module_odbc.h" #include "pandora_module_logevent.h" #include "pandora_module_wmiquery.h" #include "pandora_module_perfcounter.h" @@ -58,7 +57,6 @@ using namespace Pandora_Strutils; #define TOKEN_FREEMEMORY_PERCENT ("module_freepercentmemory") #define TOKEN_CPUUSAGE ("module_cpuusage ") #define TOKEN_INVENTORY ("module_inventory") -#define TOKEN_ODBC ("module_odbc ") #define TOKEN_MAX ("module_max ") #define TOKEN_MIN ("module_min ") #define TOKEN_POST_PROCESS ("module_postprocess ") @@ -69,7 +67,6 @@ using namespace Pandora_Strutils; #define TOKEN_DISABLED ("module_disabled ") #define TOKEN_MIN_FF_EVENT ("module_min_ff_event ") #define TOKEN_DESCRIPTION ("module_description ") -#define TOKEN_ODBC_QUERY ("module_odbc_query ") #define TOKEN_LOGEVENT ("module_logevent") #define TOKEN_SOURCE ("module_source ") #define TOKEN_EVENTTYPE ("module_eventtype ") @@ -153,9 +150,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { string module_name, module_type, module_exec; string module_min, module_max, module_description; string module_interval, module_proc, module_service; - string module_freedisk, module_cpuusage, module_inventory, module_odbc; + string module_freedisk, module_cpuusage, module_inventory; string module_freedisk_percent, module_freememory_percent; - string module_odbc_query, module_dsn, module_freememory; + string module_dsn, module_freememory; string module_logevent, module_source, module_eventtype, module_eventcode; string module_pattern, module_application, module_async; string module_watchdog, module_start_command; @@ -193,8 +190,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_exec = ""; module_proc = ""; module_service = ""; - module_odbc = ""; - module_odbc_query = ""; module_logevent = ""; module_source = ""; module_eventtype = ""; @@ -308,9 +303,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_inventory == "") { module_inventory = parseLine (line, TOKEN_INVENTORY); } - if (module_odbc == "") { - module_odbc = parseLine (line, TOKEN_ODBC); - } if (module_max == "") { module_max = parseLine (line, TOKEN_MAX); } @@ -341,9 +333,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_description == "") { module_description = parseLine (line, TOKEN_DESCRIPTION); } - if (module_odbc_query == "") { - module_odbc_query = parseLine (line, TOKEN_ODBC_QUERY); - } if (module_logevent == "") { module_logevent = parseLine (line, TOKEN_LOGEVENT); } @@ -641,13 +630,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } } - if (module_odbc != "") { - pos_macro = module_odbc.find(macro_name); - if (pos_macro != string::npos){ - module_odbc.replace(pos_macro, macro_name.size(), macro_value); - } - } - if (module_max != "") { pos_macro = module_max.find(macro_name); if (pos_macro != string::npos){ @@ -718,13 +700,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } } - if (module_odbc_query != "") { - pos_macro = module_odbc_query.find(macro_name); - if (pos_macro != string::npos){ - module_odbc_query.replace(pos_macro, macro_name.size(), macro_value); - } - } - if (module_logevent != "") { pos_macro = module_logevent.find(macro_name); if (pos_macro != string::npos){ @@ -1150,8 +1125,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } else if (module_inventory != "") { module = new Pandora_Module_Inventory (module_name, module_inventory); - } else if (module_odbc != "") { - module = new Pandora_Module_Odbc (module_name, module_odbc, module_odbc_query); } else if (module_logevent != "") { module = new Pandora_Module_Logevent (module_name, module_source, diff --git a/pandora_agents/win32/modules/pandora_module_list.cc b/pandora_agents/win32/modules/pandora_module_list.cc index e4ccaddf22..797bfbcf82 100644 --- a/pandora_agents/win32/modules/pandora_module_list.cc +++ b/pandora_agents/win32/modules/pandora_module_list.cc @@ -29,7 +29,6 @@ #include "pandora_module_freememory_percent.h" #include "pandora_module_cpuusage.h" #include "pandora_module_inventory.h" -#include "pandora_module_odbc.h" #include "pandora_module_logevent.h" #include "pandora_module_wmiquery.h" #include "pandora_module_perfcounter.h" @@ -226,7 +225,6 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) Pandora_Module_Inventory *module_inventory; Pandora_Module_Freememory *module_freememory; Pandora_Module_Freememory_Percent *module_freememory_percent; - Pandora_Module_Odbc *module_odbc; Pandora_Module_Logevent *module_logevent; Pandora_Module_WMIQuery *module_wmiquery; Pandora_Module_Perfcounter *module_perfcounter; @@ -286,10 +284,6 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) module_inventory = (Pandora_Module_Inventory *) module; modules->push_back (module_inventory); break; - case MODULE_ODBC: - module_odbc = (Pandora_Module_Odbc *) module; - modules->push_back (module_odbc); - break; case MODULE_LOGEVENT: module_logevent = (Pandora_Module_Logevent *) module; modules->push_back (module_logevent); diff --git a/pandora_agents/win32/modules/pandora_module_odbc.cc b/pandora_agents/win32/modules/pandora_module_odbc.cc deleted file mode 100755 index 12787e3819..0000000000 --- a/pandora_agents/win32/modules/pandora_module_odbc.cc +++ /dev/null @@ -1,227 +0,0 @@ -/* Pandora ODBC module. These modules check the free space in a - logical drive. - - Copyright (C) 2006 Artica ST. - Written by Esteban Sanchez. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "pandora_module_odbc.h" -#include "../pandora_strutils.h" -#include "../pandora_agent_conf.h" -#include -#include -#include -#include -#include - -using namespace Pandora; -using namespace Pandora_Modules; -using namespace Pandora_Strutils; - -/** - * Creates a Pandora_Module_Odbc object. - * - * @param name Module name - * @param dsn ODBC dsn string - * @param query SQL query to do - */ -Pandora_Module_Odbc::Pandora_Module_Odbc (string name, - string dsn, - string query) - : Pandora_Module (name) { - - Pandora_Agent_Conf *conf; - - conf = Pandora_Agent_Conf::getInstance (); - - this->setKind (module_odbc_str); - this->dsn = dsn; - this->username = conf->getValue ("odbc_" + dsn + "_username"); - this->password = conf->getValue ("odbc_" + dsn + "_password"); - this->query = query; -} - -/** - * Set DSN ODBC connection - * - * @param dsn DSN to set. - */ -void -Pandora_Module_Odbc::setDsn (string dsn) { - this->dsn = dsn; -} - -/** - * Set ODBC username. - * - * @param username Username to set. - */ -void -Pandora_Module_Odbc::setUsername (string username) { - this->username = username; -} - -/** - * Set ODBC password. - * - * @param password Password to set. - */ -void -Pandora_Module_Odbc::setPassword (string password) { - this->password = password; -} - -/** - * Set module SQL query to ODBC connection - * - * @param query SQL query to launch. - */ -void -Pandora_Module_Odbc::setQuery (string query) { - this->query = query; -} - -/** - * Get DSN ODBC string. - * - * @return DSN ODBC string. - */ -string -Pandora_Module_Odbc::getDsn () { - return this->dsn; -} - -/** - * Get ODBC password. - * - * @return Connection password - */ -string -Pandora_Module_Odbc::getPassword () { - return this->password; -} - -/** - * Get ODBC username. - * - * @return - */ -string -Pandora_Module_Odbc::getUsername () { - return this->username; -} - -/** - * Get SQL module query. - * - * @return SQL module query - */ -string -Pandora_Module_Odbc::getQuery () { - return this->query; -} - -/** - * Perform the query into the database and set the output value of the - * module. - */ -void -Pandora_Module_Odbc::doQuery () { - string retval; - auto_ptr statement; - Statement *statement_ptr; - auto_ptr results; - ResultSet *results_ptr; - ResultSetMetaData *metadata; - int columns; - - statement_ptr = this->con->createStatement (); - if (statement_ptr == NULL) { - return; - } - statement = auto_ptr (statement_ptr); - - results_ptr = statement->executeQuery (query); - if (results_ptr == NULL) { - return; - } - results = auto_ptr (results_ptr); - metadata = results->getMetaData (); - if (metadata == NULL) { - return; - } - - columns = metadata->getColumnCount (); - - if (results->next ()) { - if (this->getTypeInt () == TYPE_GENERIC_DATA_STRING) { - string output; - for (int i = 1; i <= columns; i++) { - output += results->getString (i); - if (i + 1 <= columns) - output += " | "; - } - - this->setOutput (output); - } else { - this->setOutput (longtostr (results->getLong (1))); - } - } -} - -void -Pandora_Module_Odbc::run () { - try { - Pandora_Module::run (); - } catch (Interval_Not_Fulfilled e) { - return; - } - - if (this->query == "") { - pandoraLog ("Error on module ODBC '%s': No query to execute", - this->module_name.c_str ()); - return; - } - - if (this->dsn == "") { - pandoraLog ("Error on module ODBC '%s': No DSN to connect to", - this->module_name.c_str ()); - return; - } - - if (this->username == "") { - pandoraLog ("Error on module ODBC '%s': No username to connect to DSN %s. " - "Add odbc_%s_username parameter to configuration file", - this->module_name.c_str (), this->dsn.c_str (), this->dsn.c_str ()); - return; - } - - try { - pandoraLog ("Module ODBC connecting to dsn=%s, uid=%s, pwd=****", - this->dsn.c_str (), this->username.c_str ()); - this->con = DriverManager::getConnection (this->dsn, this->username, this->password); - - this->doQuery (); - delete this->con; - DriverManager::shutdown(); - } catch (SQLException &e) { - pandoraLog ("Error on module ODBC '%s': %s", this->module_name.c_str (), e.getMessage().c_str ()); - this->has_output = false; - } catch (Pandora_Exception e) { - this->has_output = false; - } -} diff --git a/pandora_agents/win32/modules/pandora_module_odbc.h b/pandora_agents/win32/modules/pandora_module_odbc.h deleted file mode 100755 index 3855b1a498..0000000000 --- a/pandora_agents/win32/modules/pandora_module_odbc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Pandora ODBC module. These modules check the free space in a - logical drive. - - Copyright (C) 2006 Artica ST. - Written by Esteban Sanchez. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef __PANDORA_MODULE_ODBC_H__ -#define __PANDORA_MODULE_ODBC_H__ - -#include "pandora_module.h" -#include -#include - -using namespace odbc; - -namespace Pandora_Modules { - /** - * Module to retrieve a value based on a SQL query to an ODBC - * connection. - */ - class Pandora_Module_Odbc : public Pandora_Module { - private: - string dsn; - string username; - string password; - string query; - Connection *con; - - void doQuery (); - public: - Pandora_Module_Odbc (string name, - string dsn, - string query); - - void setDsn (string dsn); - void setUsername (string username); - void setPassword (string password); - void setQuery (string query); - - string getDsn (); - string getPassword (); - string getUsername (); - string getQuery (); - - void run (); - }; -} - -#endif