2009-09-02 Pablo de la Concepcin <pablo.concepcion@artica.es>

* windows/pandora_wmi.cc, windows/pandora_wmi.h: Added Inventory
        functions

        * modules/pandora_module_inventory.h,
        modules/pandora_module_inventory.cc,
        modules/pandora_module.h, modules/pandora_module_list.cc,
        modules/pandora_module_factory.cc, modules/pandora_module.cc: Added
        Inventory moudule files and moudule loading logic.

        * modules/pandora_data.cc, modules/pandora_data.h: Added data_origin
        atribute, new constructors and getters and setters for the atribute

        * bin/PandoraAgent.exe: new complide binary

        * bin/pandora_agent.conf: new configuration parameters for inventory
        module

        * PandoraAgent.dev: Updated project file



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1905 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Pablo de la Concepción Sanz 2009-09-02 11:39:53 +00:00
parent 983d1f373a
commit fe65d1b3d8
14 changed files with 1236 additions and 82 deletions

View File

@ -1,3 +1,23 @@
2009-09-02 Pablo de la Concepción <pablo.concepcion@artica.es>
* windows/pandora_wmi.cc, windows/pandora_wmi.h: Added Inventory
functions
* modules/pandora_module_inventory.h,
modules/pandora_module_inventory.cc,
modules/pandora_module.h, modules/pandora_module_list.cc,
modules/pandora_module_factory.cc, modules/pandora_module.cc: Added
Inventory moudule files and moudule loading logic.
* modules/pandora_data.cc, modules/pandora_data.h: Added data_origin
atribute, new constructors and getters and setters for the atribute
* bin/PandoraAgent.exe: new complide binary
* bin/pandora_agent.conf: new configuration parameters for inventory
module
* PandoraAgent.dev: Updated project file
2009-05-28 Ramon Novoa <rnovoa@artica.es>
* modules/pandora_module_logevent.cc: Fixed the calculation of the

View File

@ -1,7 +1,7 @@
[Project]
FileName=PandoraAgent.dev
Name=PandoraAgent
UnitCount=91
UnitCount=93
Type=1
Ver=1
ObjFiles=
@ -957,3 +957,23 @@ Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit93]
FileName=modules\pandora_module_inventory.cc
CompileCpp=1
Folder=Modules
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit92]
FileName=modules\pandora_module_inventory.h
CompileCpp=1
Folder=Modules
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@ -16,19 +16,19 @@
# The variables $*$ will be substituted in the installation
server_ip $ServerIP$
server_path $ServerPath$
temporal "$AgentTemp$"
server_ip 192.168.50.72
server_path /var/spool/pandora/data_in
temporal "c:\tmp\"
#temporal_min_size 1024
#startup_delay 5
# Agent uses your hostname automatically, if you need to change agent name
# use directive agent_name
# agent_name $AgentName$
agent_name test_guindous
# Interval is defined in seconds
interval 300
interval 5
# tranfer_modes: Possible values are local, tentacle (default), ftp and ssh.
transfer_mode tentacle
@ -38,7 +38,7 @@ server_port 41121
# server_pwd pandora
# Debug mode do not copy XML data files to server and stop executing after first one
# debug 1
#debug 1
# ODBC connections
# Configuring "ExampleDSN" DSN. Notice that this DSN connection must be configured
@ -57,69 +57,88 @@ server_port 41121
# Is Eventlog service running?
module_begin
module_name ServicioReg
module_type generic_proc
module_service Eventlog
module_description Eventlog Service
module_end
#module_begin
#module_name ServicioReg
#module_type generic_proc
#module_service Eventlog
#module_description Eventlog Service
#module_end
# Is Microsoft Messenger running?
module_begin
module_name MSN_Messenger
module_type generic_proc
module_proc msmsgs.exe
module_description Microsoft Messenger (MSN)
module_end
#module_begin
#module_name MSN_Messenger
#module_type generic_proc
#module_proc msmsgs.exe
#module_description Microsoft Messenger (MSN)
#module_end
# Received packets using external program exec
module_begin
module_name ReceivedPackets
module_type generic_data
module_exec netstat -s | grep "Packets Received" | tr -d " " | cut -f 2 -d "=" | tr -d "\n"
module_description Received packets
module_end
#module_begin
#module_name ReceivedPackets
#module_type generic_data
#module_exec netstat -s | grep "Packets Received" | tr -d " " | cut -f 2 -d "=" | tr -d "\n"
#module_description Received packets
#module_end
# Received packets using external program exec
module_begin
module_name Listen_Conn
module_type generic_data
module_exec netstat -an | grep LISTEN | wc -l | tr -d " "
module_description Listening connections
module_end
#module_begin
#module_name Listen_Conn
#module_type generic_data
#module_exec netstat -an | grep LISTEN | wc -l | tr -d " "
#module_description Listening connections
#module_end
# Free space on disk C:
module_begin
module_name FreeDiskC
module_type generic_data
module_freedisk C:
module_description Free space on drive C:
module_end
#module_begin
#module_name FreeDiskC
#module_type generic_data
#module_freedisk C:
#module_description Free space on drive C:
#module_end
# CPU usage percentage
module_begin
module_name CPUUse0
module_type generic_data
module_cpuusage 0
module_description CPU#0 usage
module_end
#module_begin
#module_name CPUUse0
#module_type generic_data
#module_cpuusage 0
#module_description CPU#0 usage
#module_end
# Inventory
#module_begin
#module_name Inventory
# Establish the module interval to run every 3 days (8640 times interval (30 seconds in this case) = 3 days)
#module_interval 8640
#module_type generic_data_string
#Parameters available:
# * CPU -> Gets information about the CPUs
# * CDROM -> Gets information about the CDROMs
# * Video -> Gets information about the video cards
# * HD -> Gets information about the Hard Drives
# * NIC -> Gets information about the Network Interface Controlers
# * Patches -> Gets informaton about the patches installed
# * Software -> Gets information about the MSI packages installed
# * RAM -> Get information about the RAM modules
#module_inventory CPU Video HDs NICs CDROM Patches Software RAM
#module_description Inventory
#module_end
# Free Memory
module_begin
module_name FreeMemory
module_type generic_data
module_freememory
module_description Amount of free memory.
module_end
#module_begin
#module_name FreeMemory
#module_type generic_data_string
#module_freememory
#module_description Amount of free memory.
#module_end
# Log events
module_begin
module_name Logevents
module_type generic_data_string
module_logevent
module_description Log Events
module_end
#module_begin
#module_name Logevents
#module_type generic_data_string
#module_logevent
#module_description Log Events
#module_end
# More examples, uncomment (removing #) to use them
# =================================================
@ -253,14 +272,14 @@ module_end
# module_end
# Example of watchdog service opening it if it gets closed
# module_begin
# module_name ServiceSched
# module_type generic_proc
# module_service Schedule
# module_description Service Task scheduler
# module_async yes
# module_watchdog yes
# module_end
module_begin
module_name ServiceSched
module_type generic_proc
module_service Schedule
module_description Service Task scheduler
module_async yes
module_watchdog yes
module_end
# Example UDP server to be able to execute remote actions such
# as starting or stopping process.

View File

@ -25,20 +25,23 @@ using namespace Pandora;
/**
* Pandora_Data constructor.
*
* Set all attributes
* Creates a Pandora_Data object with the value received, the current time
* as timestamp and "unknown_source" as data_origin.
*
* @param value Data value.
* @param timestamp Timeestamp value.
*/
Pandora_Data::Pandora_Data (string value) {
this->value = value;
GetSystemTime (&(this->timestamp));
this->data_origin = pandora_data_unknown_source;
}
/**
* Pandora_Data constructor.
*
* Set all attributes
* Creates a Pandora_Data object with the value received, the received
* system_time as timestamp and "unknown_source" as data_origin.
*
*
* @param value Data value.
* @param system_time Timestamp.
@ -51,6 +54,42 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time) {
this->timestamp.wHour = system_time->wHour;
this->timestamp.wMinute = system_time->wMinute;
this->timestamp.wSecond = system_time->wSecond;
this->data_origin = pandora_data_unknown_source;
}
/**
* Pandora_Data constructor.
*
* Creates a Pandora_Data object with the value and data_origin received and the
* current time as timestamp
*
* @param value Data value.
* @param data_origin Data origin
*/
Pandora_Data::Pandora_Data (string value, string data_origin) {
this->value = value;
GetSystemTime (&(this->timestamp));
this->data_origin = data_origin;
}
/**
* Pandora_Data constructor.
*
* Set all attributes
*
* @param value Data value.
* @param system_time Timestamp.
* @param data_origin Data origin
*/
Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time, string data_origin) {
this->value = value;
this->timestamp.wYear = system_time->wYear;
this->timestamp.wMonth = system_time->wMonth;
this->timestamp.wDay = system_time->wDay;
this->timestamp.wHour = system_time->wHour;
this->timestamp.wMinute = system_time->wMinute;
this->timestamp.wSecond = system_time->wSecond;
this->data_origin = data_origin;
}
/**
@ -61,6 +100,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time) {
Pandora_Data::Pandora_Data () {
this->value = "";
GetSystemTime (&(this->timestamp));
this->data_origin = "";
}
/**
@ -105,3 +145,23 @@ Pandora_Data::setValue (string value) {
this->value = value;
}
/**
* Get data_origin property of Pandora_Data object
*
* @return data_origin property.
*/
string
Pandora_Data::getDataOrigin() const {
return this->data_origin;
}
/**
* Set data_origin property of Pandora_Data object
*
* @param data_origin Data Oring to set.
*/
void
Pandora_Data::setDataOrigin(string data_origin) {
this->data_origin = data_origin;
}

View File

@ -28,6 +28,7 @@
using namespace std;
namespace Pandora {
const string pandora_data_unknown_source = "unknown_source";
/**
* Class to implement the Pandora Windows service.
*/
@ -35,15 +36,21 @@ namespace Pandora {
private:
string value;
SYSTEMTIME timestamp;
string data_origin;
public:
Pandora_Data ();
Pandora_Data (string value);
Pandora_Data (string value, SYSTEMTIME *system_time);
Pandora_Data (string value, SYSTEMTIME *system_time);
Pandora_Data (string value, string data_orign);
Pandora_Data (string value, SYSTEMTIME *system_time, string data_orign);
~Pandora_Data ();
string getValue () const;
string getTimestamp () const;
string getDataOrigin() const;
void setValue (string value);
void setDataOrigin(string data_origin);
};
}

View File

@ -42,6 +42,7 @@ Pandora_Module::Pandora_Module (string name) {
this->has_limits = false;
this->async = false;
this->data_list = NULL;
this->inventory_list = NULL;
}
/**
@ -72,6 +73,19 @@ Pandora_Module::cleanDataList () {
delete this->data_list;
this->data_list = NULL;
}
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;
}
}
/**
@ -127,6 +141,8 @@ Pandora_Module::parseModuleKindFromString (string kind) {
return MODULE_FREEMEMORY_PERCENT;
} else if (kind == module_cpuusage_str) {
return MODULE_CPUUSAGE;
} else if (kind == module_inventory_str) {
return MODULE_INVENTORY;
} else if (kind == module_odbc_str) {
return MODULE_ODBC;
} else if (kind == module_logevent_str) {
@ -268,11 +284,12 @@ Pandora_Module::setOutput (string output) {
if (this->data_list == NULL)
this->data_list = new list<Pandora_Data *> ();
data = new Pandora_Data (output);
data = new Pandora_Data (output, this->module_name);
this->data_list->push_back (data);
this->latest_output = output;
}
/**
* Set the output of the module.
*
@ -288,7 +305,7 @@ Pandora_Module::setOutput (string output, SYSTEMTIME *system_time) {
if (this->data_list == NULL)
this->data_list = new list<Pandora_Data *> ();
data = new Pandora_Data (output, system_time);
data = new Pandora_Data (output, system_time, this->module_name);
this->data_list->push_back (data);
}
@ -311,7 +328,7 @@ Pandora_Module::run () {
this->executions++;
has_output = false;
throw Interval_Not_Fulfilled ();
}
}
/* Increment the executions after check. This is done to execute the
first time */
@ -338,6 +355,7 @@ Pandora_Module::run () {
*/
TiXmlElement *
Pandora_Module::getXml () {
TiXmlElement *root;
TiXmlElement *element;
TiXmlElement *data_list_element;

View File

@ -74,6 +74,7 @@ namespace Pandora_Modules {
MODULE_FREEDISK, /**< The module checks the free */
MODULE_FREEDISK_PERCENT, /**< The module checks the free */
MODULE_CPUUSAGE, /**< The module checks the CPU usage */
MODULE_INVENTORY, /**< The module gets the inventory of the machine */
MODULE_FREEMEMORY, /**< The module checks the percentage of
* freememory in the system */
MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of
@ -94,6 +95,7 @@ namespace Pandora_Modules {
const string module_freememory_str = "module_freememory";
const string module_freememory_percent_str = "module_freememory_percent";
const string module_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory";
const string module_odbc_str = "module_odbc";
const string module_logevent_str = "module_logevent";
const string module_wmiquery_str = "module_wmiquery";
@ -132,15 +134,11 @@ namespace Pandora_Modules {
int executions;
int max, min;
bool has_limits;
string module_type_str;
Module_Type module_type;
string module_kind_str;
Module_Kind module_kind;
list<Pandora_Data *> *data_list;
string latest_output;
string getDataOutput (Pandora_Data *data);
void cleanDataList ();
protected:
/**
* Indicates if the module generated output in
@ -160,6 +158,21 @@ namespace Pandora_Modules {
* Flag to set a module as asynchronous
*/
bool async;
/**
* List of items of the inventory
*/
list<Pandora_Data *> *inventory_list;
/**
* Data passed to the latest setOutput
*/
string latest_output;
/**
* String containing the module type
*/
string module_type_str;
string getDataOutput (Pandora_Data *data);
void cleanDataList ();
public:
Pandora_Module (string name);
virtual ~Pandora_Module ();
@ -173,7 +186,8 @@ namespace Pandora_Modules {
void setInterval (int interval);
int getInterval ();
TiXmlElement *getXml ();
virtual TiXmlElement *getXml ();
virtual void run ();

View File

@ -28,6 +28,7 @@
#include "pandora_module_freememory.h"
#include "pandora_module_freememory_percent.h"
#include "pandora_module_cpuusage.h"
#include "pandora_module_inventory.h"
#include "pandora_module_odbc.h"
#include "pandora_module_logevent.h"
#include "pandora_module_wmiquery.h"
@ -52,6 +53,8 @@ using namespace Pandora_Strutils;
#define TOKEN_FREEMEMORY ("module_freememory")
#define TOKEN_FREEMEMORY_PERCENT ("module_freepercentmemory")
#define TOKEN_CPUUSAGE ("module_cpuusage ")
#define TOKEN_INVENTORY ("module_inventory")
#define TOKEN_INVENTORY_INTERVAL ("module_inventory_interval")
#define TOKEN_ODBC ("module_odbc ")
#define TOKEN_MAX ("module_max ")
#define TOKEN_MIN ("module_min ")
@ -108,7 +111,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_name, module_type, module_exec;
string module_min, module_max, module_description;
string module_interval, module_proc, module_service;
string module_freedisk, module_cpuusage, module_odbc;
string module_freedisk, module_cpuusage, module_inventory, module_inventory_interval, module_odbc;
string module_freedisk_percent, module_freememory_percent;
string module_odbc_query, module_dsn, module_freememory;
string module_logevent, module_source, module_eventtype, module_eventcode;
@ -152,7 +155,8 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_port = "";
module_timeout = "";
module_regexp = "";
module_inventory_interval = "";
stringtok (tokens, definition, "\n");
/* Pick the first and the last value of the token list */
@ -195,6 +199,12 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_cpuusage == "") {
module_cpuusage = parseLine (line, TOKEN_CPUUSAGE);
}
if (module_inventory == "") {
module_inventory = parseLine (line, TOKEN_INVENTORY);
}
if (module_inventory_interval == "") {
module_inventory_interval = parseLine (line, TOKEN_INVENTORY_INTERVAL);
}
if (module_odbc == "") {
module_odbc = parseLine (line, TOKEN_ODBC);
}
@ -332,6 +342,19 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module = new Pandora_Module_Cpuusage (module_name,
cpu_id);
} else if (module_inventory != "") {
module = new Pandora_Module_Inventory (module_name, module_inventory);
if (module_inventory_interval != "") {
try {
// Convert the interval to seconds...
int interval = strtoint (module_inventory_interval) *60 *60 *24 ;
pandoraDebug("Inventory_interval = %d", interval);
module->setInterval(interval);
} catch (Invalid_Conversion e) {
pandoraLog("Error in conversion of module_inventory_interval");
}
}
} else if (module_odbc != "") {
module = new Pandora_Module_Odbc (module_name,
module_odbc,
@ -427,6 +450,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_name.c_str ());
}
}
if (module != NULL)
{
pandoraDebug("Parsed Moudle: %s\n",module->getName().c_str());
}
return module;
}

View File

@ -0,0 +1,394 @@
/* Pandora Inventory module. These module makes an inventory of the machine where
the agent is instaled.
Copyright (C) 2009 Artica ST.
Written by Pablo de la Concepción.
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_inventory.h"
#include "../windows/pandora_wmi.h"
#include "../pandora_strutils.h"
using namespace Pandora;
using namespace Pandora_Modules;
using namespace Pandora_Strutils;
/**
* Creates a Pandora_Module_Inventory object.
*
* @param name Module name.
*/
Pandora_Module_Inventory::Pandora_Module_Inventory (string name, string options)
: Pandora_Module (name) {
this->setKind (module_inventory_str);
this->options = options;
}
/**
* Run the module and generates the output.
* Depending on the options string makes different querys and gets more or
* less ressults, the possible options are:
* * CPU -> Gets information about the CPUs
* * CDROM -> Gets information about the CDROMs
* * Video -> Gets information about the video cards
* * HDs -> Gets information about the Hard Drives
* * NICs -> Gets information about the Network Interface Controlers
* * Patches -> Gets informaton about the patches installed
* * Software -> Gets information about the MSI packages installed
*/
void
Pandora_Module_Inventory::run () {
list<string> rows;
list<string>::iterator row;
int num_results = 0;
string res;
size_t found;
// Until no data data is gathered there will be no output
this->has_output = false;
pandoraLog("At Inventory - Run\n");
try {
Pandora_Module::run ();
} catch (Interval_Not_Fulfilled e) {
return;
}
found = this->options.find(module_invenory_cdrom_str);
if (found != string::npos){
pandoraDebug(" Launching CDRom Query WMI ... \n");
num_results = Pandora_Wmi::getCdRomInfo(rows);
pandoraLog("Setting Outuput: found %d items\n",num_results);
try {
for (row = rows.begin (); row != rows.end(); ++row) {
this->setOutput (*row,module_invenory_cdrom_str);
this->has_output = true;
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
pandoraLog("Output Error at Moudle Inventory\n");
this->has_output = false;
}
rows.clear();
}
found = this->options.find(module_invenory_video_str);
if (found != string::npos){
pandoraDebug(" Launching Video Query WMI\n");
num_results = Pandora_Wmi::getVideoInfo(rows);
pandoraLog("Setting Outuput: found %d items\n",num_results);
try {
for (row = rows.begin (); row != rows.end(); ++row) {
this->setOutput (*row,module_invenory_video_str);
this->has_output = true;
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
pandoraLog("Output Error at Moudle Inventory\n");
this->has_output = (this->has_output || false);
}
rows.clear();
}
found = this->options.find(module_invenory_hds_str);
if (found != string::npos){
pandoraDebug(" Launching HD Query WMI\n");
num_results = Pandora_Wmi::getHDsInfo(rows);
pandoraLog("Setting Outuput: found %d items\n",num_results);
try {
for (row = rows.begin (); row != rows.end(); ++row) {
this->setOutput (*row,module_invenory_hds_str);
this->has_output = true;
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
pandoraLog("Output Error at Moudle Inventory\n");
this->has_output = (this->has_output || false);
}
rows.clear();
}
found = this->options.find(module_invenory_cpu_str);
if (found != string::npos){
pandoraDebug(" Launching CPUs Query WMI\n");
num_results = Pandora_Wmi::getCPUsInfo(rows);
pandoraLog("Setting Outuput: found %d items\n",num_results);
try {
for (row = rows.begin (); row != rows.end(); ++row) {
this->setOutput (*row,module_invenory_cpu_str);
this->has_output = true;
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
pandoraLog("Output Error at Moudle Inventory\n");
this->has_output = (this->has_output || false);
}
rows.clear();
}
found = this->options.find(module_invenory_nics_str);
if (found != string::npos){
pandoraDebug(" Launching NICs Query WMI\n");
num_results = Pandora_Wmi::getNICsInfo(rows);
pandoraLog("Setting Outuput: found %d items\n",num_results);
try {
for (row = rows.begin (); row != rows.end(); ++row) {
this->setOutput (*row,module_invenory_nics_str);
this->has_output = true;
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
pandoraLog("Output Error at Moudle Inventory\n");
this->has_output = (this->has_output || false);
}
rows.clear();
}
found = this->options.find(module_invenory_patches_str);
if (found != string::npos){
pandoraDebug(" Launching Patch Query WMI\n");
num_results = Pandora_Wmi::getPatchInfo(rows);
pandoraLog("Setting Outuput: found %d items\n",num_results);
try {
for (row = rows.begin (); row != rows.end(); ++row) {
this->setOutput (*row,module_invenory_patches_str);
this->has_output = true;
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
pandoraLog("Output Error at Moudle Inventory\n");
this->has_output = (this->has_output || false);
}
rows.clear();
}
found = this->options.find(module_invenory_ram_str);
if (found != string::npos){
pandoraDebug(" Launching RAM Query WMI\n");
num_results = Pandora_Wmi::getRAMInfo(rows);
pandoraLog("Setting Outuput: found %d items\n",num_results);
try {
for (row = rows.begin (); row != rows.end(); ++row) {
this->setOutput (*row,module_invenory_ram_str);
this->has_output = true;
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
pandoraLog("Output Error at Moudle Inventory\n");
this->has_output = (this->has_output || false);
}
rows.clear();
}
found = this->options.find(module_invenory_software_str);
if (found != string::npos){
pandoraDebug(" Launching Software Query WMI\n");
num_results = Pandora_Wmi::getSoftware(rows);
pandoraLog("Setting Outuput: found %d items\n",num_results);
try {
for (row = rows.begin (); row != rows.end(); ++row) {
this->setOutput (*row,module_invenory_software_str);
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
pandoraLog("Output Error at Moudle Inventory\n");
this->has_output = false;
}
}
//pandoraLog("Inventory - Run finish\n");
}
/**
* 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.
* @overrides Pandora_Module::setOutput (string output)
*/
void
Pandora_Module_Inventory::setOutput (string output) {
Pandora_Data *data;
if (this->inventory_list == NULL)
this->inventory_list = new list<Pandora_Data *> ();
data = new Pandora_Data (output);
this->inventory_list->push_back (data);
this->latest_output = output;
}
/**
* 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 data_origin Origin of the data.
*/
void
Pandora_Module_Inventory::setOutput (string output, string data_origin) {
Pandora_Data *data;
if (this->inventory_list == NULL)
this->inventory_list = new list<Pandora_Data *> ();
data = new Pandora_Data (output, data_origin);
this->inventory_list->push_back (data);
}
/**
* Get the XML output of the inventory.
*
* The output is a element of the TinyXML library. A sample output of
* a module is:
* @verbatim
<inventory>
<inventory_module>
<name>Conexiones abiertas</name>
<type>generic_data</type>
<data>5</data>
<description>Conexiones abiertas</description>
</inventory_module>
...
</inventory>
@endverbatim
* The output has one <inventory_module> tag for each submodule with information
* (i.e. CPU, CDROM, Video, ...)
* @return A pointer to the TiXmlElement if successful which has to be
* freed by the caller. NULL if the XML could not be created.
* @overrides TiXmlElement* Pandora_Module::getXml()
*/
TiXmlElement *
Pandora_Module_Inventory::getXml() {
TiXmlElement *root;
TiXmlElement *element, *inventory_module;
TiXmlElement *inventory_list_element = NULL;
TiXmlElement *data_element;
TiXmlText *text;
string item_clean, data_clean, desc_clean, submodule;
Pandora_Data *data;
pandoraDebug ("Pandora_Module_Inventory::getXML begin\n");
if (!this->has_output || this->inventory_list == NULL) {
return NULL;
}
root = new TiXmlElement ("inventory");
inventory_module = new TiXmlElement("inventory_module");
if (this->inventory_list && this->inventory_list->size () > 1) {
list<Pandora_Data *>::iterator iter;
for (iter = this->inventory_list->begin ();
iter != this->inventory_list->end ();
iter++) {
data = *iter;
if (submodule != data->getDataOrigin()){
if (inventory_list_element != NULL)
{
inventory_module->InsertEndChild (*inventory_list_element);
delete inventory_list_element;
inventory_list_element = NULL;
root->InsertEndChild(*inventory_module);
delete inventory_module;
inventory_module = new TiXmlElement("inventory_module");
}
submodule = data->getDataOrigin();
element = new TiXmlElement ("name");
text = new TiXmlText (submodule);
element->InsertEndChild (*text);
inventory_module->InsertEndChild (*element);
delete element;
delete text;
element = new TiXmlElement ("type");
text = new TiXmlText (this->module_type_str);
element->InsertEndChild (*text);
inventory_module->InsertEndChild (*element);
delete element;
delete text;
inventory_list_element = new TiXmlElement ("datalist");
}
data_element = new TiXmlElement ("data");
element = new TiXmlElement ("value");
try {
data_clean = strreplace (this->getDataOutput (data),
"%", "%%" );
} catch (Output_Error e) {
delete element;
continue;
}
text = new TiXmlText (data_clean);
element->InsertEndChild (*text);
data_element->InsertEndChild (*element);
delete text;
delete element;
element = new TiXmlElement ("timestamp");
text = new TiXmlText (data->getTimestamp ());
element->InsertEndChild (*text);
data_element->InsertEndChild (*element);
delete text;
delete element;
inventory_list_element->InsertEndChild (*data_element);
}
if (inventory_list_element != NULL)
{
inventory_module->InsertEndChild (*inventory_list_element);
delete inventory_list_element;
inventory_list_element = NULL;
}
} else {
data = inventory_list->front ();
element = new TiXmlElement ("data");
try {
data_clean = strreplace (this->getDataOutput (data), "%", "%%" );
text = new TiXmlText (data_clean);
element->InsertEndChild (*text);
inventory_module->InsertEndChild (*element);
delete text;
} catch (Output_Error e) {
}
delete element;
}
element = new TiXmlElement ("description");
text = new TiXmlText (this->module_description);
element->InsertEndChild (*text);
inventory_module->InsertEndChild (*element);
delete text;
delete element;
root->InsertEndChild(*inventory_module);
delete inventory_module;
this->cleanDataList ();
pandoraDebug ("%s Pandora_Module_Inventory::getXML end", module_name.c_str ());
return root;
}

View File

@ -0,0 +1,54 @@
/* Pandora Inventory module. These module makes an inventory of the machine where
the agent is instaled.
Copyright (C) 2009 Artica ST.
Written by Pablo de la Concepción
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_INVENTORY_H__
#define __PANDORA_MODULE_INVENTORY_H__
#include "pandora_module.h"
namespace Pandora_Modules {
const string module_invenory_cpu_str = "CPU";
const string module_invenory_cdrom_str = "CDROM";
const string module_invenory_video_str = "Video";
const string module_invenory_hds_str = "HD";
const string module_invenory_nics_str = "NIC";
const string module_invenory_patches_str = "Patches";
const string module_invenory_software_str = "Software";
const string module_invenory_ram_str = "RAM";
/**
* Module to retrieve the Inventory of the machine.
*/
class Pandora_Module_Inventory : public Pandora_Module {
private:
string options;
public:
Pandora_Module_Inventory (string name, string options);
void run ();
TiXmlElement *getXml ();
void setOutput (string output, string data_origin);
void setOutput (string output);
};
}
#endif

View File

@ -28,6 +28,7 @@
#include "pandora_module_freememory.h"
#include "pandora_module_freememory_percent.h"
#include "pandora_module_cpuusage.h"
#include "pandora_module_inventory.h"
#include "pandora_module_odbc.h"
#include "pandora_module_logevent.h"
#include "pandora_module_wmiquery.h"
@ -79,7 +80,7 @@ Pandora_Modules::Pandora_Module_List::Pandora_Module_List (string filename) {
str_module += buffer + "\n";
}
this->parseModuleDefinition (str_module);
this->parseModuleDefinition (str_module);
}
}
}
@ -139,6 +140,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
Pandora_Module_Freedisk *module_freedisk;
Pandora_Module_Freedisk_Percent *module_freedisk_percent;
Pandora_Module_Cpuusage *module_cpuusage;
Pandora_Module_Inventory *module_inventory;
Pandora_Module_Freememory *module_freememory;
Pandora_Module_Freememory_Percent *module_freememory_percent;
Pandora_Module_Odbc *module_odbc;
@ -192,7 +194,11 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
case MODULE_CPUUSAGE:
module_cpuusage = (Pandora_Module_Cpuusage *) module;
modules->push_back (module_cpuusage);
break;
case MODULE_INVENTORY:
module_inventory = (Pandora_Module_Inventory *) module;
modules->push_back (module_inventory);
break;
case MODULE_ODBC:
module_odbc = (Pandora_Module_Odbc *) module;

View File

@ -27,6 +27,9 @@
#include <sstream>
#include <ctime>
#include <winuser.h>
#include <stdio.h>
#define INVENTORY_FIELD_SEPARATOR
using namespace std;
using namespace Pandora_Wmi;
@ -35,7 +38,7 @@ static LPWSTR
getWmiStr (LPCWSTR computer) {
static WCHAR wmi_str[256];
wcscpy (wmi_str, L"winmgmts:\\\\");
wcscpy (wmi_str, L"winmgmts:{impersonationLevel=impersonate}!\\\\");
if (computer) {
wcsncat (wmi_str, computer, 128);
@ -615,7 +618,7 @@ Pandora_Wmi::stopService (string service_name) {
*/
void
Pandora_Wmi::runWMIQuery (string wmi_query, string column, list<string> &rows) {
CDhInitialize init;
CDhInitialize init;
CDispPtr wmi_svc, quickfixes;
char *value = NULL;
wstring column_w(column.length(), L' ');
@ -645,3 +648,506 @@ Pandora_Wmi::runWMIQuery (string wmi_query, string column, list<string> &rows) {
/**
* Gets all the sofware installed
*
* @param rows List where the query result will be placed.
* @return An int with the number of Results found
*/
int
Pandora_Wmi::getSoftware (list<string> &rows) {
CDhInitialize init;
CDispPtr wmi_svc = NULL, software_list = NULL;
char *name = NULL, *version = NULL;
int num_objects = 0;
try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
if (wmi_svc == NULL) {
pandoraLog("Error getting wmi_svc\n");
}
else {
pandoraLog("wmi_svc is ok\n");
}
dhCheck (dhGetValue (L"%o", &software_list, wmi_svc,
L".ExecQuery(%S)",
L"SELECT * FROM Win32_Product "));
FOR_EACH (software_item, software_list, NULL) {
num_objects++;
dhGetValue (L"%s", &name, software_item,
L".Name");
if (name != NULL) {
rows.push_back (name);
}
dhFreeString (name);
dhGetValue (L"%s", &version, software_item,
L".Version");
if (version != NULL) {
rows.push_back (version);
}
dhFreeString (version);
} NEXT_THROW (software_item);
} catch (string errstr) {
pandoraLog ("runWMIQuery error. %s", errstr.c_str ());
}
return num_objects;
}
/**
* Gets the information about the CDRom
*
* @param rows List where the query result will be placed.
* @return An int with the number of Results found
*/
int
Pandora_Wmi::getCdRomInfo (list<string> &rows) {
CDhInitialize init;
CDispPtr wmi_svc = NULL, cd_info = NULL;
char *name = NULL, *description = NULL, *drive = NULL;
string ret = "";
int num_objects = 0;
try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
if (wmi_svc == NULL) {
pandoraLog("Error getting wmi_svc\n");
}
else {
pandoraLog("wmi_svc is ok\n");
}
dhCheck (dhGetValue (L"%o", &cd_info, wmi_svc,
L".ExecQuery(%S)",
L"SELECT Name, Description, Drive FROM Win32_CDROMDrive "));
FOR_EACH (cd_info_item, cd_info, NULL) {
num_objects++;
dhGetValue (L"%s", &name, cd_info_item,
L".Name");
if (name != NULL) {
ret += name;
}
ret += inventory_field_separator;
dhFreeString(name);
dhGetValue (L"%s", &description, cd_info_item,
L".Description");
if (description != NULL) {
ret += " ";
ret += description;
}
ret += inventory_field_separator;
dhFreeString (description);
dhGetValue (L"%s", &drive, cd_info_item,
L".Drive");
if (drive != NULL) {
ret += " (";
ret += drive;
ret += ")";
}
rows.push_back(ret);
ret.clear();
dhFreeString(drive);
} NEXT_THROW (cd_info_item);
} catch (string errstr) {
pandoraLog ("runWMIQuery error. %s", errstr.c_str ());
}
return num_objects;
}
/**
* Gets the information about the Video Card
*
* @param rows List where the query result will be placed.
* @return An int with the number of Results found
*/
int
Pandora_Wmi::getVideoInfo (list<string> &rows){
CDhInitialize init;
CDispPtr wmi_svc = NULL, video_info = NULL;
char *caption = NULL, *adapter_RAM = NULL, *video_processor = NULL;
string ret = "";
int num_objects = 0;
try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
if (wmi_svc == NULL) {
pandoraLog("Error getting wmi_svc\n");
}
else {
pandoraLog("wmi_svc is ok\n");
}
dhCheck (dhGetValue (L"%o", &video_info, wmi_svc,
L".ExecQuery(%S)",
L"SELECT Caption, AdapterRAM, VideoProcessor FROM Win32_VideoController "));
FOR_EACH (video_info_item, video_info, NULL) {
num_objects++;
dhGetValue (L"%s", &caption, video_info_item,
L".Caption");
if (caption != NULL) {
ret += caption;
}
ret += inventory_field_separator;
dhFreeString(caption);
dhGetValue (L"%s", &adapter_RAM, video_info_item,
L".AdapterRAM");
if (adapter_RAM != NULL) {
double ram_in_mb = atof(adapter_RAM) / 1048576;
ostringstream converter;
converter << ram_in_mb;
pandoraDebug("f:%f s:%s\n",ram_in_mb,adapter_RAM);
ret += " " + converter.str() + " MBytes";
}
ret += inventory_field_separator;
dhFreeString (adapter_RAM);
dhGetValue (L"%s", &video_processor, video_info_item,
L".VideoProcessor");
if (video_processor != NULL) {
ret += video_processor;
}
rows.push_back(ret);
ret.clear();
dhFreeString(video_processor);
} NEXT_THROW (video_info_item);
} catch (string errstr) {
pandoraLog ("runWMIQuery error. %s", errstr.c_str ());
}
return num_objects;
}
/**
* Gets the information about the Hard Drives
*
* @param rows List where the query result will be placed.
* @return An int with the number of Results found
*/
int
Pandora_Wmi::getHDsInfo (list<string> &rows) {
CDhInitialize init;
CDispPtr wmi_svc = NULL, hd_info = NULL;
char *model = NULL, *system_name = NULL;
//long size = 0;
char * size = NULL;
string ret = "";
int num_objects = 0;
try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
if (wmi_svc == NULL) {
pandoraLog("Error getting wmi_svc\n");
}
else {
pandoraLog("wmi_svc is ok\n");
}
dhCheck (dhGetValue (L"%o", &hd_info, wmi_svc,
L".ExecQuery(%S)",
L"SELECT Model, Size, SystemName FROM Win32_DiskDrive "));
FOR_EACH (hd_info_item, hd_info, NULL) {
num_objects++;
dhGetValue (L"%s", &model, hd_info_item,
L".Model");
if (model != NULL) {
ret += model;
}
ret += inventory_field_separator;
dhFreeString(model);
dhGetValue (L"%s", &size, hd_info_item,
L".Size");
if (size != NULL) {
double fsize = atof(size) / 1073741824;
ostringstream converter;
converter << fsize;
pandoraDebug("f:%f s:%s\n",fsize,size);
ret += converter.str() + " GBs";
}
else {
pandoraDebug("Size unknown\n");
}
ret += inventory_field_separator;
dhFreeString (size);
dhGetValue (L"%s", &system_name, hd_info_item,
L".SystemName");
if (system_name != NULL) {
ret += " (";
ret += system_name;
ret += ")";
}
rows.push_back(ret);
ret.clear();
dhFreeString(system_name);
} NEXT_THROW (hd_info_item);
} catch (string errstr) {
pandoraLog ("runWMIQuery error. %s", errstr.c_str ());
}
return num_objects;
}
/**
* Gets the information about the CPUs
*
* @param rows List where the query result will be placed.
* @return An int with the number of Results found
*/
int
Pandora_Wmi::getCPUsInfo (list<string> &rows){
CDhInitialize init;
CDispPtr wmi_svc = NULL, cpu_info = NULL;
char *name = NULL, *speed = NULL, *description = NULL;
// Note speed is an uint32 but it works ok as char *
string ret = "", mhz =" MHz";
int num_objects = 0;
try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
if (wmi_svc == NULL) {
pandoraLog("Error getting wmi_svc\n");
}
else {
pandoraLog("wmi_svc is ok\n");
}
dhCheck (dhGetValue (L"%o", &cpu_info, wmi_svc,
L".ExecQuery(%S)",
L"SELECT Name, MaxClockSpeed, Description FROM Win32_Processor "));
FOR_EACH (cpu_info_item, cpu_info, NULL) {
num_objects++;
dhGetValue (L"%s", &name, cpu_info_item,
L".Name");
if (name != NULL) {
ret += name;
}
ret += inventory_field_separator;
dhFreeString(name);
dhGetValue (L"%s", &speed, cpu_info_item,
L".MaxClockSpeed");
if (speed != NULL) {
ret += speed + mhz;
}
ret += inventory_field_separator;
dhFreeString (speed);
dhGetValue (L"%s", &description, cpu_info_item,
L".Description");
if (description != NULL) {
ret += description;
}
rows.push_back(ret);
ret.clear();
dhFreeString(description);
} NEXT_THROW (cpu_info_item);
} catch (string errstr) {
pandoraLog ("runWMIQuery error. %s", errstr.c_str ());
}
return num_objects;
}
/**
* Gets a string with the IPs from an array of string of IPs
*
* This is a helper to extract the IPs from the result of the WMI query at
* getNICsInfo, that returns a **string with the IPs so this function gets this
* parameter and retunrs a string with all the IPs separated by ' , '
* @param ip_array array of Strings of IPs as returned by the query on getNICsInfo
* @return A string with the IPs separated by ' , '
*/
string
getIPs(VARIANT *ip_array){
UINT i;
VARIANT *pvArray;
string ret = "";
if (V_VT(ip_array) == (VT_ARRAY | VT_VARIANT)) {
if (FAILED(SafeArrayAccessData(V_ARRAY(ip_array), (void **) &pvArray))) {
ret += "";
}
int num_ips = V_ARRAY(ip_array)->rgsabound[0].cElements;
pandoraDebug("Num IPs: %d\n",num_ips);
for (i = 0;i < num_ips;i++) {
if ((i > 0) && (i < num_ips - 1 ))
{
ret += " , ";
}
if (V_VT(&pvArray[i]) == VT_BSTR) {
LPSTR szStringA;
pandoraDebug("String[%u] (original): %S\n", i, V_BSTR(&pvArray[i]));
ret += Pandora_Strutils::strUnicodeToAnsi( V_BSTR(&pvArray[i]));
}
}
SafeArrayUnaccessData(V_ARRAY(ip_array));
}
return ret;
}
/**
* Gets the information about the Network Adapters
*
* @param rows List where the query result will be placed. each row has the
* Caption, MACAddress and IPAddress separated by ;
* @return An int with the number of Results found
*/
int
Pandora_Wmi::getNICsInfo (list<string> &rows) {
CDhInitialize init;
CDispPtr wmi_svc = NULL, nic_info = NULL;
VARIANT ip_addresses;
char *caption = NULL, *mac_address = NULL;
string ret = "";
int num_objects = 0;
try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
if (wmi_svc == NULL) {
pandoraLog("Error getting wmi_svc\n");
}
else {
pandoraLog("wmi_svc is ok\n");
}
dhCheck (dhGetValue (L"%o", &nic_info, wmi_svc,
L".ExecQuery(%S)",
L"SELECT Caption, MACAddress, IPAddress FROM Win32_NetworkAdapterConfiguration "));
FOR_EACH (nic_info_item, nic_info, NULL) {
num_objects++;
dhGetValue (L"%s", &caption, nic_info_item,
L".Caption");
if (caption != NULL) {
ret += caption;
}
dhFreeString(caption);
ret += inventory_field_separator + " MAC: ";
dhGetValue (L"%s", &mac_address, nic_info_item,
L".MACAddress");
if (mac_address != NULL) {
ret += mac_address;
}
dhFreeString (mac_address);
ret += inventory_field_separator + " IP: ";
dhGetValue (L"%v", &ip_addresses, nic_info_item,
L".IPAddress");
if (&ip_addresses != NULL)
{
ret += getIPs(&ip_addresses);
}
VariantClear(&ip_addresses);
rows.push_back(ret);
ret.clear();
} NEXT_THROW (nic_info_item);
} catch (string errstr) {
pandoraLog ("runWMIQuery error. %s", errstr.c_str ());
}
return num_objects;
}
/**
* Gets the information about the Patch Information
*
* @param rows List where the query result will be placed. each row has the
* HotFixID, Description and FixComments separated by ;
* @return An int with the number of Results found
*/
int
Pandora_Wmi::getPatchInfo (list<string> &rows) {
CDhInitialize init;
CDispPtr wmi_svc = NULL, patch_info = NULL;
char *hot_fix_id = NULL, *description = NULL, *comments = NULL;
string ret = "";
int num_objects = 0;
try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
if (wmi_svc == NULL) {
pandoraLog("Error getting wmi_svc\n");
}
else {
pandoraLog("wmi_svc is ok\n");
}
dhCheck (dhGetValue (L"%o", &patch_info, wmi_svc,
L".ExecQuery(%S)",
L"SELECT HotFixID, Description, FixComments FROM Win32_QuickFixEngineering "));
FOR_EACH (patch_info_item, patch_info, NULL) {
num_objects++;
dhGetValue (L"%s", &hot_fix_id, patch_info_item,
L".HotFixID");
if (hot_fix_id != NULL) {
ret += hot_fix_id;
}
ret += inventory_field_separator;
dhFreeString(hot_fix_id);
dhGetValue (L"%s", &description, patch_info_item,
L".Description");
if (description != NULL) {
ret += description;
}
ret += inventory_field_separator;
dhFreeString (description);
dhGetValue (L"%s", &comments, patch_info_item,
L".FixComments");
if (comments != NULL) {
ret += comments;
}
dhFreeString(comments);
rows.push_back(ret);
ret.clear();
} NEXT_THROW (patch_info_item);
} catch (string errstr) {
pandoraLog ("runWMIQuery error. %s", errstr.c_str ());
}
return num_objects;
}
/**
* Gets the information about the RAM
*
* @param rows List where the query result will be placed. each row has the
* Tag, Capacity and Name separated by ;
* @return An int with the number of Results found
*/
int
Pandora_Wmi::getRAMInfo (list<string> &rows) {
CDhInitialize init;
CDispPtr wmi_svc = NULL, ram_info = NULL;
char *tag = NULL, *name = NULL, *capacity = NULL;
string ret = "";
int num_objects = 0;
try {
dhCheck (dhGetObject (getWmiStr (L"."), NULL, &wmi_svc));
if (wmi_svc == NULL) {
pandoraLog("Error getting wmi_svc\n");
}
else {
pandoraLog("wmi_svc is ok\n");
}
dhCheck (dhGetValue (L"%o", &ram_info, wmi_svc,
L".ExecQuery(%S)",
L"SELECT Tag, Capacity, Name FROM Win32_PhysicalMemory "));
FOR_EACH (ram_info_item, ram_info, NULL) {
num_objects++;
dhGetValue (L"%s", &tag, ram_info_item,
L".Tag");
if (tag != NULL) {
ret += tag;
}
ret += inventory_field_separator;
dhFreeString(tag);
dhGetValue (L"%s", &capacity, ram_info_item,
L".Capacity");
if (capacity != NULL) {
double fcapacity = atof(capacity) / 1048576;
ostringstream converter;
converter << fcapacity;
pandoraDebug("f:%f s:%s\n",fcapacity,capacity);
ret += converter.str() + " MBs";
}
else {
pandoraDebug("Capacity unknown\n");
}
ret += inventory_field_separator;
dhFreeString (capacity);
dhGetValue (L"%s", &name, ram_info_item,
L".Name");
if (name != NULL) {
ret += name;
}
rows.push_back(ret);
ret.clear();
dhFreeString(name);
} NEXT_THROW (ram_info_item);
} catch (string errstr) {
pandoraLog ("runWMIQuery error. %s", errstr.c_str ());
}
return num_objects;
}

View File

@ -38,6 +38,7 @@ namespace Pandora_Wmi {
*/
class Pandora_Wmi_Exception : public Pandora_Exception { };
const string inventory_field_separator = "#$|$#";
int isProcessRunning (string process_name);
int isServiceRunning (string service_name);
unsigned long getDiskFreeSpace (string disk_id);
@ -55,6 +56,15 @@ namespace Pandora_Wmi {
void runWMIQuery (string wmi_query,
string var,
list<string> &rows);
int getSoftware (list<string> &rows);
int getCdRomInfo (list<string> &rows);
int getVideoInfo (list<string> &rows);
int getHDsInfo (list<string> &rows);
int getCPUsInfo (list<string> &rows);
int getNICsInfo (list<string> &rows);
int getPatchInfo (list<string> &rows);
int getRAMInfo (list<string> &rows);
};
#endif