2009-09-11 Ramon Novoa <rnovoa@artica.es>
* modules/pandora_module_inventory.h, modules/pandora_module_inventory.cc, modules/pandora_module_factory.cc: Fixed inventory module interval calculation. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1931 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
63179fc5c4
commit
21f0962ca0
|
@ -1,3 +1,10 @@
|
||||||
|
2009-09-11 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* modules/pandora_module_inventory.h,
|
||||||
|
modules/pandora_module_inventory.cc,
|
||||||
|
modules/pandora_module_factory.cc: Fixed inventory module interval
|
||||||
|
calculation.
|
||||||
|
|
||||||
2009-09-10 Ramon Novoa <rnovoa@artica.es>
|
2009-09-10 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* windows/pandora_wmi.cc,
|
* windows/pandora_wmi.cc,
|
||||||
|
|
|
@ -123,6 +123,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
||||||
Pandora_Module *module;
|
Pandora_Module *module;
|
||||||
bool numeric;
|
bool numeric;
|
||||||
Module_Type type;
|
Module_Type type;
|
||||||
|
long agent_interval;
|
||||||
|
|
||||||
module_name = "";
|
module_name = "";
|
||||||
module_type = "";
|
module_type = "";
|
||||||
|
@ -339,16 +340,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
||||||
|
|
||||||
} else if (module_inventory != "") {
|
} else if (module_inventory != "") {
|
||||||
module = new Pandora_Module_Inventory (module_name, module_inventory);
|
module = new Pandora_Module_Inventory (module_name, module_inventory);
|
||||||
if (module_interval != "") {
|
|
||||||
try {
|
|
||||||
// Convert the interval to seconds...
|
|
||||||
int interval = strtoint (module_interval) *60 *60 *24 ;
|
|
||||||
module->setInterval(interval);
|
|
||||||
} catch (Invalid_Conversion e) {
|
|
||||||
pandoraLog("Error in conversion of module_inventory_interval");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (module_odbc != "") {
|
} else if (module_odbc != "") {
|
||||||
module = new Pandora_Module_Odbc (module_name,
|
module = new Pandora_Module_Odbc (module_name,
|
||||||
module_odbc,
|
module_odbc,
|
||||||
|
|
|
@ -22,6 +22,7 @@ the agent is instaled.
|
||||||
#include "pandora_module_inventory.h"
|
#include "pandora_module_inventory.h"
|
||||||
#include "../windows/pandora_wmi.h"
|
#include "../windows/pandora_wmi.h"
|
||||||
#include "../windows/pandora_windows_info.h"
|
#include "../windows/pandora_windows_info.h"
|
||||||
|
#include "../pandora_windows_service.h"
|
||||||
#include "../pandora_strutils.h"
|
#include "../pandora_strutils.h"
|
||||||
|
|
||||||
using namespace Pandora;
|
using namespace Pandora;
|
||||||
|
@ -37,6 +38,7 @@ Pandora_Module_Inventory::Pandora_Module_Inventory (string name, string options)
|
||||||
: Pandora_Module (name) {
|
: Pandora_Module (name) {
|
||||||
this->setKind (module_inventory_str);
|
this->setKind (module_inventory_str);
|
||||||
this->options = options;
|
this->options = options;
|
||||||
|
this->interval_fixed = 0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Run the module and generates the output.
|
* Run the module and generates the output.
|
||||||
|
@ -52,13 +54,21 @@ Pandora_Module_Inventory::Pandora_Module_Inventory (string name, string options)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Pandora_Module_Inventory::run () {
|
Pandora_Module_Inventory::run () {
|
||||||
|
|
||||||
list<string> rows;
|
list<string> rows;
|
||||||
list<string>::iterator row;
|
list<string>::iterator row;
|
||||||
int num_results = 0;
|
int num_results = 0;
|
||||||
string res;
|
string res;
|
||||||
size_t found;
|
size_t found;
|
||||||
|
|
||||||
|
// Agent interval unknown at module creation time, module interval cannot be
|
||||||
|
// set in constructor.
|
||||||
|
if (this->interval_fixed == 0) {
|
||||||
|
int agent_interval = Pandora_Windows_Service::getInstance ()->interval;
|
||||||
|
// Module interval specified in days for inventory modules (86400 = 60 * 60 * 24)
|
||||||
|
this->setInterval (this->getInterval () * 86400 / (agent_interval / 1000));
|
||||||
|
this->interval_fixed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Until no data data is gathered there will be no output
|
// Until no data data is gathered there will be no output
|
||||||
this->has_output = false;
|
this->has_output = false;
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace Pandora_Modules {
|
||||||
class Pandora_Module_Inventory : public Pandora_Module {
|
class Pandora_Module_Inventory : public Pandora_Module {
|
||||||
private:
|
private:
|
||||||
string options;
|
string options;
|
||||||
|
unsigned char interval_fixed;
|
||||||
public:
|
public:
|
||||||
Pandora_Module_Inventory (string name, string options);
|
Pandora_Module_Inventory (string name, string options);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue