Ignore:
Timestamp:
Mar 9, 2016, 10:38:13 PM (9 years ago)
Author:
chronos
Message:
  • Added: Linux periodic network ports check command.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Network/Network.php

    r814 r815  
    667667  }
    668668 
    669   function CheckPortStatus($Ip, $Port)
    670   {
    671     $Timeout = 1;
    672     if($Socket = @fsockopen($Ip, $Port, $ErrorNumber, $ErrorString, $Timeout))
    673     {
    674       fclose($Socket);
    675       return(1);
    676     } else
    677     {
    678       return(0);
    679     }
    680   }
    681 
    682669  function PortCheckList($Title, $OnlineNow, $OnlinePrevious, $MinDuration)
    683670  {
     
    687674    $Condition = 'WHERE (`NetworkPort`.`Online` = '.$OnlineNow.') AND (`NetworkPort`.`OnlineNotify` = '.$OnlinePrevious.') '.
    688675      'AND (`NetworkPort`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
    689     $DbResult3 = $this->Database->query('SELECT CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`) AS `Name`, '.
     676    $DbResult3 = $this->Database->query('SELECT CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`, "(", `NetworkPort`.`Name`, ")") AS `Name`, '.
    690677      '`NetworkPort`.`Online`, `NetworkPort`.`LastOnline` FROM `NetworkPort` '.
    691678      'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkPort`.`Interface` '.
     
    694681      '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkPort`.`Enabled` = 1)'.
    695682      'ORDER BY `Name` ASC');
    696     echo($this->Database->LastQuery);
    697683    if($DbResult3->num_rows > 0)
    698684    {
Note: See TracChangeset for help on using the changeset viewer.