2012-07-27 Miguel de Dios <miguel.dedios@artica.es>

* lib/PandoraFMS/DB.pm: added function "get_agentmodule_data" to
	get some data in a time period from a module.
	
	* lib/PandoraFMS/PredictionServer.pm: into the function
	"exec_prediction_module" avoid to fill the service modules with
	"subtype" SLA because this modules fill automallity after process
	the main modules for the service.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6823 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-27 09:05:16 +00:00
parent 1e3a4d4157
commit c55f83c4ef
3 changed files with 51 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2012-07-27 Miguel de Dios <miguel.dedios@artica.es>
* lib/PandoraFMS/DB.pm: added function "get_agentmodule_data" to
get some data in a time period from a module.
* lib/PandoraFMS/PredictionServer.pm: into the function
"exec_prediction_module" avoid to fill the service modules with
"subtype" SLA because this modules fill automallity after process
the main modules for the service.
2012-07-27 KIKUCHI Koichiro <koichiro@rworks.jp>
* lib/PandoraFMS/Core.pm: fixed bug: added missing decode_entities for

View File

@ -78,6 +78,7 @@ our @EXPORT = qw(
get_agent_status
get_agent_modules
get_agentmodule_status
get_agentmodule_data
);
##########################################################################
@ -234,6 +235,37 @@ sub get_agent_modules ($$$$$) {
return @rows;
}
########################################################################
## SUB get_agentmodule_data (id_agent_module, period, date)
## Return The data for module in a period of time.
########################################################################
sub get_agentmodule_data ($$$$$) {
my ($pa_config, $dbh, $id_agent_module, $period, $date) = @_;
if ($date < 1) {
# Get current timestamp
$date = time ();
}
my $datelimit = $date - $period;
my @rows = get_db_rows($dbh,
"SELECT datos AS data, utimestamp
FROM tagente_datos
WHERE id_agente_modulo = ?
AND utimestamp > ? AND utimestamp <= ?
ORDER BY utimestamp ASC",
$id_agent_module, $datelimit, $date);
#logger($pa_config, "SELECT datos AS data, utimestamp
# FROM tagente_datos
# WHERE id_agente_modulo = " . $id_agent_module . "
# AND utimestamp > " . $datelimit . " AND utimestamp <= " . $date . "
# ORDER BY utimestamp ASC", 1);
return @rows;
}
########################################################################
## SUB get_agentmodule_status (agent_module_id)
## Return agent module status. given "agent_module_id"

View File

@ -156,9 +156,15 @@ sub exec_prediction_module ($$$$) {
# Service modules
if ($agent_module->{'prediction_module'} == 2) {
logger ($pa_config, "Executing service module " . $agent_module->{'nombre'}, 5);
enterprise_hook ('exec_service_module', [$pa_config, $agent_module, $server_id, $dbh]);
logger ($pa_config, "End execution", 5);
if ($agent_module->{'custom_string_1'} eq 'SLA') {
# Do none because the modules for SLA service
# are filled in the service with same id.
}
else {
logger ($pa_config, "Executing service module " . $agent_module->{'nombre'}, 5);
enterprise_hook ('exec_service_module', [$pa_config, $agent_module, $server_id, $dbh]);
logger ($pa_config, "End execution", 5);
}
return;
}