Script Example: Setting node geolocation from SNMP

Revision as of 15:53, 5 October 2020 by Phil (talk | contribs)

WARNING: This page is no longer updated. Please visit NetXMS Scripting Language for current version of the documentation.



Adjust the OIDs in SNMPGetValue as required.

transport = CreateSNMPTransport($node);
if (transport == null) {
  return null;
}

lat = SNMPGetValue(transport, ".1.2.3.4.1");
lon = SNMPGetValue(transport, ".1.2.3.4.2");

if (lat == null || lon == null) {
  return null;
}

geoLoc = new GeoLocation(lat, lon);
$node->setGeoLocation(geoLoc);

return 0;