Hi Akshay,
I'm not part of the dev team, but I can give an educated guess as to why it
behaves like that.
As you know, the Unix convention for return status is that if the command
exits normally, it should return 0. It should only return some other number
if the command failed to execute as expected, and in other words the output
will not be complete.
In the case of the timeout, that's a failure to reach the Agent (for
whatever reason), and thus the command is not delivering the requested data
to the user. So it exits with status 1, to indicate that it failed to
provide the requested information.
The other failure you posted (No Such Object), however, is a different
story. Here, there was a response from the Agent, where the Agent is saying
that the requested OID is not available in its MIB view. The snmpget
command prints the response and exits, which is considered normal operation.
So, I think there is a certain logic to it. If there is a response, print
the response and exit with status 0. If there is no response, for some
reason, exit with error status. It doesn't consider what the content of the
response is.
If you need to find out if an error was returned from the Agent, then
you'll have to parse the printed output.
Best regards,
Joel Hansell
On Thu, Mar 13, 2014 at 7:04 AM, Ballarpure, Akshay (EXT-Tata Consultancy
Ser - IN/Hyderabad) <akshay.ballarpure....@nsn.com> wrote:
> Hello,
> I would like to know the response of snmp get in case of failure. We are
> getting zero in most of the success cases.
> If we can get 1 in case of timeout, shall we use value of "$?" as snmp
> success and failure (0 and 1 respectively) on Solaris box ? please reply
> asap. Thanks
>
>
> TCSH02-fm-1# /opt/MOTcagt/bin/snmpget -v3 -u admin -a SHA -A
> 09618538758384384367 -x AES -X 86095694849620176636 -l authPriv
> 27.182.4.222 1.3.6.1.2.1.1.5.0
> SNMPv2-MIB::sysName.0 = STRING: NESIM-60001-ENodeB980
> TCSH02-fm-1# echo $?
> 0
> TCSH02-fm-1# /opt/MOTcagt/bin/snmpget -v3 -u admin -a SHA -A
> 09618538758384384367 -x AES -X 86095694849620176636 -l authPriv
> 27.182.4.222 1.3.6.1.2.1.1.5.01
> SNMPv2-MIB::sysName.1 = No Such Object available on this agent at this OID
> TCSH02-fm-1# echo $?
> 0
> TCSH02-fm-1# /opt/MOTcagt/bin/snmpget -v3 -u admin -a SHA -A
> 09618538758384384367 -x AES -X 86095694849620176636 -l authPriv
> 27.182.18.51 1.3.6.1.2.1.1.5.0
> SNMPv2-MIB::sysName.0 = STRING: TCSH02-fm-sb
> TCSH02-fm-1# /opt/MOTcagt/bin/snmpget -v3 -u admin -a SHA -A
> 09618538758384384367 -x AES -X 86095694849620176636 -l authPriv
> 27.182.18.51 1.3.6.1.2.1.1.5.0
> SNMPv2-MIB::sysName.0 = STRING: TCSH02-fm-sb
> TCSH02-fm-1# /opt/MOTcagt/bin/snmpget -v3 -u admin -a SHA -A
> 09618538758384384367 -x AES -X 86095694849620176636 -l authPriv
> 27.182.18.48 1.3.6.1.2.1.1.5.0
> snmpget: Timeout
> TCSH02-fm-1# echo $?
> 1
>
> --
> With regards,
> Akshay
>
>
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> 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
>
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
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