On Mon, Jun 21, 2004 at 02:37:01PM -0400, Jason Humes wrote:
> Here is what I've got so far.  First off, do I actually put in the host_id#
> of the particular host I want to use this for, or just leave $host_id?
Host_id is a counter used internally to mean a particular host.  The
first host gets number 1, next is 2 etc

> Second, what is the purpose of the case 10 and case 11 statements?  How does
> JFFNMS know to use the first OID or the default OID (maybe using the
> $host_id field?)?  Thanks...
The code looks like it would give a syntax error. I don't think or
at least I do not recommend you can assign into a switch.
The switch is saying if host_id is 10, 11 or 12. You've hard-coded the
id into the code. OK for you but a bad idea in general.

Perhaps

  if ($host_id == 10 || $host_id == 11 || $host_id == 12) {
      $ifDescr = snmp_walk("$ip","$rocommunity",".1.3.6.1.2.1.2.2.1.1");
  } else {
      $ifDescr = snmp_walk("$ip","$rocommunity",".1.3.6.1.2.1.2.2.1.2");
  }

Syntactically correct, but still not ideal. Let's rephrase what you
are trying to do.
  "For a particular type of device, use a different interface description"
 
In the SNMP world Type of device -> the sysObjectID 
So go get the system.sysObjectID.0 object, or snmpwalk system
to get it, it will be something like:
  .1.3.6.4.1.1.1872.1.6
It *will* be different from 1872 onwards, unless you are doing this on
an Alteon AD3.

So get the sysobjectid and check that

  $sysobjid = snmp_get($ip, $rocommunity, '.1.3.6.1.2.1.1.2.0');
  if ($sysobjid == 'your oid goes here') {
      $ifDescr = snmp_walk("$ip","$rocommunity",".1.3.6.1.2.1.2.2.1.1");
  } else {
      $ifDescr = snmp_walk("$ip","$rocommunity",".1.3.6.1.2.1.2.2.1.2");
  }

Then, as long as the system object id stays the same (or you check for
multiple oids) any device of that type will be handled that way.

 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
Eye-Net Consulting http://www.enc.com.au/   MIEE         Debian developer
csmall at : enc.com.au                      ieee.org           debian.org


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
jffnms-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jffnms-users

Reply via email to