Ignore:
Timestamp:
Sep 8, 2009, 9:03:14 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Import položek Netwatch z routerboardu do datbáze.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/system/generators/netwatch_import.php

    r247 r248  
    1616  $List = $Routerboard->ListGetPrint($Path, array('host', 'status'));
    1717 
    18   //print_r($List);
    1918  foreach($List as $Properties)
    2019  {
    2120    if(IsAddressInSubnet($Properties['host'], $Subnet['AddressRange'], $Subnet['Mask']))
    2221    {
     22      //echo($Properties['host'].', ');
    2323      if($Properties['status'] == 'up')
    2424      {
     
    3636        $DbResult = $Database->select('NetworkInterface', 'Id', 'LocalIP = "'.$Properties['host'].'"');
    3737        $DbRow = $DbResult->fetch_assoc();
    38         $HostId = $DbRow['Id'];
    39         $DbResult2 = $Database->select('stat_hosts', '*', '(host_id="'.$HostId.'") AND (time = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))');
    40         if($DbResult2->num_rows == 0) $Database->query('REPLACE INTO stat_hosts (host_id, time) VALUES ("'.$HostId.'", DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))');         
    41         $Database->query('UPDATE stat_hosts SET count = count + 1 WHERE (host_id="'.$HostId.'") AND (time = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))');
     38        $InterfaceId = $DbRow['Id'];
     39        $DbResult2 = $Database->select('NetworkInterfaceStat', '*', '(NetworkInterface="'.$InterfaceId.'") AND (Time = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))');
     40        if($DbResult2->num_rows == 0) $Database->query('REPLACE INTO NetworkInterfaceStat (NetworkInterface, Time) VALUES ("'.$InterfaceId.'", DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))');         
     41        $Database->query('UPDATE NetworkInterfaceStat SET Count = Count + 1 WHERE (NetworkInterface="'.$InterfaceId.'") AND (Time = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))');
    4242      }
    4343    }
Note: See TracChangeset for help on using the changeset viewer.