From 3589f41fea57ae334770a0018e879275c85e2e66 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sun, 8 Apr 2007 22:01:42 +0000 Subject: [PATCH] git-svn-id: http://www.observium.org/svn/observer/trunk@78 61d68cd4-352d-0410-923a-c4978735b2b8 --- poll-interface.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/poll-interface.php b/poll-interface.php index 1a00561ee..2080ffb5e 100755 --- a/poll-interface.php +++ b/poll-interface.php @@ -4,7 +4,9 @@ include("config.php"); include("includes/functions.php"); -$interface_query = mysql_query("SELECT * FROM `interfaces`"); +if($argv[1]) { $where = "WHERE `interface_id` LIKE '%$argv[1]'"; } + +$interface_query = mysql_query("SELECT * FROM `interfaces` $where"); while ($interface = mysql_fetch_array($interface_query)) { $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE device_id = '" . $interface['device_id'] . "'")); @@ -22,6 +24,7 @@ while ($interface = mysql_fetch_array($interface_query)) { $snmp_output = str_replace("\"", "", $snmp_output); echo("Looking at " . $interface['ifDescr'] . " on " . $device['hostname'] . "\n"); + list($ifName, $ifDescr, $ifAdminStatus, $ifOperStatus, $ifAlias, $ifSpeed, $ifDuplex, $ifType, $ifMtu, $ifPhysAddress, $ifHardType) = explode("\n", $snmp_output); $ifDescr = trim(str_replace("\"", "", $ifDescr)); if ($ifDuplex == 3) { $ifDuplex = "half"; } elseif ($ifDuplex == 2) { $ifDuplex = "full"; } else { $ifDuplex = "unknown"; }