2010-05-25 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/DB.pm: Added functions to get the id of an OS, a
          module and a group (needed by pandora_manage.pl).

        * lib/PandoraFMS/Core.pm: Removed tagente_estado.status from the
          keep_alive_nd query.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2794 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2010-05-25 11:56:37 +00:00
parent e2f00bc59d
commit ce265ad792
3 changed files with 41 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2010-05-25 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/DB.pm: Added functions to get the id of an OS, a
module and a group (needed by pandora_manage.pl).
* lib/PandoraFMS/Core.pm: Removed tagente_estado.status from the
keep_alive_nd query.
2010-05-24 Sergio Martin <sergio.martin@artica.es>
* util/plugin/snmp_process.pl: Changed the

View File

@ -1205,8 +1205,7 @@ sub pandora_module_keep_alive_nd {
AND tagente.disabled = 0
AND tagente_modulo.id_tipo_modulo = 100
AND tagente_modulo.disabled = 0
AND tagente_estado.datos = 1
AND tagente_estado.estado = 0
AND tagente_estado.datos = 1
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND ( tagente_estado.utimestamp + (tagente.intervalo * 2) < UNIX_TIMESTAMP())');

View File

@ -41,6 +41,8 @@ our @EXPORT = qw(
get_module_id
get_nc_profile_name
get_server_id
get_group_id
get_os_id
is_group_disabled
);
@ -96,6 +98,26 @@ sub get_server_id ($$$) {
return defined ($rc) ? $rc : -1;
}
##########################################################################
## Return group ID given the group name.
##########################################################################
sub get_group_id ($$) {
my ($dbh, $group_name) = @_;
my $rc = get_db_value ($dbh, "SELECT id_grupo FROM tgrupo WHERE nombre = ?", $group_name);
return defined ($rc) ? $rc : -1;
}
##########################################################################
## Return OS ID given the OS name.
##########################################################################
sub get_os_id ($$) {
my ($dbh, $os_name) = @_;
my $rc = get_db_value ($dbh, "SELECT id_os FROM tconfig_os WHERE name = ?", $os_name);
return defined ($rc) ? $rc : -1;
}
##########################################################################
## SUB dame_agente_nombre (id_agente)
## Return agent name, given "id_agente"
@ -116,6 +138,16 @@ sub get_module_name ($$) {
return get_db_value ($dbh, "SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ?", $module_id);
}
##########################################################################
## Return module id given the module name and agent id.
##########################################################################
sub get_agent_module_id ($$$) {
my ($dbh, $module_name, $agent_id) = @_;
my $rc = get_db_value ($dbh, "SELECT id_agente_modulo FROM tagente_modulo WHERE nombre = ? AND id_agente = ?", $module_name, $agent_id);
return defined ($rc) ? $rc : -1;
}
##########################################################################
## Returns true if the given group is disabled, false otherwise.
##########################################################################