Changeset 248 for trunk/system/generators/netwatch_import.php
- Timestamp:
- Sep 8, 2009, 9:03:14 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/generators/netwatch_import.php
r247 r248 16 16 $List = $Routerboard->ListGetPrint($Path, array('host', 'status')); 17 17 18 //print_r($List);19 18 foreach($List as $Properties) 20 19 { 21 20 if(IsAddressInSubnet($Properties['host'], $Subnet['AddressRange'], $Subnet['Mask'])) 22 21 { 22 //echo($Properties['host'].', '); 23 23 if($Properties['status'] == 'up') 24 24 { … … 36 36 $DbResult = $Database->select('NetworkInterface', 'Id', 'LocalIP = "'.$Properties['host'].'"'); 37 37 $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"))'); 42 42 } 43 43 }
Note:
See TracChangeset
for help on using the changeset viewer.