Hey Craig,

Hold off on answering my questions ... I think I got it.

Here is where I am at now:

fdry_cc.inc.php
---------------------

<?
/* 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, $tmpfname)
{

$tmpfname = tempnam("/jffnms/tftpd", "config");
chmod("$tmpfname", 0777);

        if ($ip && $rwcommunity && $server && $tmpfname) {

            $result = true;

            if ($result==true) {
                print("Starting snmp commands...\n");
                snmp_set($ip,
$rwcommunity,".1.3.6.1.4.1.1991.1.1.2.1.15.0","s","StifLEr");
                snmp_set($ip,
$rwcommunity,".1.3.6.1.4.1.1991.1.1.2.1.5.0","a", "$server");
                snmp_set($ip,
$rwcommunity,".1.3.6.1.4.1.1991.1.1.2.1.8.0","s", "$tmpfname");
                snmp_set($ip,
$rwcommunity,".1.3.6.1.4.1.1991.1.1.2.1.9.0","i","22");
                print("Sleeping for 15 sec...\n");

                sleep (15);

                $result = snmp_get($ip,
$rwcommunity,".1.3.6.1.4.1.1991.1.1.2.1.9.0");

                print_r($result);

                if ($result == 1) return true;

            }
        }
        return false;
    }

    function config_fdry_cc_wait ($ip, $rwcommunity, $server, $tmpfname)
{

        $i = 0;
        do {
          $result = snmp_get($ip,
$rwcommunity,".1.3.6.1.4.1.1991.1.1.2.1.9.0");
          if ($result == 1) return true;
          sleep (2);
        }
        while ($result == 18 && $i++ < 30);
        return false;
}

?>

Results from running above script via cli:
---------------------------------------------------------
$ php tftp_get_host_config.php 
Starting snmp commands...
Sleeping for 15 sec...
114:22:45  :  H   2 : 192.168.19.19 : fdry_cc : Error Storing the file
in DB (15029.47 msec)       < -- Working on this error now!!!
14:22:49  :  H   3 : 192.168.19.17 : cisco_cc : OK same config as last
one (2) (4225.75 msec) < -- No problems with the cisco!!!
14:22:49 TIMES  : Total Time 19265.43 msec.


The config file is being created and filled with data:
----------------------------------------------------------------------
$ ls -l ../tftpd/
total 2
-rwxrwxrwx  1 jffnms  jffnms  2684 Jul  5 14:22 config0jFd82
-rwxrwxrwx  1 jffnms  jffnms  2684 Jul  5 14:06 configlD5aRV
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jffnms-users mailing list
jffnms-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jffnms-users

Reply via email to