How can i set the default location (latitude ,longitude in asset info) for newly created node

How can I set the default location (latitude, longitude in asset info) for the newly created node?

1 Like


go to asset info and change the configuration. more precisely on the location section

As per your comment, we need to configure the information for all the nodes manually. And I want the default location for all the assets.
Suppose I created one asset and I don’t fill in the asset information, but I want to set the default location for all the assets which I’m going to create.

@Sam not necessarily, if you create a requisition to group all your nodes, you have the asset tab where you will configure the position that will be assigned to all your nodes of this requisition :sweat_smile: :sweat_smile:

1 Like

Thanks a lot, I’m trying to do the same but how we can “create a requisition to group all your nodes”.
I’m able to set the policy to the whole requisition but… Pl guide me.

1 Like

ok! Try to configure requisition

Hello @Sam this link can help you!
https://www.youtube.com/watch?v=GS6INK8a8S0

1 Like

you can utilize filters to group your collection packages.

We have a geoip provisioning adapter in our pipeline and hope we get it ready for H29 :slight_smile:

1 Like

I’m searching the same possibility to add lat/lon to ALL nodes that belong to a requisition in a quick way.
Actually there is no possibility from the Web UI to do it, you can simply add, for every Node, the asset information.
I have updated the asset table via psql, but I didn’t undestand how it is used and when, in order to update the asset info of the nodes, the same for the requisition XML files present in the /opt/opennms/et/imports directory.
May be the asset export, update of the exported file, then import the file could be a working solution, but not a quick one …

You really don’t want to mess with editing the database directly.

The requisition data will overwrite the asset data in the database on next sync. Updating those entries for nodes is best. You can either set address info and enable the geocoder service, or add the lat/long directly. Geo info is per-node, so there isn’t a way to update all nodes at once.

1 Like

Many thanks mmahacek

An utility to sync asset data from requisition to the asset table and viceversa would have been ideal for getting things done quickly.
Anyway the “geographic data / coordinates” could be the same for all devices located in the same place (Server farm), so update this geo data in only “one shot” for many nodes is a real need.
I tried the asset utility (export, added the geo info to all node, import) surely quicker than update hundreds of Nodes by hand via Web Browser but it seems to me that it doesn’t work as I expected.

So I have done a single update to the Requisition so that the related updated Requisition file is created in the directory /opt/opennms/etc/ imports/pending, then I have modified this file with the lat / lon coordinates for all nodes, executed the syncronyze / no scanning of the Requisition.

All nodes now have the coordinates.

Side effects of this “procedure”?

Thanks

Editing the requisition files on disk, especially in pending, is a recipe for corrupting your requisitions. Strongly advise you not to do that.

If you want to set coordinates on everything in the requisition, and it’s all the same coordinates (e.g. your requisition is associated with a physical location), I’d use a scriptPolicy in the foreign source definition, like so:

image

$ cat script-policies/foo.groovy
import org.opennms.netmgt.model.OnmsAssetRecord;
import org.opennms.netmgt.model.OnmsGeolocation;

Double lat = 29.879421482055664;
Double lon = -96.72621307374047;
node.assetRecord.setLongitude(lon);
node.assetRecord.setLatitude(lat);

return node;
1 Like

Many thanks dino2gnt
Why this can/could corrupting the Requisition ?

Is the Requisition file in the pending directory the Requisition stored in the XML file plus the updates done via the Web Interface that haven’t been “synced” yet ?

I don’t understand/know what is the correlation, about the Requisition, between the data in the RDBMS-table, the data in the XML files (/opt/opennms/etc/imports) and the ones in the pending directory, is there a document that explain this ?

Moreover the coordinates used in the “node maps” or in the “Regional status” are the ones stored in the asset RDBMS-table, the same data source used by the “Import and Export Asset Information” utility ? I could also use this method to update quickly the asset, isn’t it ?

Thanks in advance

Basically. But due to caching and the asynchronous nature of provisiond there’s no guarantee that any changes you make to the file will be processed, nor that what is in the file is consistent with the internal cache or the database, if you change things without the application’s knowledge (i.e. outside of the webui or OpenNMS’s API)

Sort of. The requisition is the ultimate source for all of that information; it’s the “source of truth” for nodes and node attributes in OpenNMS. Asset information stored in the database is overwritten by asset information from the requisition; asset information added from the WebUI is overwritten by asset information from the requisition. Any asset info added by any source is superseded by the asset information in the requisition.

Probably not for requisitioned nodes, no: Those asset values would be overwritten on the next sync.

1 Like

Many thanks for the explantion, Dino

The XML file is created in the “pending” directory only after you leave the “Manage Provisioning Requisitions” utility and execute it again.
Therefore, if I exit from the WebUI “Manage Provisioning Requisitions” utility, there should be no caching, asynchronous, conflict, contention or other “side effects”.
Moreover the two date, date-stamp & last-import, in the pending file are global attributes of the requisition not per single node, so if I modify one node via WebUI and the others nodes via editing the pending file, there should be no issue at all.
Is it right or I missing some information ?

Anyway, if there are other possibilities of conflict or missing consistency (How?) I think that the following must be safe:

  • Stop OpenNMS
  • Close the Web Browser
  • Modify the XML file in the pending directory.
  • Start OpenNMS
  • Sync the requisition.

Is it for sure safe in this way ?

OK, I have just done some checks about this, the asset information used are the ones stored in the Requisition, but if a asset information is not present, it is read from the DB/table.
One of check done was with the latitude in the Requisition and the longitude in the DB/table, the
“Regional status” has showed the position of the node in the map “mixing” the two sources for the coordinates (Requisition and DB/table)

Overwritten but only if the asset data exists in the requisition, if it is “null” the asset in the DB/table is not overwritten. So if I decide to use the asset data from the DB/table it is safe and quickly to use the “Import and Export Asset Information” utility. The important thing to know is the order of where data are read, first the Requisition, and, if and only if, it is missing, from the DB/table.
Are correct this assumption ?

Just a clarification for the action “Refresh Deployed Statistics to retrieve the deployed statistics and update the UI.” What statistics is this refferring ?

Thanks in advance :wink:

This here might be something interesting for you GeoIP

It allows to map long/lat by IP ranges.

1 Like

Many thanks Ronny.

It seems the good “tool” for our needs.

Our installation will be without Internet connection (for security reason).
Therefore we use only private IP addresses (as in the example in the GeoIP Provisioning Adapter web page that I have just read) So the question is : will be this adapter work without Internet connection even if we will declare all our subnets in the geoip-adapter-configuration.xml ?

Thanks in advance

Yes of course just drop the geoip database file on the server. In the config you can set a manual rule for the local IP subnet and what long/lat you want to assign. No internet connection required.

1 Like

Thanks again Ronny, I will try this Adapter asap and I will let you know.

Ciao