Fixed small bug in the new SNMP function (purge all NULL results, etc)

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@65 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
raulmateos 2006-06-29 22:04:17 +00:00
parent 002e112c63
commit a2cf1920b4

View File

@ -3,19 +3,19 @@
# Pandora Network Server # Pandora Network Server
################################################################################## ##################################################################################
# Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com # Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
# Copyright (c) 2005-2006 Artica Soluciones Tecnológicas S.L # Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L
# #
#This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2 # as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version. # of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details. # GNU General Public License for more details.
#You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
################################################################################## ##################################################################################
# Includes list # Includes list
@ -113,10 +113,7 @@ sub pandora_network_subsystem {
# ejecuto el modulo, le doy 15 sec y contino. # ejecuto el modulo, le doy 15 sec y contino.
# si ejecuta bien, grabo datos y estado # si ejecuta bien, grabo datos y estado
# siguiente elemento # siguiente elemento
# Calculate ID Agent from a select where module_type (id_tipo_modulo) > 4 (network modules) # Calculate ID Agent from a select where module_type (id_tipo_modulo) > 4 (network modules)
# Check for MASTER SERVERS only: check another agents if their servers are gone # Check for MASTER SERVERS only: check another agents if their servers are gone
$server_id = dame_server_id($pa_config, $pa_config->{'servername'}, $dbh); $server_id = dame_server_id($pa_config, $pa_config->{'servername'}, $dbh);
$buffer = ""; $buffer = "";
@ -141,7 +138,6 @@ sub pandora_network_subsystem {
} }
$exec_sql2->finish(); $exec_sql2->finish();
} }
# First: Checkout for enabled agents owned by this server # First: Checkout for enabled agents owned by this server
$query_sql2 = "select * from tagente where ( disabled = 0 and id_server = $server_id ) ".$buffer; $query_sql2 = "select * from tagente where ( disabled = 0 and id_server = $server_id ) ".$buffer;
$exec_sql2 = $dbh->prepare($query_sql2); $exec_sql2 = $dbh->prepare($query_sql2);
@ -249,8 +245,12 @@ sub pandora_query_snmp {
# Pass the VarList to getnext building an array of the output # Pass the VarList to getnext building an array of the output
my @OIDINFO = $SESSION->getnext($OIDLIST); my @OIDINFO = $SESSION->getnext($OIDLIST);
$output = $OIDINFO[0]; $output = $OIDINFO[0];
if ((!defined($output)) || ($output eq "")){
$_[4]="1";
} else {
$_[4]="0"; $_[4]="0";
} }
}
# Too much DEBUG for me :-) # Too much DEBUG for me :-)
# logger($pa_config, "SNMP RESULT $snmp_oid $snmp_target - > $output \n",10); # logger($pa_config, "SNMP RESULT $snmp_oid $snmp_target - > $output \n",10);
return $output; return $output;