Ignore:
Timestamp:
May 25, 2014, 8:29:03 PM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Záznam změn online stavu dostupnosti rozhraní do tabulky.
Location:
trunk/Modules/NetworkConfigRouterOS
Files:
2 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'].'"',
  • trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php

    r617 r657  
    2727  function DoStart()
    2828  {
     29    $this->System->FormManager->RegisterClass('NetworkInterfaceUpDown', array(
     30      'Title' => 'Změny stavu rozhraní',
     31      'Table' => 'NetworkInterfaceUpDown',
     32      'Items' => array(
     33        'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true),
     34        'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'ReadOnly' => true),
     35        'State' => array('Type' => 'Boolean', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),
     36      ),
     37    ));
    2938  }
    3039}
Note: See TracChangeset for help on using the changeset viewer.