add ff_type Windows agent

Former-commit-id: d167449fe305d6a013eb2b2e22ec48a58af1e346
This commit is contained in:
Daniel Barbero Martin 2019-04-01 12:52:09 +02:00
parent 5ca01b0294
commit be0f96b5f0
3 changed files with 38 additions and 1 deletions

View File

@ -78,6 +78,7 @@ Pandora_Module::Pandora_Module (string name) {
this->warning_inverse = "";
this->quiet = "";
this->module_ff_interval = "";
this->module_ff_type = "";
this->module_alert_template = "";
this->module_crontab = "";
}
@ -734,6 +735,13 @@ Pandora_Module::getXml () {
module_xml += "</module_ff_interval>\n";
}
/* Module FF type */
if (this->module_ff_type != "") {
module_xml += "\t<ff_type>";
module_xml += this->module_ff_type;
module_xml += "</ff_type>\n";
}
/* Module Alert template */
if (this->module_alert_template != "") {
module_xml += "\t<alert_template>";
@ -1028,6 +1036,16 @@ Pandora_Module::setModuleFFInterval (string value) {
this->module_ff_interval = value;
}
/**
* Set the module FF type for the module.
*
* @param value module FF type value to set.
*/
void
Pandora_Module::setModuleFFType (string value) {
this->module_ff_type = value;
}
/**
* Set the module Alert template for the module.
*

View File

@ -176,6 +176,7 @@ namespace Pandora_Modules {
string unit, custom_id, str_warning, str_critical;
string module_group, warning_inverse, critical_inverse, quiet;
string module_ff_interval, module_alert_template, module_crontab;
string module_ff_type;
string critical_instructions, warning_instructions, unknown_instructions, tags;
protected:
@ -277,6 +278,7 @@ namespace Pandora_Modules {
void setWarningInverse (string value);
void setQuiet (string value);
void setModuleFFInterval (string value);
void setModuleFFType (string value);
void setModuleAlertTemplate (string value);
void setModuleCrontab (string value);

View File

@ -119,6 +119,7 @@ using namespace Pandora_Strutils;
#define TOKEN_WARNING_INVERSE ("module_warning_inverse ")
#define TOKEN_QUIET ("module_quiet ")
#define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ")
#define TOKEN_MODULE_FF_TYPE ("module_ff_type ")
#define TOKEN_MACRO ("module_macro")
#define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
@ -176,7 +177,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical;
string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags;
string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval;
string module_native_encoding, module_alert_template;
string module_native_encoding, module_alert_template, module_ff_type;
string macro;
Pandora_Module *module;
bool numeric;
@ -254,6 +255,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_warning_inverse = "";
module_quiet = "";
module_ff_interval = "";
module_ff_type = "";
module_native_encoding = "";
module_alert_template = "";
module_user_session = "";
@ -508,6 +510,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL);
}
if (module_ff_type == "") {
module_ff_type = parseLine (line, TOKEN_MODULE_FF_TYPE);
}
if (module_alert_template == "") {
module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE);
module_alert_template.erase (0,1);
@ -1087,6 +1093,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
}
}
if (module_ff_type != "") {
pos_macro = module_ff_type.find(macro_name);
if (pos_macro != string::npos){
module_ff_type.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_alert_template != "") {
pos_macro = module_alert_template.find(macro_name);
if (pos_macro != string::npos){
@ -1448,6 +1461,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module->setModuleFFInterval (module_ff_interval);
}
if (module_ff_type != "") {
module->setModuleFFType (module_ff_type);
}
if (module_alert_template != "") {
module->setModuleAlertTemplate (module_alert_template);
}