Ignore:
Timestamp:
May 25, 2014, 8:29:03 PM (10 years ago)
Author:
chronos
Message:
  • Přidáno: Záznam změn online stavu dostupnosti rozhraní do tabulky.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php

    r626 r657  
    1515
    1616  // Load netwatch status from all DHCP routers
    17   $DbResult3 = $System->Database->query('SELECT DHCP, AddressRange, Mask FROM `NetworkSubnet` WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP');
     17  $DbResult3 = $System->Database->query('SELECT `DHCP`, `AddressRange`, `Mask` FROM `NetworkSubnet` '.
     18                'WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP');
    1819  while($Subnet = $DbResult3->fetch_assoc())
    1920  {
     
    2627    foreach($List as $Properties)
    2728    {
    28       if($Properties['status'] == 'up')
     29      if($Properties['status'] == 'up') $Online = 1;
     30        else $Online = 0;
     31       
     32      $DbResult = $System->Database->select('NetworkInterface', 'Online', '`LocalIP` = "'.$Properties['host'].'";');
     33      while($DbRow = $DbResult->fetch_assoc())
     34      {
     35        $LastOnline = $DbRow['Online'];
     36        $Interface = $DbRow['NetworkInterface'];
     37       
     38        // Record state changes
     39        if($Online != $LastOnline)
     40        {     
     41          $System->Database->insert('NetworkInterfaceUpDown', array(
     42                  'Interface' => $Interface, 'State' => $Online, 'Time' => TimeToMysqlDateTime($StartTime)));
     43        }
     44      };
     45       
     46      if($Online)
    2947      {
    3048        $DbResult = $System->Database->update('NetworkInterface', '`LocalIP` = "'.$Properties['host'].'"',
Note: See TracChangeset for help on using the changeset viewer.