Contact Us
+1.831.460.7010

Question:  (by Syed)  My requirement is to get the below index value and need to save in the variable But when i did through SC GUI , it gave the below snippet.

snmptcl::snmpget -vbinds mplsTunnelIndexNextIndex.1 
-rvbinds res -restatus estatus -expectstatus noError \
-expectvalue 2 -reindex eindex -octetstringformat 1 -comments comm\
-context $snmptcl(agent)

but when i try to edit the above script (shown below) and re-run it failed. Also help me to execute in CONSOLE too...
#get mplsTunnelIndexNextIndex.1

set mplsTunnelIndex [snmptcl::snmpget -vbinds
mplsTunnelIndexNextIndex.1 \
-rvbinds res -restatus estatus -expectstatus noError \
-reindex eindex -octetstringformat 1 -comments comm\
-context $snmptcl(agent)]
puts $mplsTunnelIndex
if { $comm != "" } { append results ""\nCOMMENTS: GET on mplsTunnelIndexNextIndex.1; 
Expected value: $mplsTunnelIndex \n$comm" set type "failed" } else { append results "\n \nGET on mplsTunnelIndexNextIndex.1; Expected value: $mplsTunnelIndex \n " set type "passed"
} ::snmptools::scriptcmdtool::writeMessage $type $results set results

Answer One:  (by Sandiyago)  When you generate a command using SC GUI, the generated command always uses the default agent context "handle", i.e., the currently connected agent: $snmptcl(agent)

 

set mplsTunnelIndex [snmptcl::snmpget -vbinds
mplsTunnelIndexNextIndex.1 \
-rvbinds res -restatus estatus -expectstatus noError \
-reindex eindex -octetstringformat 1 -comments comm\
-context $snmptcl(agent)]
>puts $mplsTunnelIndex

This won't work. The returned value is only a status indicating whether the request succeeded or failed. It is not the value of the variable.

The value is contained in the variable 'res' given in the option ""-rvbinds res"". It is a list.

Try:
puts $res

I read SC developer guide, it is often better to just write your own command. In this case I think you can simply do

snmptcl::snmpget mplsTunnelIndexNextIndex.1 value
-context $snmptcl(agent) puts $value

Answer Two:  (by Syed)  Thanks a lot. But still i have the below queries:

1. Similar to snmpget , please let me know how to perform "snmpset"

snmptcl::snmpset mplsTunnelRowstatus.1 5 -context $snmptcl(agent)
puts $value

2. When i try to use the SC console , it is not showing for "snmpget", "snmpset".

Please let me know how the below command should be used in console.

Answer Three:  (by Sandiyago)  

1. snmptcl::snmpset mplsTunnelRowstatus.1 5 -context $snmptcl(agent)

That should work. It should set mplsTunnelRowstatus.1 to value 5. But in order to create a row, you usually need to set other columnar objects in the same 'set' operation.

2. didn't see the command you mentioned in your second query so can't help..

Answer Four:  (by Syed)  When i tried "snmptcl" or "snmpget" help in the SC console , i dint get any help commands related to it.

(SilverCreekMx) 46 % help snmpget
This command is not supported by the help utility. Try "snmpget /?".
SilverCreekMx) 47 % snmpget ?
wrong # args: should be "snmpget test oidlist estat eind vbs args"
(SilverCreekMx) 48 % snmpget /?
wrong # args: should be "snmpget test oidlist estat eind vbs args"
(SilverCreekMx) 49 % snmpget help
wrong # args: should be "snmpget test oidlist estat eind vbs args"

How to see the usage of commands?"

Answer Five:  (by Sandiyago)  The command reference is in SilverCreek developer guide. I found it is very very useful since it has lots of examples.