snmpGET command dynamic update


hi i have script as below:-

If $checkconnection Then

$errorTagstr = $SnmpGet("192.168.1.200","public",".1.3.6.1.2.1.1.1.0","ConnectionOK")
$checkconnection =False

Else
'do nothing

End If


The above scripts work and i can get the some information of an ip camera. but now i have few ip camera and plan use a text-box to type in the ip address and when i click $checkconnection button, i expect the ipaddress to be loaded into the snmp straddress,but i always get error. the snmp cant work. Above works because i hard code the ip address.

So how to syntactically write a script that will automatically replace the ip address into the snmpGet function as the IP address is typed in the textboxtag.

e.g as below:

$SnmpGet("how to load the ipaddress here!!","Public",".1.3.6.1.2.1.1.1.0","ConnectionOK")

i have try this:-

$SnmpGet("[textboxtag] ","Public",".1.3.6.1.2.1.1.1.0","ConnectionOK")

cant work either!! i thought [ ] will evaluate and put the value of the typed ip address.

i try this too:

Dim mystr

mystr = $textboxtag (the textbox will typed 192.168.1.200)


$SnmpGet(mystr,"Public",".1.3.6.1.2.1.1.1.0","ConnectionOK")

how to do this??? i try few thing all give error.

  • Try "public" instead of "Public"

    What error number is returned?

    The following should work assuming textboxtag is a string tag
    $errorTagstr = $SnmpGet($textboxtag,"public",".1.3.6.1.2.1.1.1.0","ConnectionOK")
  • [quote]
    Posted By Norman E on 08 Jul 2020 02:00 PM
    Try "public" instead of "Public"

    What error number is returned?

    The following should work assuming textboxtag is a string tag
    $errorTagstr = $SnmpGet($textboxtag,"public",".1.3.6.1.2.1.1.1.0","ConnectionOK")
    [/quote]


    i was getting a -5 (get operations failed) after used the above method, and it worked after i change Public to public, Thank you.

    previously i did try changing Public to public but maybe because some confusion it didn't work.