Esteban Sanchez e6c81809f4 2006-07-05 Esteban Sanchez <esteban@steve-o.org>
* windows/pandora_wmi.cc: Removed unnecessary debug. Check the service state on isRunningService ()

        * pandora_agent_conf.cc, modules/pandora_module_factory.cc: Removed unnecessary debug.

        * bin/PandoraAgent.tar.gz: Added to repository.

        * ssh/pandora_ssh_client.cc: Debug converted into log.

        * pandora_windows_service.cc:  Get the interval value (in minutes) and set it to the service.
        Check if the XML of the module is NULL before adding it to the file. Added log output on error.
        Delete temporal file before finishing the run.

        * pandora_windows_service.h: Macro modified.

        * modules/pandora_module.h, modules/pandora_module.cc: Added new exception, raised when the interval
        is not fulfilled. Added code to the run funtion of the Pandora_Module class, to check the execution
        interval.

        * modules/pandora_module_proc.cc, modules/pandora_module_exec.cc, modules/pandora_module_service.cc:
        Call to the run() base class function before running the specific code.

        * modules/pandora_module_list.cc: Removed use of namespace and use a explicit specification.

        * Changelog: Renamed to ChangeLog.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@85 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-07-05 08:46:51 +00:00

102 lines
3.6 KiB
C++

/* 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.
*/
#ifndef __PANDORA_MODULE_H__
#define __PANDORA_MODULE_H__
#include "../pandora.h"
#include "../tinyxml/tinyxml.h"
#include <list>
#include <string>
namespace Pandora_Modules {
enum {
TYPE_0,
TYPE_GENERIC_DATA,
TYPE_GENERIC_DATA_INC,
TYPE_GENERIC_PROC,
TYPE_GENERIC_DATA_STRING
};
const string module_generic_data_str = "generic_data";
const string module_generic_data_inc_str = "generic_data_inc";
const string module_generic_proc_str = "generic_proc";
const string module_generic_data_string_str = "generic_data_string";
enum {
MODULE_0,
MODULE_EXEC,
MODULE_PROC,
MODULE_SERVICE
};
const string module_exec_str = "module_exec";
const string module_proc_str = "module_proc";
const string module_service_str = "module_service";
class Output_Error : public Pandora::Pandora_Exception { };
class Interval_Error : public Pandora::Pandora_Exception { };
class Interval_Not_Fulfilled : public Pandora::Pandora_Exception { };
class Pandora_Module {
protected:
string module_name;
string module_type_str;
int module_type;
string module_kind_str;
string module_description;
int module_kind;
int module_interval;
int executions;
string output;
int max, min;
bool has_limits;
bool has_output;
public:
Pandora_Module (string name);
virtual ~Pandora_Module ();
static int getModuleType (string type);
void setInterval (int interval);
/* Get the XML output of the agent. */
TiXmlElement *getXml ();
/* Execute the agent */
virtual void run ();
virtual string getOutput () const;
string getName () const;
string getTypeString () const;
int getTypeInt () const;
int getModuleKind () const;
void setType (string type);
void setDescription (string description);
void setMax (int value);
void setMin (int value);
};
}
#endif