Thanks Craig ,,,, Some more questions in-line to your replies.

On Wed, 2007-07-04 at 09:50 +1000, Craig Small wrote:

> Some suggestions, when in doubt print out.
> Print each and every function return value to see what is going on.
> Also I would recommend that use use constants for the SNMP OIDs



Being the uber-novice php coder, I understand the terms you suggested
above, but do not know how to implement that into the script I have.
I used the cisco host_config scripts that came with jffnms. I simply
tried to adjust the $oid variable and then shorten the total command
line down to 3 segments as is this command-line example:

    snmpset -v2c -c private <switch IP> .1.3.6.1.4.1.1991.1.1.2.1.15.0 s
<enable password> .1.3.6.1.4.1.1991.1.1.2.1.5.0 a <TFTP
IP> .1.3.6.1.4.1.1991.1.1.2.1.8.0 s
<targetfile> .1.3.6.1.4.1.1991.1.1.2.1.9.0 i 22

Note: that the enable password portion of the above command is not
needed if you know the RW community name.


> define('FdyBlahServer', '1.2.3.4.5.6.9.0');
> Use single quotes on both of them.
> 
> One thing, you're using the 'a' type for your IP address but both my
> Alteon and Javier's Cisco plugins use a type s maybe give s a go?


Nope. Javier's cisco_cc.inc.php script also calls the IP with an 'a'
--->     snmp_set($ip,$rwcommunity,"$oid.5.999","a",$server); //server


> 
> On Tue, Jul 03, 2007 at 03:34:09PM -0400, Jeffrey Singleton wrote:
> >     // FOUNDRY-SN-AGENT-MIB Configuration Downloader Implementation
> >     //  successful (1), processing (18), timeout (6), bad access (11),
> > file-not-found (10)
> [....]
> 
> >                 $result = snmp_get($ip,$rwcommunity,"$oid.9.0");
> >                 if ($result != 1) return true;
> Hmm, to me that's the wrong result.  You could have a slow switch!
> return value 18 should be ok I believe as it is thinking about it.
> I'd put the status into a logger command, have a look at the Alteon one.


Does the Alteon switches have a similar IOS to the cisco's?
I know the Foundry IOS was modeled after Cisco IOS, so that is why it is
natural to use the cisco as a template for the Foundry device.

Using the command-line I gave ... I can download the config from the
Foundry. So I know the command works (with or without the enable
password portion).
Trick is to get it into PHP form. I was hoping that just removing the
unnecessary lines from the cisco_cc include script and changing the $oid
to the correct OID 
then the ending OID # on each segment of the command would do the trick.



> 
> >         while (($result == 1) and ($i++ < 30)) { 
> >             $result = snmp_get($ip,$rwcommunity,"$oid.9.0");
> >             sleep(2); 
> >         }
> >         if (($result == 1) or (preg_match("/^successful/",$result)))
> > return true; 
> >         return false;
> >     }
> I'd rewrite this, won't it be result=18 if it is thinking about it and
> result 1 means it is finished?
> 
> $i=0
> do {
>   $result = snmp_get($ip,$rwcommunity,"$oid.9.0");
>   // debug("Foundry wait, host is $ip result is $result.\n");
>   if ($result == 1)
>     return true;
>   sleep(2);
> } while ($result == 18 && $i++ < 30);
> return false


Yes ,,,, you are correct....Changed this one around to this.
I don't even need that 'or' statement really, because the Foundry only
gives a # response.


                    function config_fdry_cc_wait ($ip, $rwcommunity,
                $server, $filename)
                {
                        $i = 1;
                        $result = 1;
                        $oid = ".1.3.6.1.4.1.1991.1.1.2.1";
                        while (($result == 18) and ($i++ < 30)) {
                            $result = snmp_get($ip,
                $rwcommunity,"$oid.9.0");
                            sleep(2);
                        }
                        if (($result == 1) or
                (preg_match("/^successful/",$result))) return true;
                        return false;
                    }




> 

-- 
Jeffrey Singleton
Network Systems Administrator (Trusted Source)
Secure Computing Corporation
48000 North Point Parkway
Alpharetta, GA 30022
C: +1 770-820-2909
O: +1 678-904-3694
-------------------------------------------------------------------------
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