Script Example: Setting node geolocation from SNMP

From NetXMS Wiki
Revision as of 15:09, 22 September 2017 by Tomas Kirnak (talk | contribs) (Created page with "Adjust the OIDs in ''SNMPGetValue'' as required. <syntaxhighlight lang="c"> transport = CreateSNMPTransport($node); if (transport == null) { return null; } lat = SNMPGetVa...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Adjust the OIDs in SNMPGetValue as required.

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

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

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

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

return 0;