So ...
Persistence DOES pay off, in case anyone is listening.
For all who use Foundry Load Balancers and wish to download and diff
their configs, below is the code.
The enable password is hardcoded for now --- I will be releasing a
complete patch which will draw the password from an encrypted table in
the database.
Craig .. Thank-you -- Your wait function did the trick, minus a
quickfix, and a couple of additions, which you can check out below.
<?
/* This file is part of JFFNMS
* Copyright (C) <2002-2005> Javier Szyszlican <[EMAIL PROTECTED]>
* This program is licensed under the GNU GPL, full terms in the LICENSE
file
*/
// FOUNDRY-SN-AGENT-MIB Configuration Downloader Implementation
// successful (1), processing (18), timeout (6), bad access (11),
file-not-found (10)
function config_fdry_cc_get ($ip,$rwcommunity,$server,$filename) {
if ($ip && $rwcommunity && $server && $filename) {
$enable = "######";
$oid = ".1.3.6.1.4.1.1991.1.1.2.1";
$result = true;
if ($result==true) {
system("snmpset -c RWcommunity -v 2c $ip '$oid.15.0' s $enable
'$oid.5.0' a $server '$oid.8.0' s $filename '$oid.9.0' i 22", $retval);
sleep (3);
$result = snmp_get($ip,$rwcommunity,"$oid.9");
if ($result==1);
return true;
}
}
return false;
}
function config_fdry_cc_wait ($ip,$rwcommunity,$server,$filename) {
for($i=0; $i < 30; $i++) {
$result = snmp_get($ip, $rwcommunity, "$oid.9");
if ($result == 1) // Complete
logger("Config for $ip Downloaded Successfully : Result is
$result");
return true;
if ($result == 18) { // Still Processing
logger("Processing Config for $ip : Result is $result");
}
if ($result == 6) {
logger("Tftp Timed Out for $ip : Error $result");
return false;
}
if ($result == 10) {
logger("Tftp File Not Found on $server : Error
$result");
return false;
}
} // for
return false;
}
?>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
jffnms-users mailing list
jffnms-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jffnms-users