News:

We really need your input in this questionnaire

Main Menu

GPS Directly from SNMP?

Started by zshnet, August 08, 2016, 06:43:27 PM

Previous topic - Next topic

zshnet

Hi all,

We have a bunch of Airfiber 24's which have GPS receivers. They report GPS based on SNMP (one for Lat, one for Long), and I'd love to directly plug that into the geolocation attribute. Is there any way to do this? If not, I'll just use NXshell to take the data and plug it directly.

Thanks,
Zach

tomaskir

You can write a NXSL script which will read the GPS loc and assign it to the node.
I can then be for example a Hook::ConfigurationPoll, or similiar.

Check out the setGeoLocation method of the NXSL "Node" object:
https://wiki.netxms.org/wiki/NXSL:Node

Or, like you mentioned, you can do it with nxshell.

zshnet

Cool! I'll see whether my team thinks that's a good architecture choice. Don't want code in too many places, but I do like NXSL.

On a side-note: Do you know if links are possible on the World Map? Or is it just icons?

Thanks,
Zach

tomaskir

No, world map is geolocation only for now.

There are multiple requests on the forums and in bug-tracer to allow topology and links etc. to diplay on the world map.
As far as I know, Victor said its planed, but I dont think any time soon.

zshnet

Huh. Is there an easy way to find where the world map code exists? I'd be interested in taking a look at what it does, but I'm unfamiliar with the NetXMS code structure. Would I find that in the bug tracker?

Thanks,
Zach

tomaskir

http://git.netxms.org/public/netxms.git?js=1
Development happens in the "develop" branch.

You can find good guides on how to get the client running in Eclipse here on the forums and on the wiki.
Example: https://www.netxms.org/forum/windows/compilation-of-a-netxms-console-in-eclipse/

zshnet

Thanks so much for all your replies! Super helpful, and I appreciate it.

Thanks,
Zach

meshnet

I've found a scripting example here:

https://wiki.netxms.org/wiki/Script_Example:_Setting_node_geolocation_from_SNMP

It reads

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;