On Sun, 29 Apr 2007, Dave Shield wrote: > On 29/04/07, Charles Sprickman <[EMAIL PROTECTED]> wrote: >> I'm wondering if anyone has a nice, simple >> example of implementing "pass" that I could stare at, hack up and >> hopefully learn something. > > See the script 'passtest' (in the 'local' directory of the source tree). > > It's a bit too simplistic, and doesn't handle unusual GETNEXT > requests robustly. (And there's a deplorably lack of comments!) > But it does illustrate the basic technique for implementing > several MIB object (of different types) within a single script.
Great, thanks for pointing that out. And if anyone else has some real-world examples, I'd still love to see them. Let me make sure I'm following this correctly: PLACE=".1.3.6.1.4.1.2021.255" # sets the base OID [snip] # by this point we just match the OID passed in ARGV to a string in our # own OID - ie: a request for .1.3.6.1.4.1.2021.255.1 will return the # answer to the meaning of life, a request for .1.3.6.1.4.1.2021.255.4 # will return "127.0.0.1", etc. case "$RET" in $PLACE.1) echo "string"; echo "life the universe and everything"; exit 0 ;; $PLACE.2.1) echo "integer"; echo "42"; exit 0 ;; $PLACE.2.2) echo "objectid"; echo ".1.3.6.1.4.42.42.42"; exit 0 ;; $PLACE.3) echo "timeticks"; echo "363136200"; exit 0 ;; $PLACE.4) echo "ipaddress"; echo "127.0.0.1" ;; $PLACE.5) echo "counter"; echo "42"; exit 0 ;; $PLACE.6) echo "gauge"; echo "42"; exit 0 ;; *) echo "string"; echo "ack... $RET $REQ"; exit 0 ;; esac I'm I kind of correct? I really don't get what the "-n" option would do, but the piece I quoted above seems to make sense. Thanks, Charles > You'd have to do a bit more analysis of the incoming OID > to handle a table, but the basic ideas are the same. > > Dave > ------------------------------------------------------------------------- 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/ _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users