PHP Classes

File: Sample.php

Recommend this page to a friend!
  Classes of Max Schmid   Cisco Config Copy   Sample.php   Download  
File: Sample.php
Role: Example script
Content type: text/plain
Description: Usage sample
Class: Cisco Config Copy
Backup Cisco router configuration using SNMP
Author: By
Last change:
Date: 20 years ago
Size: 803 bytes
 

Contents

Class file image Download
<?PHP

require_once dirname(__FILE__).'/ConfigCopy.class.php';


$timeout = 60;
$community = "RWcommunity";
$tftphost = "192.168.1.254";
$dirname = "config-backup/".time()."/";

echo
$dirname,"\n";

/* Create backup Directory */
mkdir("/tftpboot/".$dirname, 0777); // Directory MUST be rwx for all users
chmod("/tftpboot/".$dirname, 0777); // Directory MUST be rwx for all users


/* Create host list */

$device = array (0 => "192.168.1.1", 1 => "192.168.1.2", 2 => "192.168.1.3");

/* Process each host */

$CC = new CiscoConfigCopy();

$cnt_row = count($device);
$cnt=0;
echo
"Processing ",$cnt_row," devices....\n\n";

while(
$cnt < $cnt_row){
       
$CC->do_config_backup($device[$cnt], $community, $timeout, $tftphost, $dirname, $cnt+1);
       
$cnt++;
}


?>