From ed12b6f14bb81d4be328d449f39a35bc291a7a35 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Thu, 27 Mar 2008 10:59:10 +0000 Subject: [PATCH] fix interfaces discovery git-svn-id: http://www.observium.org/svn/observer/trunk@207 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/interfaces.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/discovery/interfaces.php b/includes/discovery/interfaces.php index 24da15bae..1860b1c8c 100755 --- a/includes/discovery/interfaces.php +++ b/includes/discovery/interfaces.php @@ -4,7 +4,6 @@ echo("Interfaces : "); -# $cmd = $config['snmpwalk'] . " -O nsq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] . " .1.3.6.1.2.1.2.2.1.2 | sed s/ifDescr.//g | sed s/\ \"/\|\|\"/g | sed s/\ /\|\|/g"; $cmd = $config['snmpwalk'] . " -O nsq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] . " .1.3.6.1.2.1.2.2.1.2"; $interfaces = trim(shell_exec($cmd)); $interfaces = str_replace("\"", "", $interfaces); @@ -32,7 +31,9 @@ if ($nullintf == 0) { if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') { mysql_query("INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('$id','$ifIndex','$ifName')"); - echo("+"); + echo("\n INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','$ifName') \n "); + # Add Interface + echo("+" . mysql_error() . mysql_affected_rows()); } else { # Interface Already Exists echo(".");