UserName = $this->System->Config['MainRouter']['UserName']; $Routerboard->Timeout = $this->System->Config['MainRouter']['ConnectTimeout']; $Routerboard->Debug = true; $DbResult3 = $this->Database->query('SELECT DISTINCT (`DHCP`) FROM `NetworkSubnet` WHERE `Configure` = 1'); // WHERE `Member` = 0'); while ($Router = $DbResult3->fetch_assoc()) { echo($Router['DHCP']."\n"); $Routerboard->HostName = $Router['DHCP']; $Items = array(); $DbResult = $this->Database->query('SELECT * FROM `NetworkSubnet` WHERE (`Configure` = 1) AND (`DHCP`="'.$Router['DHCP'].'")'); while ($Subnet = $DbResult->fetch_assoc()) { $I = explode('.', $Subnet['AddressRange']); $I = $I[2]; $DbResult2 = $this->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface`'. ' LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` WHERE CompareNetworkPrefix(INET_ATON(`LocalIP`), INET_ATON("'.$Subnet['AddressRange'].'"), '.$Subnet['Mask'].')'. ' AND (`NetworkDevice`.`Used` = 1) ORDER BY `NetworkInterface`.`LocalIP`'); while ($Interface = $DbResult2->fetch_assoc()) { $Name = $Interface['DeviceName']; if ($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; echo($Name.', '); $Items[] = array('host' => $Interface['LocalIP'], 'interval' => '00:00:10', 'comment' => $Name); } } $Routerboard->ListUpdate($Path, array('host', 'interval', 'comment'), $Items); echo("\n"); } } }