Skip to content

Commit

Permalink
Merge pull request librenms#222 from laf/issue-laf-1
Browse files Browse the repository at this point in the history
Fixes for dbInsert / dbUpdate queries
  • Loading branch information
laf committed Jun 11, 2014
2 parents d6b9b56 + 38918c9 commit 8c572b7
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion includes/discovery/cisco-vrf.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
}
else
{
dbInsert(array('`vrf_oid`' => $vrf_oid, '`vrf_name`' => $vrf_name, '`mplsVpnVrfRouteDistinguisher`' => $vrf_rd,'`mplsVpnVrfDescription`' => $descr_table[$vrf_oid], '`device_id`' => $device['device_id']), 'vrfs');
dbInsert(array('vrf_oid' => $vrf_oid, 'vrf_name' => $vrf_name, 'mplsVpnVrfRouteDistinguisher' => $vrf_rd,'mplsVpnVrfDescription' => $descr_table[$vrf_oid], 'device_id' => $device['device_id']), 'vrfs');
}

$vrf_id = dbFetchCell("SELECT vrf_id FROM vrfs WHERE device_id = ? AND `vrf_oid`=?",array($device['device_id'],$vrf_oid));
Expand Down
4 changes: 2 additions & 2 deletions includes/discovery/entity-physical.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
dbUpdate(array('entPhysicalIndex' => $entPhysicalIndex, 'entPhysicalDescr' => $entPhysicalDescr, 'entPhysicalClass' => $entPhysicalClass, 'entPhysicalName' => $entPhysicalName, 'entPhysicalModelName' => $entPhysicalModelName, 'entPhysicalSerialNum' => $entPhysicalSerialNum, 'entPhysicalContainedIn' => $entPhysicalContainedIn, 'entPhysicalMfgName' => $entPhysicalMfgName, 'entPhysicalParentRelPos' => $entPhysicalParentRelPos, 'entPhysicalVendorType' => $entPhysicalVendorType, 'entPhysicalHardwareRev' => $entPhysicalHardwareRev, 'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev, 'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev, 'entPhysicalIsFRU' => $entPhysicalIsFRU, 'entPhysicalAlias' => $entPhysicalAlias, 'entPhysicalAssetID' => $entPhysicalAssetID), 'entPhysical', 'device_id=? AND entPhysicalIndex=?',array($device['device_id'],$entPhysicalIndex));
echo(".");
} else {
dbInsert(array('`device_id`' => $device['device_id'], '`entPhysicalIndex`' => $entPhysicalIndex, '`entPhysicalDescr`' => $entPhysicalDescr,'`entPhysicalClass`' => $entPhysicalClass, '`entPhysicalName`' => $entPhysicalName, '`entPhysicalModelName`' => $entPhysicalModelName, '`entPhysicalSerialNum`' => $entPhysicalSerialNum, '`entPhysicalContainedIn`' => $entPhysicalContainedIn, '`entPhysicalMfgName`' => $entPhysicalMfgName, '`entPhysicalParentRelPos`' => $entPhysicalParentRelPos, '`entPhysicalVendorType`' => $entPhysicalVendorType, '`entPhysicalHardwareRev`' => $entPhysicalHardwareRev, '`entPhysicalFirmwareRev`' => $entPhysicalFirmwareRev, '`entPhysicalSoftwareRev`' => $entPhysicalSoftwareRev, '`entPhysicalIsFRU`' => $entPhysicalIsFRU, '`entPhysicalAlias`' => $entPhysicalAlias, '`entPhysicalAssetID`' => $entPhysicalAssetID, '`ifIndex`' => $ifIndex), '`entPhysical`');
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entPhysicalIndex, 'entPhysicalDescr' => $entPhysicalDescr,'entPhysicalClass' => $entPhysicalClass, 'entPhysicalName' => $entPhysicalName, 'entPhysicalModelName' => $entPhysicalModelName, 'entPhysicalSerialNum' => $entPhysicalSerialNum, 'entPhysicalContainedIn' => $entPhysicalContainedIn, 'entPhysicalMfgName' => $entPhysicalMfgName, 'entPhysicalParentRelPos' => $entPhysicalParentRelPos, 'entPhysicalVendorType' => $entPhysicalVendorType, 'entPhysicalHardwareRev' => $entPhysicalHardwareRev, 'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev, 'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev, 'entPhysicalIsFRU' => $entPhysicalIsFRU, 'entPhysicalAlias' => $entPhysicalAlias, 'entPhysicalAssetID' => $entPhysicalAssetID, 'ifIndex' => $ifIndex), 'entPhysical');
echo("+");
}

Expand All @@ -66,7 +66,7 @@
$id = $test['entPhysicalIndex'];
if (!$valid[$id]) {
echo("-");
dbDelete('`entPhysical`', '`entPhysical_id` = ?', array($test['entPhysical_id']));
dbDelete('entPhysical', 'entPhysical_id = ?', array($test['entPhysical_id']));
}
}

Expand Down
18 changes: 9 additions & 9 deletions includes/discovery/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,14 @@ function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $prec
$descr = trim(str_replace("\"", "", $descr));
if (dbFetchCell("SELECT COUNT(processor_id) FROM `processors` WHERE `processor_index` = ? AND `device_id` = ? AND `processor_type` = ?",array($index,$device['device_id'], $type)) == '0')
{
$inserted = dbInsert(array('`entPhysicalIndex`' => $entPhysicalIndex, '`hrDeviceIndex`' => $hrDeviceIndex, '`device_id`' => $device['device_id'],'`processor_descr`' => $descr, '`processor_index`' => $index, '`processor_oid`' => $oid, '`processor_usage`' => $current, '`processor_type`' => $type, '`processor_precision`' => $precision), 'processors');
$inserted = dbInsert(array('entPhysicalIndex' => $entPhysicalIndex, 'hrDeviceIndex' => $hrDeviceIndex, 'device_id' => $device['device_id'],'processor_descr' => $descr, 'processor_index' => $index, 'processor_oid' => $oid, 'processor_usage' => $current, 'processor_type' => $type, 'processor_precision' => $precision), 'processors');
echo("+");
log_event("Processor added: type ".mres($type)." index ".mres($index)." descr ". mres($descr), $device, 'processor', $inserted);
}
else
{
echo(".");
dbUpdate(array('`processor_descr`' => $descr, '`processor_oid`' => $oid, '`processor_precision`' => $precision), 'processors', '`device_id`=? AND `processor_index`=? AND `processor_type`=?',array($device['device_id'],$index,$type));
dbUpdate(array('processor_descr' => $descr, 'processor_oid' => $oid, 'processor_precision' => $precision), 'processors', '`device_id`=? AND `processor_index`=? AND `processor_type`=?',array($device['device_id'],$index,$type));
if ($debug) { print $query . "\n"; }
}
$valid[$type][$index] = 1;
Expand All @@ -446,14 +446,14 @@ function discover_mempool(&$valid, $device, $index, $type, $descr, $precision =
{
if (dbFetchCell("SELECT COUNT(mempool_id) FROM `mempools` WHERE `mempool_index` = ? AND `device_id` = ? AND `mempool_type` = ?",array($index,$device['device_id'], $type)) == '0')
{
$inserted = dbInsert(array('`entPhysicalIndex`' => $entPhysicalIndex, '`hrDeviceIndex`' => $hrDeviceIndex, '`device_id`' => $device['device_id'],'`mempool_descr`' => $descr, '`mempool_index`' => $index, '`mempool_type`' => $type, '`mempool_precision`' => $precision), 'mempools');
$inserted = dbInsert(array('entPhysicalIndex' => $entPhysicalIndex, 'hrDeviceIndex' => $hrDeviceIndex, 'device_id' => $device['device_id'],'mempool_descr' => $descr, 'mempool_index' => $index, 'mempool_type' => $type, 'mempool_precision' => $precision), 'mempools');
echo("+");
log_event("Memory pool added: type ".mres($type)." index ".mres($index)." descr ". mres($descr), $device, 'mempool', $inserted);
}
else
{
echo(".");
dbUpdate(array('`mempool_descr`' => $descr, '`entPhysicalIndex`' => $entPhysicalIndex, '`hrDeviceIndex`' => $hrDeviceIndex), '`mempools`', 'device_id=? AND mempool_index=? AND mempool_type',array($device['device_id'],$index,$type));
dbUpdate(array('mempool_descr' => $descr, 'entPhysicalIndex' => $entPhysicalIndex, 'hrDeviceIndex' => $hrDeviceIndex), 'mempools', 'device_id=? AND mempool_index=? AND mempool_type',array($device['device_id'],$index,$type));
if ($debug) { print $query . "\n"; }
}
$valid[$type][$index] = 1;
Expand All @@ -469,7 +469,7 @@ function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity
}
if (dbFetchCell("SELECT COUNT(toner_id) FROM `toner` WHERE device_id = ? AND toner_type = ? AND `toner_index` = ? AND `toner_capacity_oid` =?",array($device['device_id'], $type,$index,$capacity_oid)) == '0')
{
$inserted = dbInsert(array('`device_id`' => $device['device_id'], '`toner_oid`' => $oid, '`toner_capacity_oid`' => $capacity_oid, '`toner_index`' => $index, '`toner_type`' => $type, '`toner_descr`' => $descr, '`toner_capacity`' => $capacity, '`toner_current`' => $current), 'toner');
$inserted = dbInsert(array('device_id' => $device['device_id'], 'toner_oid' => $oid, 'toner_capacity_oid' => $capacity_oid, 'toner_index' => $index, 'toner_type' => $type, 'toner_descr' => $descr, 'toner_capacity' => $capacity, 'toner_current' => $current), 'toner');
echo("+");
log_event("Toner added: type ".mres($type)." index ".mres($index)." descr ". mres($descr), $device, 'toner', $inserted);
}
Expand All @@ -482,7 +482,7 @@ function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity
}
else
{
dbUpdate(array('toner_descr' => $descr, 'toner_oid' => $oid, '`toner_capacity_oid`' => $capacity_oid, '`toner_capacity`' => $capacity), 'toner', 'device_id=? AND toner_type=? AND `toner_index`=?',array($device['device_id'],$type,$index));
dbUpdate(array('toner_descr' => $descr, 'toner_oid' => $oid, 'toner_capacity_oid' => $capacity_oid, 'toner_capacity' => $capacity), 'toner', 'device_id=? AND toner_type=? AND `toner_index`=?',array($device['device_id'],$type,$index));
echo("U");
}
}
Expand All @@ -507,22 +507,22 @@ function discover_process_ipv6(&$valid, $ifIndex,$ipv6_address,$ipv6_prefixlen,$
$port_id = dbFetchCell("SELECT port_id FROM `ports` WHERE device_id = ? AND ifIndex = ?",array($device['device_id'], $ifIndex));
if (dbFetchCell("SELECT COUNT(*) FROM `ipv6_networks` WHERE `ipv6_network` = ?",array($ipv6_network)) < '1')
{
dbInsert(array('`ipv6_network`' => $ipv6_network), 'ipv6_networks');
dbInsert(array('ipv6_network' => $ipv6_network), 'ipv6_networks');
echo("N");
}

// Below looks like a duplicate of the above FIXME
if (dbFetchCell("SELECT COUNT(*) FROM `ipv6_networks` WHERE `ipv6_network` = ?",array($ipv6_network)) < '1')
{
dbInsert(array('`ipv6_network`' => $ipv6_network), 'ipv6_networks');
dbInsert(array('ipv6_network' => $ipv6_network), 'ipv6_networks');
echo("N");
}

$ipv6_network_id = dbFetchCell("SELECT `ipv6_network_id` FROM `ipv6_networks` WHERE `ipv6_network = ?",array($ipv6_network));

if (dbFetchCell("SELECT COUNT(*) FROM `ipv6_addresses WHERE `ipv6_address` = ? AND `ipv6_prefixlen` = ? AND `port_id` = ?",array($ipv6_address, $ipv6_prefixlen, $port_id)) == '0')
{
dbInsert(array('`ipv6_address`' => $ipv6_address, '`ipv6_compressed`' => $ipv6_compressed, '`ipv6_prefixlen`' => $ipv6_prefixlen,'`ipv6_origin`' => $ipv6_origin, '`ipv6_network_id`' => $ipv6_network_id, '`port_id`' => $port_id), 'ipv6_addresses');
dbInsert(array('ipv6_address' => $ipv6_address, 'ipv6_compressed' => $ipv6_compressed, 'ipv6_prefixlen' => $ipv6_prefixlen,'ipv6_origin' => $ipv6_origin, 'ipv6_network_id' => $ipv6_network_id, 'port_id' => $port_id), 'ipv6_addresses');
echo("+");
}
else
Expand Down
12 changes: 6 additions & 6 deletions includes/discovery/hr-device.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
{
if (dbFetchCell("SELECT COUNT(*) FROM `hrDevice` WHERE device_id = ? AND hrDeviceIndex = ?",array($device['device_id'], $hrDevice['hrDeviceIndex'])))
{
$update_array = array('`hrDeviceType`' => mres($hrDevice['hrDeviceType']),
'`hrDeviceDescr`' => mres($hrDevice['hrDeviceDescr']),
'`hrDeviceStatus`' => mres($hrDevice['hrDeviceStatus']),
'`hrDeviceErrors`' => mres($hrDevice['hrDeviceErrors']));
$update_array = array('hrDeviceType' => mres($hrDevice['hrDeviceType']),
'hrDeviceDescr' => mres($hrDevice['hrDeviceDescr']),
'hrDeviceStatus' => mres($hrDevice['hrDeviceStatus']),
'hrDeviceErrors' => mres($hrDevice['hrDeviceErrors']));
if ($hrDevice['hrDeviceType'] == "hrDeviceProcessor")
{
$update_array['hrProcessorLoad'] = mres($hrDevice['hrProcessorLoad']);
}
dbUpdate($update_array, '`hrDevice`', 'device_id=? AND hrDeviceIndex=?',array($device['device_id'],$hrDevice['hrDeviceIndex']));
dbUpdate($update_array, 'hrDevice', 'device_id=? AND hrDeviceIndex=?',array($device['device_id'],$hrDevice['hrDeviceIndex']));
echo(".");
}
else
{
$inserted_rows = dbInsert(array('`hrDeviceIndex`' => mres($hrDevice['hrDeviceIndex']), '`device_id`' => mres($device['device_id']), '`hrDeviceType`' => mres($hrDevice['hrDeviceType']),'`hrDeviceDescr`' => mres($hrDevice['hrDeviceDescr']), '`hrDeviceStatus`' => mres($hrDevice['hrDeviceStatus']), '`hrDeviceErrors`' => mres($hrDevice['hrDeviceErrors'])), 'hrDevice');
$inserted_rows = dbInsert(array('hrDeviceIndex' => mres($hrDevice['hrDeviceIndex']), 'device_id' => mres($device['device_id']), 'hrDeviceType' => mres($hrDevice['hrDeviceType']),'hrDeviceDescr' => mres($hrDevice['hrDeviceDescr']), 'hrDeviceStatus' => mres($hrDevice['hrDeviceStatus']), 'hrDeviceErrors' => mres($hrDevice['hrDeviceErrors'])), 'hrDevice');
echo("+");
if ($debug) { print_r($hrDevice); echo("$inserted_rows row inserted"); }
}
Expand Down
6 changes: 3 additions & 3 deletions includes/discovery/ipv4-addresses.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

if (dbFetchCell("SELECT COUNT(*) FROM `ipv4_networks` WHERE `ipv4_network` = ?",array($network)) < '1')
{
dbInsert(array('`ipv4_network`' => $network), 'ipv4_networks');
dbInsert(array('ipv4_network' => $network), 'ipv4_networks');
#echo("Create Subnet $network\n");
echo("S");
}
Expand All @@ -28,7 +28,7 @@

if (dbFetchCell("SELECT COUNT(*) FROM `ipv4_addresses` WHERE `ipv4_address` = ? AND `ipv4_prefixlen` = ? AND `port_id` = ?",array($oid,$cidr,$port_id)) == '0')
{
dbInsert(array('`ipv4_address`' => $oid, '`ipv4_prefixlen`' => $cidr, '`ipv4_network_id`' => $ipv4_network_id,'`port_id`' => $port_id), 'ipv4_addresses');
dbInsert(array('ipv4_address' => $oid, 'ipv4_prefixlen' => $cidr, 'ipv4_network_id' => $ipv4_network_id,'port_id' => $port_id), 'ipv4_addresses');
#echo("Added $oid/$cidr to $port_id ( $hostname $ifIndex )\n $i_query\n");
echo("+");
} else { echo("."); }
Expand All @@ -49,7 +49,7 @@
$query = dbDelete('ipv4_addresses', '`ipv4_address_id` = ?', array($row['ipv4_address_id']));
if (!dbFetchCell("SELECT COUNT(*) FROM `ipv4_addresses` WHERE `ipv4_network_id` = ?",array($row['ipv4_network_id'])))
{
$query = dbDelete('`ipv4_networks`', '`ipv4_network_id` = ?', array($row['ipv4_network_id']));
$query = dbDelete('ipv4_networks', '`ipv4_network_id` = ?', array($row['ipv4_network_id']));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions includes/discovery/libvirt-vminfo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
$result = dbFetchRow("SELECT * FROM `vminfo` WHERE `device_id` = ? AND `vmwVmVMID` = ? AND `vm_type` = 'libvirt'",array($device['device_id'],$dom_id));
if (count($result['device_id']) == 0)
{
$inserted_id = dbInsert(array('`device_id`' => $device['device_id'], '`vm_type`' => 'libvirt', '`vmwVmVMID`' => $dom_id,'`vmwVmDisplayName`' => mres($vmwVmDisplayName), '`vmwVmGuestOS`' => mres($vmwVmGuestOS), '`vmwVmMemSize`' => mres($vmwVmMemSize), '`vmwVmCpus`' => mres($vmwVmCpus), '`vmwVmState`' => mres($vmwVmState)), 'vminfo');
$inserted_id = dbInsert(array('device_id' => $device['device_id'], 'vm_type' => 'libvirt', 'vmwVmVMID' => $dom_id,'vmwVmDisplayName' => mres($vmwVmDisplayName), 'vmwVmGuestOS' => mres($vmwVmGuestOS), 'vmwVmMemSize' => mres($vmwVmMemSize), 'vmwVmCpus' => mres($vmwVmCpus), 'vmwVmState' => mres($vmwVmState)), 'vminfo');
echo("+");
log_event("Virtual Machine added: $vmwVmDisplayName ($vmwVmMemSize MB)", $device, 'vm', $inserted_id);
} else {
Expand All @@ -89,7 +89,7 @@
|| $result['vmwVmGuestOS'] != $vmwVmGuestOS
|| $result['vmwVmMemSize'] != $vmwVmMemSize)
{
dbUpdate(array('vmwVmState' => mres($vmwVmState), '`vmwVmGuestOS' => mres($vmwVmGuestOS), '`vmwVmDisplayName`' => mres($vmwVmDisplayName), '`vmwVmMemSize`' => mres($vmwVmMemSize), '`vmwVmCpus`' => mres($vmwVmCpus)), 'vminfo', "device_id=? AND vm_type='libvirt' AND vmwVmVMID=?",array($device['device_id'],$dom_id));
dbUpdate(array('vmwVmState' => mres($vmwVmState), 'vmwVmGuestOS' => mres($vmwVmGuestOS), 'vmwVmDisplayName' => mres($vmwVmDisplayName), 'vmwVmMemSize' => mres($vmwVmMemSize), 'vmwVmCpus' => mres($vmwVmCpus)), 'vminfo', "device_id=? AND vm_type='libvirt' AND vmwVmVMID=?",array($device['device_id'],$dom_id));
echo("U");
// FIXME eventlog
}
Expand Down
2 changes: 1 addition & 1 deletion includes/discovery/os.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

if ($os != $device['os'])
{
$sql = dbUpdate(array('`os`' => $os), 'devices', 'device_id=?',array($device['device_id']));
$sql = dbUpdate(array('os' => $os), 'devices', 'device_id=?',array($device['device_id']));
echo("Changed OS! : $os\n");
log_event("Device OS changed ".$device['os']." => $os", $device, 'system');
$device['os'] = $os;
Expand Down
4 changes: 2 additions & 2 deletions includes/discovery/ports-stack.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
{
echo(".");
} else {
dbUpdate(array('`ifStackStatus`' => $ifStackStatus), 'ports_stack', 'device_id=? AND port_id_high=? AND `port_id_low`=?',array($device['device_id'],$port_id_high,$port_id_low));
dbUpdate(array('ifStackStatus' => $ifStackStatus), 'ports_stack', 'device_id=? AND port_id_high=? AND `port_id_low`=?',array($device['device_id'],$port_id_high,$port_id_low));
echo("U");
if ($debug) { echo(mysql_error()); }
}
unset($stack_db_array[$port_id_high][$port_id_low]);
} else {
dbInsert(array('`device_id`' => $device['device_id'], '`port_id_high`' => $port_id_high, '`port_id_low`' => $port_id_low,'`ifStackStatus`' => $ifStackStatus), 'ports_stack');
dbInsert(array('device_id' => $device['device_id'], 'port_id_high' => $port_id_high, 'port_id_low' => $port_id_low,'ifStackStatus' => $ifStackStatus), 'ports_stack');
echo("+");
if ($debug) { echo(mysql_error()); }
}
Expand Down
2 changes: 1 addition & 1 deletion includes/discovery/ucd-diskio.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

if (dbFetchCell("SELECT COUNT(*) FROM `ucd_diskio` WHERE `device_id` = ? AND `diskio_index` = ?",array($device['device_id'], $index)) == "0")
{
$inserted = dbInsert(array('`device_id`' => $device['device_id'], '`diskio_index`' => $index, '`diskio_descr`' => $entry['diskIODevice']), 'ucd_diskio');
$inserted = dbInsert(array('device_id' => $device['device_id'], 'diskio_index' => $index, 'diskio_descr' => $entry['diskIODevice']), 'ucd_diskio');
echo("+");
if ($debug) { echo($sql . " - $inserted inserted "); }
}
Expand Down
2 changes: 1 addition & 1 deletion includes/discovery/vmware-vminfo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

if (dbFetchCell("SELECT COUNT(id) FROM `vminfo` WHERE `device_id` = ? AND `vmwVmVMID` = ? AND vm_type='vmware'",array($device['device_id'], $oid)) == 0)
{
dbInsert(array('`device_id`' => $device['device_id'], '`vm_type`' => 'vmware', '`vmwVmVMID`' => $oid,'`vmwVmDisplayName`' => mres($vmwVmDisplayName), '`vmwVmGuestOS`' => mres($vmwVmGuestOS), '`vmwVmMemSize`' => mres($vmwVmMemSize), '`vmwVmCpus`' => mres($vmwVmCpus), '`vmwVmState`' => mres($vmwVmState)), 'vminfo');
dbInsert(array('device_id' => $device['device_id'], 'vm_type' => 'vmware', 'vmwVmVMID' => $oid,'vmwVmDisplayName' => mres($vmwVmDisplayName), 'vmwVmGuestOS' => mres($vmwVmGuestOS), 'vmwVmMemSize' => mres($vmwVmMemSize), 'vmwVmCpus' => mres($vmwVmCpus), 'vmwVmState' => mres($vmwVmState)), 'vminfo');
echo("+");
// FIXME eventlog
} else {
Expand Down
2 changes: 1 addition & 1 deletion includes/snmptrap/linkDown.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
if ($ifOperStatus != $interface['ifOperStatus'])
{
log_event("Interface went Down : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['port_id']);
dbUpdate(array('`ifOperStatus`' => 'down'), 'ports', 'port_id=?',array($interface['port_id']));
dbUpdate(array('ifOperStatus' => 'down'), 'ports', 'port_id=?',array($interface['port_id']));
}

?>
4 changes: 2 additions & 2 deletions includes/snmptrap/linkUp.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
if ($ifAdminStatus != $interface['ifAdminStatus'])
{
log_event("Interface Enabled : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['port_id']);
dbUpdate(array('`ifAdminStatus`' => 'up'), 'ports', 'port_id=?',array($interface['port_id']));
dbUpdate(array('ifAdminStatus' => 'up'), 'ports', 'port_id=?',array($interface['port_id']));
}

if ($ifOperStatus != $interface['ifOperStatus'])
{
log_event("Interface went Up : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['port_id']);
dbUpdate(array('`ifOperStatus`' => 'up'), 'ports', 'port_id=?',array($interface['port_id']));
dbUpdate(array('ifOperStatus' => 'up'), 'ports', 'port_id=?',array($interface['port_id']));
}

?>

0 comments on commit 8c572b7

Please sign in to comment.