2006-06-20 19:05:19 +02:00
|
|
|
/* Defines a parent class for a Pandora module.
|
|
|
|
|
|
|
|
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.h"
|
|
|
|
#include "../pandora_strutils.h"
|
2006-07-04 16:07:08 +02:00
|
|
|
#include "../pandora.h"
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2010-09-20 17:03:06 +02:00
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
|
2011-06-21 13:06:47 +02:00
|
|
|
#define BUFSIZE 4096
|
|
|
|
|
2006-07-04 16:07:08 +02:00
|
|
|
using namespace Pandora;
|
2006-06-20 19:05:19 +02:00
|
|
|
using namespace Pandora_Modules;
|
2006-07-04 16:07:08 +02:00
|
|
|
using namespace Pandora_Strutils;
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Creates a Pandora_Module.
|
|
|
|
*
|
|
|
|
* Initializes all attributes. The default interval is set to 1 loop.
|
|
|
|
*
|
|
|
|
* @param name Module name.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
Pandora_Module::Pandora_Module (string name) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->module_name = name;
|
|
|
|
this->executions = 0;
|
|
|
|
this->module_interval = 1;
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
this->module_timeout = 15000;
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->max = 0;
|
|
|
|
this->min = 0;
|
2011-03-01 15:45:32 +01:00
|
|
|
this->post_process = "";
|
2008-12-16 12:30:12 +01:00
|
|
|
this->has_limits = false;
|
2011-03-01 15:45:32 +01:00
|
|
|
this->has_min = false;
|
|
|
|
this->has_max = false;
|
2008-11-28 11:51:03 +01:00
|
|
|
this->async = false;
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->data_list = NULL;
|
2009-09-02 13:39:53 +02:00
|
|
|
this->inventory_list = NULL;
|
2011-06-21 13:06:47 +02:00
|
|
|
this->precondition_list = NULL;
|
2010-07-02 16:25:53 +02:00
|
|
|
this->condition_list = NULL;
|
2010-07-12 18:31:07 +02:00
|
|
|
this->cron = NULL;
|
2011-07-14 18:45:12 +02:00
|
|
|
this->min_critical = "";
|
|
|
|
this->max_critical = "";
|
|
|
|
this->min_warning = "";
|
|
|
|
this->max_warning = "";
|
|
|
|
this->disabled = "";
|
|
|
|
this->min_ff_event = "";
|
2012-01-03 18:23:23 +01:00
|
|
|
this->intensive_condition_list = NULL;
|
|
|
|
this->intensive_interval = 1;
|
|
|
|
this->timestamp = 0;
|
|
|
|
this->intensive_match = 0;
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Virtual destructor of Pandora_Module.
|
|
|
|
*
|
|
|
|
* Should be redefined by child classes.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
Pandora_Module::~Pandora_Module () {
|
2010-07-02 16:25:53 +02:00
|
|
|
Condition *cond = NULL;
|
2012-01-03 18:23:23 +01:00
|
|
|
Condition *precond = NULL;
|
2010-07-02 16:25:53 +02:00
|
|
|
list<Condition *>::iterator iter;
|
2012-01-03 18:23:23 +01:00
|
|
|
list<Condition *>::iterator iter_pre;
|
2010-07-02 16:25:53 +02:00
|
|
|
|
|
|
|
/* Clean data lists */
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
this->cleanDataList ();
|
2010-07-02 16:25:53 +02:00
|
|
|
|
2011-06-21 13:06:47 +02:00
|
|
|
/* Clean precondition list */
|
|
|
|
if (this->precondition_list != NULL && this->precondition_list->size () > 0) {
|
|
|
|
iter_pre = this->precondition_list->begin ();
|
|
|
|
for (iter_pre = this->precondition_list->begin ();
|
|
|
|
iter_pre != this->precondition_list->end ();
|
2011-12-14 11:38:53 +01:00
|
|
|
iter_pre++) {
|
2011-06-21 13:06:47 +02:00
|
|
|
/* Free regular expressions */
|
|
|
|
precond = *iter_pre;
|
|
|
|
if (precond->string_value != "") {
|
|
|
|
regfree (&(precond->regexp));
|
|
|
|
}
|
|
|
|
delete (*iter_pre);
|
|
|
|
}
|
|
|
|
delete (this->precondition_list);
|
2011-12-14 11:38:53 +01:00
|
|
|
this->precondition_list = NULL;
|
2011-06-21 13:06:47 +02:00
|
|
|
}
|
|
|
|
|
2010-07-02 16:25:53 +02:00
|
|
|
/* Clean condition list */
|
|
|
|
if (this->condition_list != NULL && this->condition_list->size () > 0) {
|
|
|
|
iter = this->condition_list->begin ();
|
|
|
|
for (iter = this->condition_list->begin ();
|
|
|
|
iter != this->condition_list->end ();
|
|
|
|
iter++) {
|
|
|
|
/* Free regular expressions */
|
|
|
|
cond = *iter;
|
|
|
|
if (cond->string_value != "") {
|
|
|
|
regfree (&(cond->regexp));
|
|
|
|
}
|
|
|
|
delete (*iter);
|
|
|
|
}
|
|
|
|
delete (this->condition_list);
|
2011-12-14 11:38:53 +01:00
|
|
|
this->condition_list = NULL;
|
2010-07-02 16:25:53 +02:00
|
|
|
}
|
2012-01-03 18:23:23 +01:00
|
|
|
|
|
|
|
/* Clean intensive_condition list */
|
|
|
|
if (this->intensive_condition_list != NULL && this->intensive_condition_list->size () > 0) {
|
|
|
|
iter = this->intensive_condition_list->begin ();
|
|
|
|
for (iter = this->intensive_condition_list->begin ();
|
|
|
|
iter != this->intensive_condition_list->end ();
|
|
|
|
iter++) {
|
|
|
|
/* Free regular expressions */
|
|
|
|
cond = *iter;
|
|
|
|
if (cond->string_value != "") {
|
|
|
|
regfree (&(cond->regexp));
|
|
|
|
}
|
|
|
|
delete (*iter);
|
|
|
|
}
|
|
|
|
delete (this->intensive_condition_list);
|
|
|
|
this->intensive_condition_list = NULL;
|
|
|
|
}
|
2010-07-12 18:31:07 +02:00
|
|
|
|
|
|
|
/* Clean the module cron */
|
|
|
|
if (this->cron != NULL) {
|
|
|
|
delete (this->cron);
|
2011-12-14 11:38:53 +01:00
|
|
|
this->cron = NULL;
|
2010-07-12 18:31:07 +02:00
|
|
|
}
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
Pandora_Module::cleanDataList () {
|
|
|
|
Pandora_Data *data;
|
|
|
|
list<Pandora_Data *>::iterator iter;
|
|
|
|
|
|
|
|
if (this->data_list) {
|
|
|
|
if (this->data_list->size () > 0) {
|
|
|
|
iter = this->data_list->begin ();
|
|
|
|
for (iter = this->data_list->begin ();
|
|
|
|
iter != this->data_list->end ();
|
|
|
|
iter++) {
|
|
|
|
data = *iter;
|
|
|
|
delete data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete this->data_list;
|
|
|
|
this->data_list = NULL;
|
|
|
|
}
|
2009-09-02 13:39:53 +02:00
|
|
|
if (this->inventory_list) {
|
|
|
|
if (this->inventory_list->size () > 0) {
|
|
|
|
iter = this->inventory_list->begin ();
|
|
|
|
for (iter = this->inventory_list->begin ();
|
|
|
|
iter != this->inventory_list->end ();
|
|
|
|
iter++) {
|
|
|
|
data = *iter;
|
|
|
|
delete data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete this->inventory_list;
|
|
|
|
this->inventory_list = NULL;
|
|
|
|
}
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Get the Module_Type from a string type.
|
|
|
|
*
|
|
|
|
* @param type String type.
|
|
|
|
*
|
|
|
|
* @return The Module_Type which represents the type.
|
|
|
|
*/
|
|
|
|
Module_Type
|
|
|
|
Pandora_Module::parseModuleTypeFromString (string type) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
if (type == module_generic_data_str) {
|
|
|
|
return TYPE_GENERIC_DATA;
|
|
|
|
} else if (type == module_generic_data_inc_str) {
|
|
|
|
return TYPE_GENERIC_DATA_INC;
|
|
|
|
} else if (type == module_generic_data_string_str) {
|
|
|
|
return TYPE_GENERIC_DATA_STRING;
|
|
|
|
} else if (type == module_generic_proc_str) {
|
|
|
|
return TYPE_GENERIC_PROC;
|
2009-01-26 12:48:35 +01:00
|
|
|
} else if (type == module_async_data_str) {
|
|
|
|
return TYPE_ASYNC_DATA;
|
|
|
|
} else if (type == module_async_proc_str) {
|
|
|
|
return TYPE_ASYNC_PROC;
|
|
|
|
} else if (type == module_async_string_str) {
|
|
|
|
return TYPE_ASYNC_STRING;
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
} else {
|
|
|
|
return TYPE_0;
|
|
|
|
}
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Get the Module_Kind from a string Kind.
|
|
|
|
*
|
|
|
|
* @param kind String Kind.
|
|
|
|
*
|
|
|
|
* @return The Module_Kind which represents the Kind.
|
|
|
|
*/
|
|
|
|
Module_Kind
|
|
|
|
Pandora_Module::parseModuleKindFromString (string kind) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
if (kind == module_exec_str) {
|
|
|
|
return MODULE_EXEC;
|
|
|
|
} else if (kind == module_proc_str) {
|
|
|
|
return MODULE_PROC;
|
|
|
|
} else if (kind == module_service_str) {
|
|
|
|
return MODULE_SERVICE;
|
|
|
|
} else if (kind == module_freedisk_str) {
|
|
|
|
return MODULE_FREEDISK;
|
2009-05-25 Ramon Novoa <rnovoa@artica.es>
* windows/pandora_wmi.cc, windows/pandora_wmi.h: Added functions for the
new modules. Removed old logevent functions.
* pandora_windows_service.h, pandora_windows_service.cc: Added support
for data file buffering and startup delay.
* modules/pandora_module_logevent.cc, modules/pandora_module_logevent.h:
Rewritten to retrieve event log data using the PDH interface instead
of WMI (was too slow).
* modules/pandora_module_tcpcheck.cc, modules/pandora_module_tcpcheck.h,
modules/pandora_module_regexp.cc, modules/pandora_module_regexp.h,
modules/pandora_module_perfcounter.cc,
modules/pandora_module_perfcounter.h,
modules/pandora_module_freedisk_percent.cc,
modules/pandora_module_freedisk_percent.h,
modules/pandora_module_freememory_percent.cc,
modules/pandora_module_freememory_percent.h: Added to repository.
New modules, see http://openideas.info/wiki/.
* modules/pandora_module.h, modules/pandora_module.cc,
modules/pandora_module_factory.cc, modules/pandora_module_list.cc:
Added support for the new modules.
* bin/pandora_agent.conf: Included configuration examples for the new
modules.
* PandoraAgent.dev: Updated to compile the new modules.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1707 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-05-25 19:50:27 +02:00
|
|
|
} else if (kind == module_freedisk_percent_str) {
|
|
|
|
return MODULE_FREEDISK_PERCENT;
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
} else if (kind == module_freememory_str) {
|
|
|
|
return MODULE_FREEMEMORY;
|
2009-05-25 Ramon Novoa <rnovoa@artica.es>
* windows/pandora_wmi.cc, windows/pandora_wmi.h: Added functions for the
new modules. Removed old logevent functions.
* pandora_windows_service.h, pandora_windows_service.cc: Added support
for data file buffering and startup delay.
* modules/pandora_module_logevent.cc, modules/pandora_module_logevent.h:
Rewritten to retrieve event log data using the PDH interface instead
of WMI (was too slow).
* modules/pandora_module_tcpcheck.cc, modules/pandora_module_tcpcheck.h,
modules/pandora_module_regexp.cc, modules/pandora_module_regexp.h,
modules/pandora_module_perfcounter.cc,
modules/pandora_module_perfcounter.h,
modules/pandora_module_freedisk_percent.cc,
modules/pandora_module_freedisk_percent.h,
modules/pandora_module_freememory_percent.cc,
modules/pandora_module_freememory_percent.h: Added to repository.
New modules, see http://openideas.info/wiki/.
* modules/pandora_module.h, modules/pandora_module.cc,
modules/pandora_module_factory.cc, modules/pandora_module_list.cc:
Added support for the new modules.
* bin/pandora_agent.conf: Included configuration examples for the new
modules.
* PandoraAgent.dev: Updated to compile the new modules.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1707 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-05-25 19:50:27 +02:00
|
|
|
} else if (kind == module_freememory_percent_str) {
|
|
|
|
return MODULE_FREEMEMORY_PERCENT;
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
} else if (kind == module_cpuusage_str) {
|
|
|
|
return MODULE_CPUUSAGE;
|
2009-09-02 13:39:53 +02:00
|
|
|
} else if (kind == module_inventory_str) {
|
|
|
|
return MODULE_INVENTORY;
|
2008-04-02 18:01:35 +02:00
|
|
|
} else if (kind == module_odbc_str) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
return MODULE_ODBC;
|
|
|
|
} else if (kind == module_logevent_str) {
|
2008-12-16 12:30:12 +01:00
|
|
|
return MODULE_LOGEVENT;
|
|
|
|
} else if (kind == module_wmiquery_str) {
|
|
|
|
return MODULE_WMIQUERY;
|
2009-05-25 Ramon Novoa <rnovoa@artica.es>
* windows/pandora_wmi.cc, windows/pandora_wmi.h: Added functions for the
new modules. Removed old logevent functions.
* pandora_windows_service.h, pandora_windows_service.cc: Added support
for data file buffering and startup delay.
* modules/pandora_module_logevent.cc, modules/pandora_module_logevent.h:
Rewritten to retrieve event log data using the PDH interface instead
of WMI (was too slow).
* modules/pandora_module_tcpcheck.cc, modules/pandora_module_tcpcheck.h,
modules/pandora_module_regexp.cc, modules/pandora_module_regexp.h,
modules/pandora_module_perfcounter.cc,
modules/pandora_module_perfcounter.h,
modules/pandora_module_freedisk_percent.cc,
modules/pandora_module_freedisk_percent.h,
modules/pandora_module_freememory_percent.cc,
modules/pandora_module_freememory_percent.h: Added to repository.
New modules, see http://openideas.info/wiki/.
* modules/pandora_module.h, modules/pandora_module.cc,
modules/pandora_module_factory.cc, modules/pandora_module_list.cc:
Added support for the new modules.
* bin/pandora_agent.conf: Included configuration examples for the new
modules.
* PandoraAgent.dev: Updated to compile the new modules.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1707 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-05-25 19:50:27 +02:00
|
|
|
} else if (kind == module_perfcounter_str) {
|
|
|
|
return MODULE_PERFCOUNTER;
|
|
|
|
} else if (kind == module_tcpcheck_str) {
|
|
|
|
return MODULE_TCPCHECK;
|
|
|
|
} else if (kind == module_regexp_str) {
|
|
|
|
return MODULE_REGEXP;
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
} else if (kind == module_plugin_str) {
|
|
|
|
return MODULE_PLUGIN;
|
2011-11-29 14:19:34 +01:00
|
|
|
} else if (kind == module_ping_str) {
|
|
|
|
return MODULE_PING;
|
|
|
|
} else if (kind == module_snmpget_str) {
|
|
|
|
return MODULE_SNMPGET;
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
} else {
|
|
|
|
return MODULE_0;
|
|
|
|
}
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the name of the module.
|
|
|
|
*
|
|
|
|
* @return The name of the module.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
string
|
|
|
|
Pandora_Module::getName () const {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
return this->module_name;
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Get the description of the module.
|
|
|
|
*
|
|
|
|
* @return The module description.
|
|
|
|
*/
|
|
|
|
string
|
|
|
|
Pandora_Module::getDescription () const {
|
|
|
|
return this->module_description;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the module type in a human readable string.
|
|
|
|
*
|
|
|
|
* @return The module type..
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
string
|
|
|
|
Pandora_Module::getTypeString () const {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
return this->module_type_str;
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Get the module type in a integer value.
|
|
|
|
*
|
|
|
|
* @return The module type in a integer value.
|
|
|
|
*/
|
|
|
|
Module_Type
|
2006-06-20 19:05:19 +02:00
|
|
|
Pandora_Module::getTypeInt () const {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
return this->module_type;
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Get the kind of the module in a integer_value.
|
|
|
|
*
|
|
|
|
* @return The module kind in a integer value.
|
|
|
|
*/
|
|
|
|
Module_Kind
|
2006-06-20 19:05:19 +02:00
|
|
|
Pandora_Module::getModuleKind () const {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
return this->module_kind;
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
2008-12-16 12:30:12 +01:00
|
|
|
|
2008-11-28 11:51:03 +01:00
|
|
|
/**
|
|
|
|
* Get the output of the module.
|
|
|
|
*
|
|
|
|
* @return The module output in a string value.
|
|
|
|
*/
|
|
|
|
string
|
2008-12-16 12:30:12 +01:00
|
|
|
Pandora_Module::getLatestOutput () const {
|
2008-12-01 14:40:19 +01:00
|
|
|
return this->latest_output;
|
2008-12-16 12:30:12 +01:00
|
|
|
}
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Get the type of the module in a integer_value.
|
|
|
|
*
|
|
|
|
* @return The module type in a integer value.
|
|
|
|
*/
|
|
|
|
Module_Type
|
|
|
|
Pandora_Module::getModuleType () const {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
return this->module_type;
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the module output.
|
|
|
|
*
|
|
|
|
* After running the module, this function will return the output,
|
|
|
|
* based on the module_type and the interval.
|
|
|
|
*
|
|
|
|
* @return The output in a string.
|
|
|
|
*
|
|
|
|
* @exception Output_Error Throwed if the module_type is not correct.
|
|
|
|
* @exception Value_Error Throwed when the output is not in
|
|
|
|
* the interval range.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
string
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
Pandora_Module::getDataOutput (Pandora_Data *data) {
|
2008-06-11 12:10:48 +02:00
|
|
|
double value;
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
|
2009-01-26 12:48:35 +01:00
|
|
|
if (this->module_type == TYPE_GENERIC_DATA_STRING ||
|
|
|
|
this->module_type == TYPE_ASYNC_STRING) {
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
return data->getValue ();
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2008-06-11 12:10:48 +02:00
|
|
|
value = Pandora_Strutils::strtodouble (data->getValue ());
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
} catch (Pandora_Strutils::Invalid_Conversion e) {
|
|
|
|
pandoraLog ("Output error on module %s",
|
|
|
|
this->module_name.c_str ());
|
|
|
|
throw Output_Error ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->has_limits) {
|
|
|
|
if (value >= this->max || value <= this->min) {
|
|
|
|
pandoraLog ("The returned value was not in the interval on module %s",
|
|
|
|
this->module_name.c_str ());
|
|
|
|
throw Value_Error ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-28 11:51:03 +01:00
|
|
|
return trim (data->getValue ());
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2010-06-30 17:40:25 +02:00
|
|
|
/**
|
|
|
|
* Export the module output to en environment variable.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::exportDataOutput () {
|
|
|
|
Pandora_Data *pandora_data = NULL;
|
|
|
|
string putenv_str, module_data;
|
|
|
|
|
|
|
|
/* putenv expects a string of the form name=value */
|
|
|
|
putenv_str = this->save + "=";
|
|
|
|
|
|
|
|
/* No data */
|
|
|
|
if ( (!this->has_output) || this->data_list == NULL) {
|
|
|
|
putenv (putenv_str.c_str ());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the module data */
|
|
|
|
pandora_data = data_list->front ();
|
|
|
|
if (pandora_data == NULL) {
|
|
|
|
putenv (putenv_str.c_str ());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
module_data = pandora_data->getValue ();
|
|
|
|
putenv_str += module_data;
|
|
|
|
|
|
|
|
/* Save it as an environment variable */
|
|
|
|
putenv (putenv_str.c_str ());
|
|
|
|
}
|
|
|
|
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
/**
|
|
|
|
* Set the output of the module.
|
|
|
|
*
|
|
|
|
* If the function is called more than once before calling getXML, the
|
|
|
|
* output will be accumulated and added to a <datalist> tag.
|
|
|
|
*
|
|
|
|
* @param output Output to add.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setOutput (string output) {
|
|
|
|
Pandora_Data *data;
|
|
|
|
|
|
|
|
if (this->data_list == NULL)
|
|
|
|
this->data_list = new list<Pandora_Data *> ();
|
2009-09-02 13:39:53 +02:00
|
|
|
data = new Pandora_Data (output, this->module_name);
|
2008-12-16 12:30:12 +01:00
|
|
|
this->data_list->push_back (data);
|
2008-12-01 14:40:19 +01:00
|
|
|
this->latest_output = output;
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
}
|
|
|
|
|
2009-09-02 13:39:53 +02:00
|
|
|
|
2008-06-19 17:55:44 +02:00
|
|
|
/**
|
|
|
|
* Set the output of the module.
|
|
|
|
*
|
|
|
|
* If the function is called more than once before calling getXML, the
|
|
|
|
* output will be accumulated and added to a <datalist> tag.
|
|
|
|
*
|
|
|
|
* @param output Output to add.
|
|
|
|
* @param system_time Timestamp.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setOutput (string output, SYSTEMTIME *system_time) {
|
|
|
|
Pandora_Data *data;
|
|
|
|
|
|
|
|
if (this->data_list == NULL)
|
|
|
|
this->data_list = new list<Pandora_Data *> ();
|
2009-09-02 13:39:53 +02:00
|
|
|
data = new Pandora_Data (output, system_time, this->module_name);
|
2008-06-19 17:55:44 +02:00
|
|
|
this->data_list->push_back (data);
|
|
|
|
}
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
|
2011-12-12 18:11:06 +01:00
|
|
|
/**
|
|
|
|
* Set no output for the module.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setNoOutput () {
|
2012-01-03 18:23:23 +01:00
|
|
|
this->cleanDataList ();
|
2011-12-12 18:11:06 +01:00
|
|
|
this->has_output = false;
|
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Run the module and generates the output.
|
|
|
|
*
|
|
|
|
* It is used by the child classes to check the execution interval
|
|
|
|
* value and increment the executions variable.
|
|
|
|
*
|
|
|
|
* @exception Interval_Not_Fulfilled Throwed when the execution
|
|
|
|
* interval value indicates that the module doesn't have
|
|
|
|
* to execute.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
void
|
|
|
|
Pandora_Module::run () {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
/* Check the interval */
|
2012-01-03 18:23:23 +01:00
|
|
|
if (this->executions % this->intensive_interval != 0) {
|
|
|
|
pandoraDebug ("%s: Interval is not fulfilled", this->module_name.c_str ());
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->executions++;
|
|
|
|
has_output = false;
|
|
|
|
throw Interval_Not_Fulfilled ();
|
2009-09-02 13:39:53 +02:00
|
|
|
}
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
|
|
|
|
/* Increment the executions after check. This is done to execute the
|
|
|
|
first time */
|
|
|
|
this->executions++;
|
|
|
|
has_output = true;
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Get the XML output of the value.
|
|
|
|
*
|
|
|
|
* The output is a element of the TinyXML library. A sample output of
|
|
|
|
* a module is:
|
|
|
|
* @verbatim
|
|
|
|
<module>
|
|
|
|
<name>Conexiones abiertas</name>
|
|
|
|
<type>generic_data</type>
|
|
|
|
<data>5</data>
|
|
|
|
<description>Conexiones abiertas</description>
|
|
|
|
</module>
|
|
|
|
@endverbatim
|
|
|
|
*
|
|
|
|
* @return A pointer to the TiXmlElement if successful which has to be
|
|
|
|
* freed by the caller. NULL if the XML could not be created.
|
|
|
|
*/
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
string
|
2006-07-04 16:07:08 +02:00
|
|
|
Pandora_Module::getXml () {
|
2011-03-01 15:45:32 +01:00
|
|
|
ostringstream module_interval, min, max;
|
2010-09-20 17:03:06 +02:00
|
|
|
string module_xml, data_clean, interval_str;
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
Pandora_Data *data;
|
2006-07-04 16:07:08 +02:00
|
|
|
|
|
|
|
pandoraDebug ("%s getXML begin", module_name.c_str ());
|
|
|
|
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
/* No data */
|
2008-07-31 12:31:58 +02:00
|
|
|
if (!this->has_output || this->data_list == NULL) {
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
return "";
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
}
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
|
|
|
|
/* Compose the module XML */
|
|
|
|
module_xml = "<module>\n\t<name><![CDATA[";
|
|
|
|
module_xml += this->module_name;
|
|
|
|
module_xml += "]]></name>\n\t<type><![CDATA[";
|
|
|
|
module_xml += this->module_type_str;
|
|
|
|
module_xml += "]]></type>\n";
|
2011-03-01 15:45:32 +01:00
|
|
|
|
|
|
|
/* Description */
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
if (this->module_description != "") {
|
|
|
|
module_xml += "\t<description><![CDATA[";
|
|
|
|
module_xml += this->module_description;
|
|
|
|
module_xml += "]]></description>\n";
|
|
|
|
}
|
2011-03-01 15:45:32 +01:00
|
|
|
|
|
|
|
/* Interval */
|
2012-01-03 18:23:23 +01:00
|
|
|
module_interval << this->module_interval;
|
|
|
|
module_xml += "\t<module_interval><![CDATA[";
|
|
|
|
module_xml += module_interval.str ();
|
|
|
|
module_xml += "]]></module_interval>\n";
|
2011-03-01 15:45:32 +01:00
|
|
|
|
|
|
|
/* Min */
|
|
|
|
if (this->has_min) {
|
|
|
|
min << this->min;
|
|
|
|
module_xml += "\t<min><![CDATA[";
|
|
|
|
module_xml += min.str ();
|
|
|
|
module_xml += "]]></min>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Max */
|
|
|
|
if (this->has_max) {
|
|
|
|
max << this->max;
|
|
|
|
module_xml += "\t<max><![CDATA[";
|
|
|
|
module_xml += max.str ();
|
|
|
|
module_xml += "]]></max>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Post process */
|
|
|
|
if (this->post_process != "") {
|
|
|
|
module_xml += "\t<post_process><![CDATA[";
|
|
|
|
module_xml += this->post_process;
|
|
|
|
module_xml += "]]></post_process>\n";
|
|
|
|
}
|
2010-09-20 17:03:06 +02:00
|
|
|
|
2011-07-14 18:45:12 +02:00
|
|
|
/* Min critical */
|
|
|
|
if (this->min_critical != "") {
|
|
|
|
module_xml += "\t<min_critical><![CDATA[";
|
|
|
|
module_xml += this->min_critical;
|
|
|
|
module_xml += "]]></min_critical>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Max critical */
|
|
|
|
if (this->max_critical != "") {
|
|
|
|
module_xml += "\t<max_critical><![CDATA[";
|
|
|
|
module_xml += this->max_critical;
|
|
|
|
module_xml += "]]></max_critical>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Min warning */
|
|
|
|
if (this->min_warning != "") {
|
|
|
|
module_xml += "\t<min_warning><![CDATA[";
|
|
|
|
module_xml += this->min_warning;
|
|
|
|
module_xml += "]]></min_warning>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Max warning */
|
|
|
|
if (this->max_warning != "") {
|
|
|
|
module_xml += "\t<max_warning><![CDATA[";
|
|
|
|
module_xml += this->max_warning;
|
|
|
|
module_xml += "]]></max_warning>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disabled */
|
|
|
|
if (this->disabled != "") {
|
|
|
|
module_xml += "\t<disabled><![CDATA[";
|
|
|
|
module_xml += this->disabled;
|
|
|
|
module_xml += "]]></disabled>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Min ff event */
|
|
|
|
if (this->min_ff_event != "") {
|
|
|
|
module_xml += "\t<min_ff_event><![CDATA[";
|
|
|
|
module_xml += this->min_ff_event;
|
|
|
|
module_xml += "]]></min_ff_event>\n";
|
|
|
|
}
|
|
|
|
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
/* Write module data */
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
if (this->data_list && this->data_list->size () > 1) {
|
|
|
|
list<Pandora_Data *>::iterator iter;
|
|
|
|
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
module_xml += "\t<datalist>\n";
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
|
|
|
|
iter = this->data_list->begin ();
|
|
|
|
for (iter = this->data_list->begin ();
|
|
|
|
iter != this->data_list->end ();
|
|
|
|
iter++) {
|
|
|
|
data = *iter;
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
|
2008-07-22 12:46:29 +02:00
|
|
|
try {
|
2008-12-16 12:30:12 +01:00
|
|
|
data_clean = strreplace (this->getDataOutput (data),
|
2008-11-28 11:51:03 +01:00
|
|
|
"%", "%%" );
|
|
|
|
} catch (Output_Error e) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
module_xml += "\t\t<data>\n\t\t\t<value><![CDATA[";
|
|
|
|
module_xml += data_clean;
|
|
|
|
module_xml += "]]></value>\n\t\t\t<timestamp><![CDATA[";
|
|
|
|
module_xml += data->getTimestamp ();
|
|
|
|
module_xml += "]]></timestamp>\n\t\t</data>\n";
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
}
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
|
|
|
|
module_xml += "\t</datalist>\n";
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
} else {
|
|
|
|
data = data_list->front ();
|
2008-07-22 12:46:29 +02:00
|
|
|
try {
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
data_clean = strreplace (this->getDataOutput (data), "%", "%%" );
|
|
|
|
module_xml += "\t<data><![CDATA[";
|
|
|
|
module_xml += data_clean;
|
|
|
|
module_xml += "]]></data>\n";
|
|
|
|
} catch (Output_Error e) {
|
|
|
|
}
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
}
|
|
|
|
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
/* Close the module tag */
|
|
|
|
module_xml += "</module>\n";
|
|
|
|
|
|
|
|
/* Clean up */
|
2008-04-09 Esteban Sanchez <estebans@artica.es>
* modules/pandora_data.[cc,h]: Added to repository. Implements a
Pandora_Data object, which holds a value and the timestamp when it
was created.
* modules/pandora_module.[cc,h]: It holds now a list of Pandora_Data
objects. The XML is generated based on the size of this list. Output
property has became obsolete and child modules must use setOutput().
* modules/pandora_module_cpuusage.cc,
modules/pandora_module_exec.cc,
modules/pandora_module_freedisk.cc,
modules/pandora_module_freememory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_proc.cc,
modules/pandora_module_service.cc: Updated to new Pandora_Module
parent class.
* modules/pandora_module_list.cc: Deleted debug output.
* pandora.cc: Now uses SYSTEMTIME instead of old time_t.
* pandora_windows_service.[cc,h]: Added Ramon Novoa to authors. Added
a new configuration token transfer_interval which sets the interval
where the data file will be sent to the server. If the current
interval token is lower than this transfer interval, the data will be
added into a data_list XML tag.
* PandoraAgent.dev: Added new files.
* bin/PandoraAgent.exe: Updated to last commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-09 17:48:06 +02:00
|
|
|
this->cleanDataList ();
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
pandoraDebug ("%s getXML end", module_name.c_str ());
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
return module_xml;
|
2006-07-04 16:07:08 +02:00
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Set the max value the module can have.
|
|
|
|
*
|
|
|
|
* The range is closed, so the value is included.
|
|
|
|
*
|
|
|
|
* @param value Max value to set.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
void
|
|
|
|
Pandora_Module::setMax (int value) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->has_limits = true;
|
2011-03-01 15:45:32 +01:00
|
|
|
this->has_max = true;
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->max = value;
|
2008-12-16 12:30:12 +01:00
|
|
|
}
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Set the min value the module can have.
|
|
|
|
*
|
|
|
|
* The range is closed, so the value is included.
|
|
|
|
*
|
|
|
|
* @param value Min value to set.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
void
|
|
|
|
Pandora_Module::setMin (int value) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->has_limits = true;
|
2011-03-01 15:45:32 +01:00
|
|
|
this->has_min = true;
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->min = value;
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
2008-12-16 12:30:12 +01:00
|
|
|
|
2011-03-01 15:45:32 +01:00
|
|
|
/**
|
|
|
|
* Set the post process value for the module.
|
|
|
|
*
|
|
|
|
* @param value Post process value .
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setPostProcess (string value) {
|
|
|
|
this->post_process = value;
|
|
|
|
}
|
|
|
|
|
2011-07-14 18:45:12 +02:00
|
|
|
/**
|
|
|
|
* Set the min critical value for the module.
|
|
|
|
*
|
|
|
|
* @param value Min critical value .
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setMinCritical (string value) {
|
|
|
|
this->min_critical = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the max critical value for the module.
|
|
|
|
*
|
|
|
|
* @param value Max critical value .
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setMaxCritical (string value) {
|
|
|
|
this->max_critical = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the min warning value for the module.
|
|
|
|
*
|
|
|
|
* @param value Min warning value .
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setMinWarning (string value) {
|
|
|
|
this->min_warning = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the max warning value for the module.
|
|
|
|
*
|
|
|
|
* @param value Max warning value .
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setMaxWarning (string value) {
|
|
|
|
this->max_warning = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the disabled value for the module.
|
|
|
|
*
|
|
|
|
* @param value Disabled value .
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setDisabled (string value) {
|
|
|
|
this->disabled = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the min ff event value for the module.
|
|
|
|
*
|
|
|
|
* @param value Min ff event value .
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setMinFFEvent (string value) {
|
|
|
|
this->min_ff_event = value;
|
|
|
|
}
|
|
|
|
|
2008-11-28 11:51:03 +01:00
|
|
|
/**
|
|
|
|
* Set the async flag to the module.
|
|
|
|
*
|
2008-12-16 12:30:12 +01:00
|
|
|
* If a module is set to be async, it would try to works only when the
|
2008-11-28 11:51:03 +01:00
|
|
|
* events happen. Note that not all the modules can work in async mode.
|
|
|
|
*
|
|
|
|
* @param async Flag to set.
|
2008-12-16 12:30:12 +01:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setAsync (bool async) {
|
|
|
|
this->async = async;
|
|
|
|
}
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Set the module type from a string type.
|
|
|
|
*
|
|
|
|
* @param type String type.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
void
|
|
|
|
Pandora_Module::setType (string type) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->module_type_str = type;
|
|
|
|
this->module_type = parseModuleTypeFromString (type);
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the module kind from a string kind.
|
|
|
|
*
|
|
|
|
* @param kind String kind.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setKind (string kind) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->module_kind_str = kind;
|
|
|
|
this->module_kind = parseModuleKindFromString (kind);
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
2006-07-04 16:07:08 +02:00
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Set the interval execution.
|
|
|
|
*
|
|
|
|
* @param interval Interval between executions.
|
|
|
|
*/
|
2006-07-04 16:07:08 +02:00
|
|
|
void
|
|
|
|
Pandora_Module::setInterval (int interval) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->module_interval = interval;
|
2006-07-04 16:07:08 +02:00
|
|
|
}
|
|
|
|
|
2012-01-03 18:23:23 +01:00
|
|
|
/**
|
|
|
|
* Set the intensive interval.
|
|
|
|
*
|
|
|
|
* @param intensive_interval Intensive interval.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setIntensiveInterval (int intensive_interval) {
|
|
|
|
this->intensive_interval = intensive_interval;
|
|
|
|
}
|
|
|
|
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
/**
|
|
|
|
* Set the execution timeout.
|
|
|
|
*
|
|
|
|
* @param timeout Execution timeout.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setTimeout (int timeout) {
|
|
|
|
|
|
|
|
if (timeout < 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* WaitForSingleObject expects milliseconds */
|
|
|
|
this->module_timeout = timeout * 1000;
|
|
|
|
}
|
|
|
|
|
2008-06-13 12:32:47 +02:00
|
|
|
/**
|
|
|
|
* Get the execution interval.
|
|
|
|
*
|
|
|
|
* @return The execution interval.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
Pandora_Module::getInterval () {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
return this->module_interval;
|
2008-06-13 12:32:47 +02:00
|
|
|
}
|
|
|
|
|
2012-01-03 18:23:23 +01:00
|
|
|
/**
|
|
|
|
* Get the intensive interval.
|
|
|
|
*
|
|
|
|
* @return The intensive interval.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
Pandora_Module::getIntensiveInterval () {
|
|
|
|
return this->intensive_interval;
|
|
|
|
}
|
|
|
|
|
2010-04-21 Ramon Novoa <rnovoa@artica.es>
* main.cc: Updated headers after tinyxml removal.
* modules/pandora_module_list.cc,
modules/pandora_module_factory.cc: Added support for plugin modules.
* modules/pandora_module_exec.cc, modules/pandora_module.h,
modules/pandora_module.cc: Added the module_timeout configuration
token and replaced tinyxml related code.
* bin/pandora_agent.conf: Added a sample plugin module. Added the
group configuration token (was missing).
* modules/pandora_module_plugin.cc,
modules/pandora_module_plugin.h: Added to repository. Plugin module.
* bin/util/df.vbs, bin/util/ps.vbs: Added to repository. Sample
VBScript plugins.
* pandora_windows_service.cc, pandora_windows_service.h,
modules/pandora_module_inventory.cc, ssh/pandora_ssh_test.cc,
ftp/pandora_ftp_test.cc, modules/pandora_module_inventory.h: Replaced
tinyxml related code.
* tinyxml, tinyxml/tinyxmlerror.cpp, tinyxml/tinystr.h,
tinyxml/tinyxmlparser.cpp, tinyxml/tinyxml.cpp,
tinyxml/tinyxml.h, tinyxml/tinystr.cpp: Removed from repository. No
longer used.
* installer/pandora.mpi, pandora.cc: Updated build to RC1.
* Makefile.am: Updated sources. Removed tinyxml and added the plugin
module.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-21 22:00:31 +02:00
|
|
|
/**
|
|
|
|
* Get the execution timeout.
|
|
|
|
*
|
|
|
|
* @return The execution timeout.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
Pandora_Module::getTimeout () {
|
|
|
|
return this->module_timeout;
|
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Set the module description.
|
|
|
|
*
|
|
|
|
* @param description Description of the module.
|
|
|
|
*/
|
2006-07-04 16:07:08 +02:00
|
|
|
void
|
|
|
|
Pandora_Module::setDescription (string description) {
|
2008-11-26 Esteban Sanchez <estebans@artica.es>
* pandora_strutils.cc, pandora_strutils.h, ftp/pandora_ftp_client.cc,
ftp/pandora_ftp_test.cc, ftp/pandora_ftp_client.h,
ftp/pandora_ftp_test.h, windows/pandora_windows_info.h,
windows/pandora_wmi.cc, windows/pandora_windows_info.cc,
misc/pandora_file.cc, misc/pandora_file.h, pandora_agent_conf.cc,
ssh/pandora_ssh_client.cc, ssh/pandora_ssh_test.cc,
ssh/pandora_ssh_client.h, ssh/pandora_ssh_test.h,
pandora_agent_conf.h, windows_service.cc, windows_service.h,
modules/pandora_module.h, modules/pandora_module_logevent.cc,
modules/pandora_module_exec.cc, modules/pandora_module_logevent.h,
modules/pandora_module_exec.h, modules/pandora_module_freedisk.cc,
modules/pandora_module_freedisk.h, modules/pandora_module_service.cc,
modules/pandora_module_service.h, modules/pandora_module_proc.cc,
modules/pandora_data.cc, modules/pandora_module_proc.h,
modules/pandora_data.h, modules/pandora_module_factory.cc,
modules/pandora_module_odbc.cc, modules/pandora_module_odbc.h,
modules/pandora_module_factory.h,
modules/pandora_module_freememory.cc, modules/pandora_module_list.cc,
modules/pandora_module_freememory.h,
modules/pandora_module_cpuusage.cc, modules/pandora_module_cpuusage.h,
modules/pandora_module.cc, pandora.h: Tab style correction.
Indentation blankspaces moved to tab characters.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1262 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-11-26 11:08:19 +01:00
|
|
|
this->module_description = description;
|
2006-07-04 16:07:08 +02:00
|
|
|
}
|
2010-06-30 17:40:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the name of the environment variable where the module data will be saved.
|
|
|
|
*
|
|
|
|
* @param save Name of the environment variable.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setSave (string save) {
|
|
|
|
this->save = save;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the name of the environment variable where the module data will be saved.
|
|
|
|
*
|
|
|
|
* @return The name of the environment variable.
|
|
|
|
*/
|
|
|
|
string
|
|
|
|
Pandora_Module::getSave () {
|
|
|
|
return this->save;
|
|
|
|
}
|
2010-07-02 16:25:53 +02:00
|
|
|
|
2011-06-21 13:06:47 +02:00
|
|
|
/**
|
2012-01-03 18:23:23 +01:00
|
|
|
* Adds a new condition to a condition list.
|
2011-06-21 13:06:47 +02:00
|
|
|
*
|
2012-01-03 18:23:23 +01:00
|
|
|
* @param condition Condition string.
|
|
|
|
* @param condition_list Pointer to the condition list.
|
2011-06-21 13:06:47 +02:00
|
|
|
*/
|
|
|
|
void
|
2012-01-03 18:23:23 +01:00
|
|
|
Pandora_Module::addGenericCondition (string condition, list<Condition *> **condition_list) {
|
|
|
|
Condition *cond;
|
2011-06-21 13:06:47 +02:00
|
|
|
char operation[256], string_value[1024], command[1024];
|
|
|
|
|
2012-01-03 18:23:23 +01:00
|
|
|
/* Create the condition list if it does not exist */
|
|
|
|
if (*condition_list == NULL) {
|
|
|
|
*condition_list = new list<Condition *> ();
|
2011-06-21 13:06:47 +02:00
|
|
|
}
|
|
|
|
|
2012-01-03 18:23:23 +01:00
|
|
|
/* Create the new condition */
|
|
|
|
cond = new Condition;
|
|
|
|
if (cond == NULL) {
|
2011-06-21 13:06:47 +02:00
|
|
|
return;
|
|
|
|
}
|
2012-01-03 18:23:23 +01:00
|
|
|
cond->value_1 = 0;
|
|
|
|
cond->value_2 = 0;
|
2011-06-21 13:06:47 +02:00
|
|
|
|
|
|
|
/* Numeric comparison */
|
2012-01-03 18:23:23 +01:00
|
|
|
if (sscanf (condition.c_str (), "%255s %lf %1023[^\n]s", operation, &(cond->value_1), command) == 3) {
|
|
|
|
cond->operation = operation;
|
|
|
|
cond->command = command;
|
|
|
|
(*condition_list)->push_back (cond);
|
2011-06-21 13:06:47 +02:00
|
|
|
/* Regular expression */
|
2012-01-03 18:23:23 +01:00
|
|
|
} else if (sscanf (condition.c_str (), "=~ %1023s %1023[^\n]s", string_value, command) == 2) {
|
|
|
|
cond->operation = "=~";
|
|
|
|
cond->string_value = string_value;
|
|
|
|
cond->command = command;
|
|
|
|
if (regcomp (&(cond->regexp), string_value, 0) != 0) {
|
2011-06-21 13:06:47 +02:00
|
|
|
pandoraDebug ("Invalid regular expression %s", string_value);
|
2012-01-03 18:23:23 +01:00
|
|
|
delete (cond);
|
2011-06-21 13:06:47 +02:00
|
|
|
return;
|
|
|
|
}
|
2012-01-03 18:23:23 +01:00
|
|
|
(*condition_list)->push_back (cond);
|
2011-06-21 13:06:47 +02:00
|
|
|
/* Interval */
|
2012-01-03 18:23:23 +01:00
|
|
|
} else if (sscanf (condition.c_str (), "(%lf , %lf) %1023[^\n]s", &(cond->value_1), &(cond->value_2), command) == 3) {
|
|
|
|
cond->operation = "()";
|
|
|
|
cond->command = command;
|
|
|
|
(*condition_list)->push_back (cond);
|
2011-06-21 13:06:47 +02:00
|
|
|
} else {
|
2012-01-03 18:23:23 +01:00
|
|
|
pandoraLog ("Invalid condition: %s", condition.c_str ());
|
|
|
|
delete (cond);
|
2011-06-21 13:06:47 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-02 16:25:53 +02:00
|
|
|
/**
|
2012-01-03 18:23:23 +01:00
|
|
|
* Adds a new module condition.
|
2010-07-02 16:25:53 +02:00
|
|
|
*
|
|
|
|
* @param condition Condition string.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::addCondition (string condition) {
|
2012-01-03 18:23:23 +01:00
|
|
|
addGenericCondition (condition, &(this->condition_list));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a new module pre-condition.
|
|
|
|
*
|
|
|
|
* @param condition Condition string.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::addPreCondition (string condition) {
|
|
|
|
addGenericCondition (condition, &(this->precondition_list));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a new module intensive condition.
|
|
|
|
*
|
|
|
|
* @param condition Condition string.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::addIntensiveCondition (string condition) {
|
2010-07-02 16:25:53 +02:00
|
|
|
Condition *cond;
|
2010-07-12 18:31:07 +02:00
|
|
|
char operation[256], string_value[1024], command[1024];
|
2010-07-02 16:25:53 +02:00
|
|
|
|
|
|
|
/* Create the condition list if it does not exist */
|
2012-01-03 18:23:23 +01:00
|
|
|
if (this->intensive_condition_list == NULL) {
|
|
|
|
this->intensive_condition_list = new list<Condition *> ();
|
2010-07-02 16:25:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create the new condition */
|
|
|
|
cond = new Condition;
|
|
|
|
if (cond == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cond->value_1 = 0;
|
|
|
|
cond->value_2 = 0;
|
|
|
|
|
|
|
|
/* Numeric comparison */
|
2012-01-03 18:23:23 +01:00
|
|
|
if (sscanf (condition.c_str (), "%255s %lf", operation, &(cond->value_1)) == 2) {
|
2010-07-02 16:25:53 +02:00
|
|
|
cond->operation = operation;
|
2012-01-03 18:23:23 +01:00
|
|
|
(this->intensive_condition_list)->push_back (cond);
|
2010-07-02 16:25:53 +02:00
|
|
|
/* Regular expression */
|
2012-01-03 18:23:23 +01:00
|
|
|
} else if (sscanf (condition.c_str (), "=~ %1023s", string_value) == 1) {
|
2010-07-02 16:25:53 +02:00
|
|
|
cond->operation = "=~";
|
|
|
|
cond->string_value = string_value;
|
|
|
|
if (regcomp (&(cond->regexp), string_value, 0) != 0) {
|
|
|
|
pandoraDebug ("Invalid regular expression %s", string_value);
|
|
|
|
delete (cond);
|
|
|
|
return;
|
|
|
|
}
|
2012-01-03 18:23:23 +01:00
|
|
|
(this->intensive_condition_list)->push_back (cond);
|
2010-07-02 16:25:53 +02:00
|
|
|
/* Interval */
|
2012-01-03 18:23:23 +01:00
|
|
|
} else if (sscanf (condition.c_str (), "(%lf , %lf)", &(cond->value_1), &(cond->value_2)) == 2) {
|
2010-07-02 16:25:53 +02:00
|
|
|
cond->operation = "()";
|
2012-01-03 18:23:23 +01:00
|
|
|
(this->intensive_condition_list)->push_back (cond);
|
2010-07-02 16:25:53 +02:00
|
|
|
} else {
|
2012-01-03 18:23:23 +01:00
|
|
|
pandoraDebug ("Invalid intensive condition: %s", condition.c_str ());
|
2010-08-04 19:47:44 +02:00
|
|
|
delete (cond);
|
|
|
|
return;
|
2010-07-02 16:25:53 +02:00
|
|
|
}
|
2011-06-21 13:06:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Evaluates and executes module preconditions.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
Pandora_Module::evaluatePreconditions () {
|
|
|
|
STARTUPINFO si;
|
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
DWORD retval, dwRet;
|
|
|
|
SECURITY_ATTRIBUTES attributes;
|
|
|
|
HANDLE out, new_stdout, out_read, job;
|
|
|
|
string working_dir;
|
2012-01-03 18:23:23 +01:00
|
|
|
Condition *precond = NULL;
|
|
|
|
double double_output;
|
|
|
|
list<Condition *>::iterator iter;
|
2011-06-21 13:06:47 +02:00
|
|
|
unsigned char run;
|
|
|
|
string output;
|
|
|
|
|
|
|
|
if (this->precondition_list != NULL && this->precondition_list->size () > 0) {
|
|
|
|
|
|
|
|
iter = this->precondition_list->begin ();
|
|
|
|
for (iter = this->precondition_list->begin ();
|
|
|
|
iter != this->precondition_list->end ();
|
|
|
|
iter++) {
|
|
|
|
|
|
|
|
precond = *iter;
|
|
|
|
run = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* Set the bInheritHandle flag so pipe handles are inherited. */
|
|
|
|
attributes.nLength = sizeof (SECURITY_ATTRIBUTES);
|
|
|
|
attributes.bInheritHandle = TRUE;
|
|
|
|
attributes.lpSecurityDescriptor = NULL;
|
|
|
|
|
|
|
|
/* Create a job to kill the child tree if it become zombie */
|
|
|
|
/* CAUTION: In order to compile this, WINVER should be defined to 0x0500.
|
|
|
|
This may need no change, since it was redefined by the
|
|
|
|
program, but if needed, the macro is defined
|
|
|
|
in <windef.h> */
|
|
|
|
job = CreateJobObject (&attributes, this->module_name.c_str ());
|
|
|
|
if (job == NULL) {
|
2011-12-12 18:11:06 +01:00
|
|
|
pandoraLog ("evaluatePreconditions: CreateJobObject failed. Err: %d", GetLastError ());
|
2011-06-21 13:06:47 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the handle to the current STDOUT. */
|
|
|
|
out = GetStdHandle (STD_OUTPUT_HANDLE);
|
|
|
|
|
|
|
|
if (! CreatePipe (&out_read, &new_stdout, &attributes, 0)) {
|
2011-12-12 18:11:06 +01:00
|
|
|
pandoraLog ("evaluatePreconditions: CreatePipe failed. Err: %d", GetLastError ());
|
2011-06-21 13:06:47 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure the read handle to the pipe for STDOUT is not inherited */
|
|
|
|
SetHandleInformation (out_read, HANDLE_FLAG_INHERIT, 0);
|
|
|
|
|
|
|
|
/* Set up members of the STARTUPINFO structure. */
|
|
|
|
ZeroMemory (&si, sizeof (si));
|
|
|
|
GetStartupInfo (&si);
|
|
|
|
|
|
|
|
si.cb = sizeof (si);
|
|
|
|
si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
|
|
|
|
si.wShowWindow = SW_HIDE;
|
|
|
|
si.hStdError = new_stdout;
|
|
|
|
si.hStdOutput = new_stdout;
|
|
|
|
|
|
|
|
/* Set up members of the PROCESS_INFORMATION structure. */
|
|
|
|
ZeroMemory (&pi, sizeof (pi));
|
2011-12-12 18:11:06 +01:00
|
|
|
pandoraDebug ("Executing pre-condition: %s", precond->command.c_str ());
|
2011-06-21 13:06:47 +02:00
|
|
|
|
|
|
|
/* Set the working directory of the process. It's "utils" directory
|
|
|
|
to find the GNU W32 tools */
|
|
|
|
working_dir = getPandoraInstallDir () + "util\\";
|
|
|
|
|
|
|
|
/* Create the child process. */
|
|
|
|
if (! CreateProcess (NULL, (CHAR *) precond->command.c_str (), NULL,
|
|
|
|
NULL, TRUE, CREATE_SUSPENDED | CREATE_NO_WINDOW, NULL,
|
|
|
|
working_dir.c_str (), &si, &pi)) {
|
2011-12-12 18:11:06 +01:00
|
|
|
pandoraLog ("evaluatePreconditions: %s CreateProcess failed. Err: %d",
|
2011-06-21 13:06:47 +02:00
|
|
|
this->module_name.c_str (), GetLastError ());
|
|
|
|
} else {
|
|
|
|
char buffer[BUFSIZE + 1];
|
|
|
|
unsigned long read, avail;
|
2010-08-04 18:28:25 +02:00
|
|
|
|
2011-06-21 13:06:47 +02:00
|
|
|
if (! AssignProcessToJobObject (job, pi.hProcess)) {
|
2011-12-12 18:11:06 +01:00
|
|
|
pandoraLog ("evaluatePreconditions: could not assign proccess to job (error %d)",
|
2011-06-21 13:06:47 +02:00
|
|
|
GetLastError ());
|
|
|
|
}
|
2011-12-12 18:11:06 +01:00
|
|
|
ResumeThread (pi.hThread);
|
2011-06-21 13:06:47 +02:00
|
|
|
|
2012-01-03 18:23:23 +01:00
|
|
|
/*string output;*/
|
2012-01-04 17:09:11 +01:00
|
|
|
output = "";
|
2012-01-03 18:23:23 +01:00
|
|
|
int tickbase = GetTickCount();
|
|
|
|
while ( (dwRet = WaitForSingleObject (pi.hProcess, 500)) != WAIT_ABANDONED ) {
|
|
|
|
PeekNamedPipe (out_read, buffer, BUFSIZE, &read, &avail, NULL);
|
|
|
|
if (avail > 0) {
|
|
|
|
ReadFile (out_read, buffer, BUFSIZE, &read, NULL);
|
|
|
|
buffer[read] = '\0';
|
|
|
|
output += (char *) buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
double_output = Pandora_Strutils::strtodouble (output);
|
|
|
|
} catch (Pandora_Strutils::Invalid_Conversion e) {
|
|
|
|
double_output = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dwRet == WAIT_OBJECT_0) {
|
|
|
|
break;
|
|
|
|
} else if(this->getTimeout() < GetTickCount() - tickbase) {
|
|
|
|
/* STILL_ACTIVE */
|
|
|
|
TerminateProcess(pi.hThread, STILL_ACTIVE);
|
|
|
|
pandoraLog ("evaluatePreconditions: %s timed out (retcode: %d)", this->module_name.c_str (), STILL_ACTIVE);
|
|
|
|
break;
|
2011-06-21 13:06:47 +02:00
|
|
|
}
|
|
|
|
}
|
2012-01-03 18:23:23 +01:00
|
|
|
|
|
|
|
GetExitCodeProcess (pi.hProcess, &retval);
|
|
|
|
|
|
|
|
if (retval != 0) {
|
|
|
|
if (! TerminateJobObject (job, 0)) {
|
|
|
|
pandoraLog ("evaluatePreconditions: TerminateJobObject failed. (error %d)",
|
|
|
|
GetLastError ());
|
|
|
|
}
|
|
|
|
if (retval != STILL_ACTIVE) {
|
|
|
|
pandoraLog ("evaluatePreconditions: %s did not executed well (retcode: %d)",
|
|
|
|
this->module_name.c_str (), retval);
|
|
|
|
}
|
|
|
|
/* Close job, process and thread handles. */
|
|
|
|
CloseHandle (job);
|
|
|
|
CloseHandle (pi.hProcess);
|
|
|
|
CloseHandle (pi.hThread);
|
|
|
|
CloseHandle (new_stdout);
|
|
|
|
CloseHandle (out_read);
|
|
|
|
return 0;
|
2011-06-21 13:06:47 +02:00
|
|
|
}
|
2012-01-03 18:23:23 +01:00
|
|
|
|
2011-12-12 18:11:06 +01:00
|
|
|
/* Close job, process and thread handles. */
|
|
|
|
CloseHandle (job);
|
|
|
|
CloseHandle (pi.hProcess);
|
|
|
|
CloseHandle (pi.hThread);
|
2012-01-03 18:23:23 +01:00
|
|
|
}
|
|
|
|
|
2011-12-12 18:11:06 +01:00
|
|
|
CloseHandle (new_stdout);
|
|
|
|
CloseHandle (out_read);
|
2012-01-03 18:23:23 +01:00
|
|
|
|
2012-01-04 17:09:11 +01:00
|
|
|
if (evaluateCondition (output, double_output, precond) == 0) {
|
2012-01-03 18:23:23 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2011-06-21 13:06:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-03 18:23:23 +01:00
|
|
|
return 1;
|
|
|
|
}
|
2010-07-02 16:25:53 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Evaluates and executes module conditions.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::evaluateConditions () {
|
|
|
|
unsigned char run;
|
|
|
|
double double_value;
|
|
|
|
string string_value;
|
|
|
|
Condition *cond = NULL;
|
|
|
|
list<Condition *>::iterator iter;
|
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
STARTUPINFO si;
|
|
|
|
Pandora_Data *pandora_data = NULL;
|
|
|
|
regex_t regex;
|
|
|
|
|
|
|
|
/* No data */
|
|
|
|
if ( (!this->has_output) || this->data_list == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the module data */
|
|
|
|
pandora_data = data_list->front ();
|
|
|
|
|
|
|
|
/* Get the string value of the data */
|
|
|
|
string_value = pandora_data->getValue ();
|
|
|
|
|
|
|
|
/* Get the double value of the data */
|
|
|
|
try {
|
|
|
|
double_value = Pandora_Strutils::strtodouble (string_value);
|
|
|
|
} catch (Pandora_Strutils::Invalid_Conversion e) {
|
|
|
|
double_value = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->condition_list != NULL && this->condition_list->size () > 0) {
|
|
|
|
iter = this->condition_list->begin ();
|
|
|
|
for (iter = this->condition_list->begin ();
|
|
|
|
iter != this->condition_list->end ();
|
|
|
|
iter++) {
|
|
|
|
cond = *iter;
|
|
|
|
run = 0;
|
2012-01-03 18:23:23 +01:00
|
|
|
|
|
|
|
if (evaluateCondition (string_value, double_value, cond) == 1) {
|
2010-07-02 16:25:53 +02:00
|
|
|
/* Run the condition command */
|
|
|
|
ZeroMemory (&si, sizeof (si));
|
|
|
|
ZeroMemory (&pi, sizeof (pi));
|
|
|
|
if (CreateProcess (NULL , (CHAR *)cond->command.c_str (), NULL, NULL, FALSE,
|
|
|
|
CREATE_NO_WINDOW, NULL, NULL, &si, &pi) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
WaitForSingleObject(pi.hProcess, this->module_timeout);
|
|
|
|
CloseHandle (pi.hProcess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-07-12 18:31:07 +02:00
|
|
|
|
2012-01-03 18:23:23 +01:00
|
|
|
/**
|
|
|
|
* Evaluates and executes intensive module conditions.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
Pandora_Module::evaluateIntensiveConditions () {
|
|
|
|
double double_value;
|
|
|
|
string string_value;
|
|
|
|
Condition *cond = NULL;
|
|
|
|
list<Condition *>::iterator iter;
|
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
STARTUPINFO si;
|
|
|
|
Pandora_Data *pandora_data = NULL;
|
|
|
|
regex_t regex;
|
|
|
|
|
|
|
|
/* Not an intensive module */
|
|
|
|
if (this->intensive_condition_list == NULL || this->intensive_condition_list->size () <= 0) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No data */
|
|
|
|
if ( (!this->has_output) || this->data_list == NULL) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the module data */
|
|
|
|
pandora_data = data_list->front ();
|
|
|
|
|
|
|
|
/* Get the string value of the data */
|
|
|
|
string_value = pandora_data->getValue ();
|
|
|
|
|
|
|
|
/* Get the double value of the data */
|
|
|
|
try {
|
|
|
|
double_value = Pandora_Strutils::strtodouble (string_value);
|
|
|
|
} catch (Pandora_Strutils::Invalid_Conversion e) {
|
|
|
|
double_value = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
iter = this->intensive_condition_list->begin ();
|
|
|
|
for (iter = this->intensive_condition_list->begin ();
|
|
|
|
iter != this->intensive_condition_list->end ();
|
|
|
|
iter++) {
|
|
|
|
cond = *iter;
|
|
|
|
if (evaluateCondition (string_value, double_value, cond) == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-07-12 18:31:07 +02:00
|
|
|
/**
|
|
|
|
* Checks the module cron. Returns 1 if the module should run, 0 if not.
|
|
|
|
*
|
|
|
|
* @return 1 if the module should run, 0 if not.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
Pandora_Module::checkCron () {
|
|
|
|
int i, time_params[5];
|
|
|
|
time_t current_time, offset;
|
|
|
|
struct tm *time_struct;
|
|
|
|
Cron *cron = this->cron;
|
|
|
|
|
|
|
|
// No cron
|
|
|
|
if (cron == NULL) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get current time
|
|
|
|
current_time = time (NULL);
|
|
|
|
|
|
|
|
// Check if the module was already executed
|
|
|
|
if (current_time <= cron->utimestamp) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Break current time
|
|
|
|
time_struct = localtime(¤t_time);
|
|
|
|
if (time_struct == NULL) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
time_params[0] = time_struct->tm_min;
|
|
|
|
time_params[1] = time_struct->tm_hour;
|
|
|
|
time_params[2] = time_struct->tm_mday;
|
|
|
|
time_params[3] = time_struct->tm_mon;
|
|
|
|
time_params[4] = time_struct->tm_wday;
|
|
|
|
|
|
|
|
// Fix month (localtime retuns 0..11 and we need 1..12)
|
|
|
|
time_params[3] += 1;
|
|
|
|
|
|
|
|
// Check cron parameters
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
|
|
|
|
// Wildcard
|
|
|
|
if (cron->params[i][0] < 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check interval
|
|
|
|
if (cron->params[i][0] <= cron->params[i][1]) {
|
|
|
|
if (time_params[i] < cron->params[i][0] || time_params[i] > cron->params[i][1]) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (time_params[i] < cron->params[i][0] && time_params[i] > cron->params[i][1]) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do not check in the next minute, hour, day or month.
|
|
|
|
offset = 0;
|
|
|
|
if (cron->interval >= 0) {
|
|
|
|
offset = cron->interval;
|
|
|
|
} else if(cron->params[0][0] >= 0) {
|
|
|
|
// 1 minute
|
|
|
|
offset = 60;
|
|
|
|
} else if(cron->params[1][0] >= 0) {
|
|
|
|
// 1 hour
|
|
|
|
offset = 3600;
|
|
|
|
} else if(cron->params[2][0] >=0 || cron->params[4][0] >= 0) {
|
|
|
|
// 1 day
|
|
|
|
offset = 86400;
|
|
|
|
} else if(cron->params[3][0] >= 0) {
|
|
|
|
// 31 days
|
|
|
|
offset = 2678400;
|
|
|
|
}
|
|
|
|
|
|
|
|
cron->utimestamp = current_time + offset;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the module cron from a string.
|
|
|
|
*
|
|
|
|
* @return 1 if the module should run, 0 if not.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setCron (string cron_string) {
|
|
|
|
int i, value;
|
|
|
|
char cron_params[5][256], bottom[256], top[256];
|
|
|
|
|
|
|
|
/* Create the new cron if necessary */
|
|
|
|
if (this->cron == NULL) {
|
|
|
|
this->cron = new Cron ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Parse the cron string */
|
|
|
|
if (sscanf (cron_string.c_str (), "%255s %255s %255s %255s %255s", cron_params[0], cron_params[1], cron_params[2], cron_params[3], cron_params[4]) != 5) {
|
|
|
|
pandoraDebug ("Invalid cron string: %s", cron_string.c_str ());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fill the cron structure */
|
|
|
|
this->cron->utimestamp = 0;
|
|
|
|
this->cron->interval = -1;
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
|
|
|
|
/* Wildcard */
|
|
|
|
if (cron_params[i][0] == '*') {
|
|
|
|
this->cron->params[i][0] = -1;
|
|
|
|
|
|
|
|
/* Interval */
|
|
|
|
} else if (sscanf (cron_params[i], "%255[^-]-%255s", bottom, top) == 2) {
|
|
|
|
value = atoi (bottom);
|
|
|
|
this->cron->params[i][0] = value;
|
|
|
|
value = atoi (top);
|
|
|
|
this->cron->params[i][1] = value;
|
|
|
|
|
|
|
|
/* Single value */
|
|
|
|
} else {
|
|
|
|
value = atoi (cron_params[i]);
|
|
|
|
this->cron->params[i][0] = value;
|
|
|
|
this->cron->params[i][1] = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the interval of the module cron.
|
2012-01-03 18:23:23 +01:00
|
|
|
*
|
|
|
|
* @param interval Module cron interval in seconds.
|
2010-07-12 18:31:07 +02:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setCronInterval (int interval) {
|
|
|
|
if (this->cron == NULL) {
|
|
|
|
this->cron = new Cron ();
|
|
|
|
}
|
|
|
|
|
|
|
|
this->cron->interval = interval;
|
|
|
|
}
|
2012-01-03 18:23:23 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Evaluate a single condition. Returns 1 if the condition matches, 0
|
|
|
|
* otherwise.
|
|
|
|
*
|
|
|
|
* @param string_value String value.
|
|
|
|
* @param double_value Double value.
|
|
|
|
* @param condition Pointer to the condition.
|
|
|
|
*/
|
|
|
|
int Pandora_Module::evaluateCondition (string string_value, double double_value, Condition *condition) {
|
|
|
|
if ((condition->operation == ">" && double_value > condition->value_1) ||
|
|
|
|
(condition->operation == "<" && double_value < condition->value_1) ||
|
|
|
|
(condition->operation == "=" && double_value == condition->value_1) ||
|
|
|
|
(condition->operation == "!=" && double_value != condition->value_1) ||
|
|
|
|
(condition->operation == "=~" && regexec (&(condition->regexp), string_value.c_str(), 0, NULL, 0) == 0) ||
|
|
|
|
(condition->operation == "()" && double_value > condition->value_1 && double_value < condition->value_2)) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if a module has data.
|
|
|
|
*
|
|
|
|
* @return 1 if the module has data, 0 otherwise.
|
|
|
|
*/
|
|
|
|
int Pandora_Module::hasOutput () {
|
|
|
|
if (this->has_output == 1) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the module timestamp.
|
|
|
|
*
|
|
|
|
* @param timestamp Module timestamp in seconds.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setTimestamp (time_t timestamp) {
|
|
|
|
this->timestamp = timestamp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the module timestamp.
|
|
|
|
*
|
|
|
|
* @return Module timestamp in seconds.
|
|
|
|
*/
|
|
|
|
time_t
|
|
|
|
Pandora_Module::getTimestamp () {
|
|
|
|
return this->timestamp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the value of intensive_match.
|
|
|
|
*
|
|
|
|
* @param intensive_match 0 or 1.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Pandora_Module::setIntensiveMatch (unsigned char intensive_match) {
|
|
|
|
this->intensive_match = intensive_match;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the value of intensive_match.
|
|
|
|
*
|
|
|
|
* @return The value of intensive match.
|
|
|
|
*/
|
|
|
|
unsigned char
|
|
|
|
Pandora_Module::getIntensiveMatch () {
|
|
|
|
return this->intensive_match;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|