RE: Help with exec and pass

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On Mon, 2005-10-17 at 10:38 +0200, Santanu Misra wrote: 
>  I am going to post the dummies how to on that. You
> are welcome to make your comments on that.

Oh, you foolish, foolish person!
You really shouldn't make suggestions like that :-)

>  Here is the draft.


> 1. It should always reply with 3(three) sets of DATA
> 	-> The OID
> 	-> The Type (String or integer)

A "pass" script can return more than just string or
(signed) integer values.  There are about eight or
nine recognised types.  You've missed the following:

	unsigned
	counter
	octet
	gauge
	objectid
	timetick
	ipaddress

It doesn't support 64-bit counters (unfortunately),
and you can probably safely ignore "opaque".  But
the type returned must match the MIB definition.



> 2. It should not print anything or debug message if there is
>  anything wrong it should just do an exit!!

That's true for  GET/GETNEXT requests.
It doesn't hold for processing SET requests.


> 3. The script should be able to answer to "-g" and "-n" option
>  only when that was passed otherwise do an exit.

Nope - it should also handle "-s", for SET requests.
(I hope that you *have* read the man page!?)


> 4. When it is "-g" it should print the value for the OID it was asked.
> Example:
> 
> # /usr/bin/lmstat.pl -g .1.3.6.1.4.1.9999.1.0.0
> .1.3.6.1.4.1.9999.1.0.0
> string
> QAC_runtime


> 5. When it is "-n" it should print the value for the next OID,
> # /usr/bin/lmstat.pl -n .1.3.6.1.4.1.9999.1.0.0
> .1.3.6.1.4.1.9999.1.0.1

You'd probably be better off illustrating this with the
next scalar-style OID - .1.3.6.1.4.1.9999.1.1.0

It's unlikely that both .1.3.6.1.4.1.9999.1.0.0 and
.1.3.6.1.4.1.9999.1.0.1 would be valid in any sensible MIB.
(In fact, ending with two 0's is unusual, and you'd do
better using ...1.1.0 and ...1.2.0 instead)

> integer
> 0

Note that with "-n", the requested OID need not actually be valid
for a "-g" request.  The following invocations:

	/usr/bin/lmstat.pl -n .1.3.6.1.4.1.9999.1.0.0
	/usr/bin/lmstat.pl -n .1.3.6.1.4.1.9999.1.0.0.0.0.0.0.0.0
	/usr/bin/lmstat.pl -n .1.3.6.1.4.1.9999.1.0.99
	/usr/bin/lmstat.pl -n .1.3.6.1.4.1.9999.1.1

should *all* return the same results (for .1.3.6.1.4.1.9999.1.1.0)



> 6. When the last OID is reached it should exit.

Or anything following.


Dave


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.