2012-11-28 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/Core.pm, lib/PandoraFMS/Tools.pm: Temporal fix to OID translation. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7200 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
420f1dfbb6
commit
37ea4a197a
|
@ -1,3 +1,9 @@
|
|||
2012-11-28 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* lib/PandoraFMS/NetworkServer.pm,
|
||||
lib/PandoraFMS/Core.pm,
|
||||
lib/PandoraFMS/Tools.pm: Temporal fix to OID translation.
|
||||
|
||||
2012-11-28 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* lib/PandoraFMS/Core.pm: Added fired alert count.
|
||||
|
|
|
@ -3540,8 +3540,7 @@ sub pandora_self_monitoring ($$) {
|
|||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND running_by = $my_data_server
|
||||
AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24,100)
|
||||
AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2)");
|
||||
AND estado = 3");
|
||||
$agents_unknown = 0 if (!defined($agents_unknown));
|
||||
}
|
||||
|
||||
|
|
|
@ -330,8 +330,16 @@ sub pandora_query_snmp ($$$) {
|
|||
my $snmp_oid = $module->{"snmp_oid"};
|
||||
return (undef, 0) unless ($snmp_oid ne '');
|
||||
if ($snmp_oid =~ m/[a-zA-Z]/) {
|
||||
$snmp_oid = translate_obj ($dbh, $snmp_oid, $module->{"id_agente_modulo"});
|
||||
return (undef, 1) unless ($snmp_oid ne '');
|
||||
$snmp_oid = translate_obj ($dbh, $snmp_oid, );
|
||||
|
||||
# Could not translate OID, disable the module
|
||||
if (! defined ($snmp_oid) || $snmp_oid eq '') {
|
||||
db_do ($dbh, 'UPDATE tagente_modulo SET disabled = 1 WHERE id_agente_modulo = ?', $module->{"id_agente_modulo"});
|
||||
return (undef, 1);
|
||||
}
|
||||
|
||||
# Update module configuration
|
||||
db_do ($dbh, 'UPDATE tagente_modulo SET snmp_oid = ? WHERE id_agente_modulo = ?', $snmp_oid, $module->{"id_agente_modulo"});
|
||||
}
|
||||
|
||||
my $snmp_timeout = $module->{"max_timeout"} != 0 ? $module->{"max_timeout"} : $pa_config->{"snmp_timeout"};
|
||||
|
|
|
@ -1036,22 +1036,17 @@ sub month_have_days($$) {
|
|||
###############################################################################
|
||||
# Convert a text obj tag to an OID and update the module configuration.
|
||||
###############################################################################
|
||||
sub translate_obj ($$$) {
|
||||
my ($dbh, $obj, $module_id) = @_;
|
||||
sub translate_obj ($$) {
|
||||
my ($dbh, $obj) = @_;
|
||||
|
||||
# SNMP is not thread safe
|
||||
if (defined ($SNMPSem)) {
|
||||
$SNMPSem->down ();
|
||||
my $oid = SNMP::translateObj ($obj);
|
||||
$SNMPSem->up ();
|
||||
|
||||
# Could not translate OID, disable the module
|
||||
if (! defined ($oid)) {
|
||||
db_do ($dbh, 'UPDATE tagente_modulo SET disabled = 1 WHERE id_agente_modulo = ?', $module_id);
|
||||
return '';
|
||||
}
|
||||
|
||||
# Update module configuration
|
||||
db_do ($dbh, 'UPDATE tagente_modulo SET snmp_oid = ? WHERE id_agente_modulo = ?', $oid, $module_id);
|
||||
my $oid = SNMP::translateObj ($obj);
|
||||
if (defined ($SNMPSem)) {
|
||||
$SNMPSem->up ();
|
||||
}
|
||||
|
||||
return $oid;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue