Ignore:
Timestamp:
Aug 2, 2009, 10:28:58 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Vylepšena třída Routerboard pro načítání z/do nastavení do routerů Mikrotik.
  • Upraveno: Skripty pro generování DHCP a Netwatch routerů byly upraveny pro použití třídy Routerboar.
  • Upraveno: Zobrazování editačních políček formuláře lépe viditelné v IE8.
File:
1 edited

Legend:

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

    r235 r239  
    22
    33if(isset($_SERVER['REMOTE_ADDR'])) die();
    4 include_once('../../global.php');
     4include('../../global.php');
     5include('../routerboard.php');
     6$Path = array('tool', 'netwatch');
     7
     8$Routerboard = new Routerboard();
     9$Routerboard->UserName = $Config['MainRouter']['UserName'];
     10$Routerboard->Timeout = $Config['MainRouter']['ConnectTimeout'];
    511
    612$DbResult3 = $Database->query('SELECT DISTINCT (`DHCP`) FROM `NetworkSubnet` WHERE `Member` = 0');
     
    814{
    915  echo($Router['DHCP']."\n");
    10   $Commands = array();
    11   $Commands[] = '/tool netwatch remove [find]';
     16  $Routerboard->HostName = $Router['DHCP'];
     17  $Items = array();
    1218  $DbResult = $Database->query('SELECT * FROM `NetworkSubnet` WHERE `DHCP`="'.$Router['DHCP'].'"');
    1319  while($Subnet = $DbResult->fetch_assoc())
     
    2228      if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    2329      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);
    2531    }
    2632  }
    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);   
    3334  echo("\n");
    3435}
Note: See TracChangeset for help on using the changeset viewer.