Changeset 674 for trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php
- Timestamp:
- Jul 21, 2014, 11:09:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php
r671 r674 19 19 echo('Waiting '.$Delay.' seconds...'."\n"); 20 20 sleep($Delay); 21 } print_r($Properties); 22 21 } 23 22 } 24 23 … … 37 36 { 38 37 echo($Device['LocalIP']."\n"); 39 $Routerboard = new Routerboard(); 40 $Routerboard->UserName = $Config['MainRouter']['UserName']; 41 $Routerboard->Timeout = $Config['MainRouter']['ConnectTimeout']; 42 $Routerboard->HostName = $Device['LocalIP']; 43 $Routerboard->Debug = true; 44 $List = $Routerboard->ListGetPrint($Path, array('mac-address', 'signal-strength'), array(), 'stats'); 45 foreach($List as $Properties) 38 $Routerboard = new RouterosAPI(); 39 $Routerboard->Connect($Device['LocalIP'], $Config['API']['UserName'], $Config['API']['Password']); 40 $Routerboard->Write('/interface/wireless/registration-table/getall', false); 41 $Routerboard->Write('=.proplist=signal-strength,mac-address,rx-rate,tx-rate', false); 42 $Routerboard->Write('=stats='); 43 $Read = $Routerboard->Read(false); 44 $Array = $Routerboard->ParseResponse($Read); 45 foreach($Array as $Properties) 46 46 { 47 print_r($Properties);48 47 $DbResult = $System->Database->select('NetworkInterface', 'Id', 'MAC="'.$Properties['mac-address'].'"'); 49 48 if($DbResult->num_rows > 0) … … 52 51 $Interface = $DbRow['Id']; 53 52 } else $Interface = null; 53 54 $Parts = explode('@', $Properties['signal-strength']); 55 $Strength = substr($Parts[0], 0, -3); // without dBm 56 $RateRx = substr($Properties['rx-rate'], 0, -3); // without MHz 57 $RateTx = substr($Properties['tx-rate'], 0, -3); // without MHz 54 58 $System->Database->insert('NetworkSignal', array('MAC' => $Properties['mac-address'], 55 'Value' => $Properties['signal-strength'], 'Time' => $Time, 'Interface' => $Interface)); 59 'Value' => $Strength, 'RateRx' => $RateRx, 'RateTx' => $RateTx, 60 'Time' => TimeToMysqlDateTime($Time), 'Interface' => $Interface)); 56 61 /* 57 62 $DbResult = $System->Database->select('Measure', 'Id', '`Name` = "'.$Properties['mac-address'].'"'); … … 72 77 } 73 78 74 RepeatFunction(60 , 'ReadWirelessRegistration');79 RepeatFunction(60 * 60, 'ReadWirelessRegistration');
Note:
See TracChangeset
for help on using the changeset viewer.