Changeset 239 for trunk/system/generators/netwatch.php
- Timestamp:
- Aug 2, 2009, 10:28:58 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/generators/netwatch.php
r235 r239 2 2 3 3 if(isset($_SERVER['REMOTE_ADDR'])) die(); 4 include_once('../../global.php'); 4 include('../../global.php'); 5 include('../routerboard.php'); 6 $Path = array('tool', 'netwatch'); 7 8 $Routerboard = new Routerboard(); 9 $Routerboard->UserName = $Config['MainRouter']['UserName']; 10 $Routerboard->Timeout = $Config['MainRouter']['ConnectTimeout']; 5 11 6 12 $DbResult3 = $Database->query('SELECT DISTINCT (`DHCP`) FROM `NetworkSubnet` WHERE `Member` = 0'); … … 8 14 { 9 15 echo($Router['DHCP']."\n"); 10 $ Commands = array();11 $ Commands[] = '/tool netwatch remove [find]';16 $Routerboard->HostName = $Router['DHCP']; 17 $Items = array(); 12 18 $DbResult = $Database->query('SELECT * FROM `NetworkSubnet` WHERE `DHCP`="'.$Router['DHCP'].'"'); 13 19 while($Subnet = $DbResult->fetch_assoc()) … … 22 28 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 23 29 echo($Name.', '); 24 $ Commands[] = '/tool netwatch add host='.$Interface['LocalIP'].' interval=1m comment='.$Name;30 $Items[] = array('host' => $Interface['LocalIP'], 'interval' => '00:01:00', 'comment' => $Name); 25 31 } 26 32 } 27 $Commands = implode(';', $Commands); 28 $Command = '/usr/bin/ssh -o ConnectTimeout='.$Config['MainRouter']['ConnectTimeout'].' -l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Router['DHCP'].' "'.$Commands.'"'; 29 //echo($Command."\n"); 30 $Output = ''; 31 exec($Command, $Output); 32 print_r($Output); 33 $Routerboard->ListUpdate($Path, array('host', 'interval', 'comment'), $Items); 33 34 echo("\n"); 34 35 }
Note:
See TracChangeset
for help on using the changeset viewer.