2008-12-01 Ramon Novoa <rnovoa@artica.es>
* windows/pandora_wmi.cc, windows/pandora_wmi.h, modules/pandora_module_logevent.cc, modules/pandora_module_logevent.h, modules/pandora_module_factory.cc: Added event code filtering support to logevent module. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1271 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0059aad758
commit
65ab67b296
|
@ -1,3 +1,12 @@
|
||||||
|
2008-12-01 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* windows/pandora_wmi.cc,
|
||||||
|
windows/pandora_wmi.h,
|
||||||
|
modules/pandora_module_logevent.cc,
|
||||||
|
modules/pandora_module_logevent.h,
|
||||||
|
modules/pandora_module_factory.cc: Added event code filtering
|
||||||
|
support to logevent module.
|
||||||
|
|
||||||
2008-12-01 Esteban Sanchez <estebans@artica.es>
|
2008-12-01 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* pandora_windows_service.cc: Removed debug output. Release mutex on
|
* pandora_windows_service.cc: Removed debug output. Release mutex on
|
||||||
|
|
|
@ -52,6 +52,7 @@ using namespace Pandora_Strutils;
|
||||||
#define TOKEN_LOGEVENT ("module_logevent")
|
#define TOKEN_LOGEVENT ("module_logevent")
|
||||||
#define TOKEN_SOURCE ("module_source ")
|
#define TOKEN_SOURCE ("module_source ")
|
||||||
#define TOKEN_EVENTTYPE ("module_eventtype ")
|
#define TOKEN_EVENTTYPE ("module_eventtype ")
|
||||||
|
#define TOKEN_EVENTCODE ("module_eventcode ")
|
||||||
#define TOKEN_PATTERN ("module_pattern ")
|
#define TOKEN_PATTERN ("module_pattern ")
|
||||||
#define TOKEN_ASYNC ("module_async")
|
#define TOKEN_ASYNC ("module_async")
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
||||||
string module_interval, module_proc, module_service;
|
string module_interval, module_proc, module_service;
|
||||||
string module_freedisk, module_cpuusage, module_odbc;
|
string module_freedisk, module_cpuusage, module_odbc;
|
||||||
string module_odbc_query, module_dsn, module_freememory;
|
string module_odbc_query, module_dsn, module_freememory;
|
||||||
string module_logevent, module_source, module_eventtype;
|
string module_logevent, module_source, module_eventtype, module_eventcode;
|
||||||
string module_pattern, module_async;
|
string module_pattern, module_async;
|
||||||
Pandora_Module *module;
|
Pandora_Module *module;
|
||||||
bool numeric;
|
bool numeric;
|
||||||
|
@ -109,6 +110,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
||||||
module_logevent = "";
|
module_logevent = "";
|
||||||
module_source = "";
|
module_source = "";
|
||||||
module_eventtype = "";
|
module_eventtype = "";
|
||||||
|
module_eventcode = "";
|
||||||
module_pattern = "";
|
module_pattern = "";
|
||||||
|
|
||||||
stringtok (tokens, definition, "\n");
|
stringtok (tokens, definition, "\n");
|
||||||
|
@ -171,6 +173,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
||||||
if (module_eventtype == "") {
|
if (module_eventtype == "") {
|
||||||
module_eventtype = parseLine (line, TOKEN_EVENTTYPE);
|
module_eventtype = parseLine (line, TOKEN_EVENTTYPE);
|
||||||
}
|
}
|
||||||
|
if (module_eventcode == "") {
|
||||||
|
module_eventcode = parseLine (line, TOKEN_EVENTCODE);
|
||||||
|
}
|
||||||
if (module_pattern == "") {
|
if (module_pattern == "") {
|
||||||
module_pattern = parseLine (line, TOKEN_PATTERN);
|
module_pattern = parseLine (line, TOKEN_PATTERN);
|
||||||
}
|
}
|
||||||
|
@ -218,6 +223,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
||||||
module = new Pandora_Module_Logevent (module_name,
|
module = new Pandora_Module_Logevent (module_name,
|
||||||
module_source,
|
module_source,
|
||||||
module_eventtype,
|
module_eventtype,
|
||||||
|
module_eventcode,
|
||||||
module_pattern);
|
module_pattern);
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -32,11 +32,12 @@ using namespace Pandora_Modules;
|
||||||
* @param name Module name.
|
* @param name Module name.
|
||||||
* @param service_name Service internal name to check.
|
* @param service_name Service internal name to check.
|
||||||
*/
|
*/
|
||||||
Pandora_Module_Logevent::Pandora_Module_Logevent (string name, string source, string type, string pattern)
|
Pandora_Module_Logevent::Pandora_Module_Logevent (string name, string source, string type, string code, string pattern)
|
||||||
: Pandora_Module (name) {
|
: Pandora_Module (name) {
|
||||||
|
|
||||||
this->source = source;
|
this->source = source;
|
||||||
this->type = type;
|
this->type = type;
|
||||||
|
this->code = code;
|
||||||
this->pattern = pattern;
|
this->pattern = pattern;
|
||||||
this->setKind (module_logevent_str);
|
this->setKind (module_logevent_str);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ Pandora_Module_Logevent::run () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pandora_Wmi::getEventList (this->source, this->type, this->pattern, interval, event_list);
|
Pandora_Wmi::getEventList (this->source, this->type, this->code, this->pattern, interval, event_list);
|
||||||
|
|
||||||
// No data
|
// No data
|
||||||
if (event_list.size () < 1) {
|
if (event_list.size () < 1) {
|
||||||
|
|
|
@ -35,9 +35,10 @@ namespace Pandora_Modules {
|
||||||
private:
|
private:
|
||||||
string source;
|
string source;
|
||||||
string type;
|
string type;
|
||||||
|
string code;
|
||||||
string pattern;
|
string pattern;
|
||||||
public:
|
public:
|
||||||
Pandora_Module_Logevent (string name, string source, string type, string pattern);
|
Pandora_Module_Logevent (string name, string source, string type, string code, string pattern);
|
||||||
void run ();
|
void run ();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,7 +388,7 @@ Pandora_Wmi::getSystemName () {
|
||||||
* @return The list of events.
|
* @return The list of events.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Pandora_Wmi::getEventList (string source, string type, string pattern, int interval, list<string> &event_list) {
|
Pandora_Wmi::getEventList (string source, string type, string code, string pattern, int interval, list<string> &event_list) {
|
||||||
CDhInitialize init;
|
CDhInitialize init;
|
||||||
CDispPtr wmi_svc, quickfixes;
|
CDispPtr wmi_svc, quickfixes;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
@ -410,7 +410,10 @@ Pandora_Wmi::getEventList (string source, string type, string pattern, int inter
|
||||||
if (! type.empty()) {
|
if (! type.empty()) {
|
||||||
query += " AND Type = '" + type + "'";
|
query += " AND Type = '" + type + "'";
|
||||||
}
|
}
|
||||||
|
if (! code.empty()) {
|
||||||
|
query += " AND EventCode = '" + code + "'";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
|
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
|
||||||
dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc,
|
dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc,
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Pandora_Wmi {
|
||||||
string getOSVersion ();
|
string getOSVersion ();
|
||||||
string getOSBuild ();
|
string getOSBuild ();
|
||||||
string getSystemName ();
|
string getSystemName ();
|
||||||
void getEventList (string source, string type, string pattern, int interval, list<string> &event_list);
|
void getEventList (string source, string type, string code, string pattern, int interval, list<string> &event_list);
|
||||||
string getTimestampLimit (int interval);
|
string getTimestampLimit (int interval);
|
||||||
void convertWMIDate (string wmi_date, SYSTEMTIME *system_time);
|
void convertWMIDate (string wmi_date, SYSTEMTIME *system_time);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue