snmpOID is no longer returning the OID starting with dot

Started by lhpaladin, May 04, 2024, 02:16:56 AM

Previous topic - Next topic

lhpaladin

Hi,

$node.snmpOID
is no longer returning the OID starting with dot (.) , many scripts will need adjustments in version 5.0.
Is it a bug or implementation change?

Filipp Sudanov

This is intended change. We keep list of breaking changes in the documentation, it's worth checking prior to upgrade:
https://www.netxms.org/documentation/adminguide/installation.html#major-changes-between-releases

lhpaladin


gkaudewitz

Does this mean, that using OIDs in SNMP-requests as functionparameter also have to be done without leading "."?

What is the behavior if result of a SNMP-request is an OID itsself? Is this value returned without leading "."?

Filipp Sudanov

NXSL functions accept OIDs both with and without the leading dot. Returned values are without the dot. So both of below lines will print "System description: 1.3.6.1.4.1.14988.1"

println("System description: " .. $node.createSNMPTransport()?.getValue(".1.3.6.1.2.1.1.2.0") );
println("System description: " .. $node.createSNMPTransport()?.getValue("1.3.6.1.2.1.1.2.0") );


?. is safe dereference which appeared in 5.0 - should createSNMPTransport() return null, this will not produce script error.