Geolocation coordinates are not resolved

#1

Problem

OpenNMS provides a mechanism to resolve geo-coordinates from given address information in the nodes asset fields. Nodes with provisioned address information do not resolve longitude and latitude information automatically and the “Node Status Map” keeps empty.

The mechanism to resolve these geo-coordinates is triggered when a Requisition is synchronized from a component called “GeolocationResolver”. The geo-coordinates are not resolved and you will see the following error message in ${OPENNMS_HOME}/logs/karaf.log file which tells you the request to this service is denied:

2019-04-01T12:45:06,264 WARN  org.opennms.features.geolocation.services:23.0.4(216) [pool-11-thread-1] org.opennms.features.geolocation.services.DefaultGeolocationResolver: Couldn't resolve address '950 Windy Rd Suite 300, Apex, North Carolina 27502'
org.opennms.features.geocoder.GeocoderException: Failed to get coordinates for 950 Windy Rd Suite 300, Apex, North Carolina 27502 using Google Geocoder.  Response was: REQUEST_DENIED
	at org.opennms.features.geocoder.google.GoogleGeocoderService.getCoordinates(GoogleGeocoderService.java:134) [213:org.opennms.features.geocoder.google:23.0.4]
	at Proxy31df27c8_6593_451b_bdd6_b231ec27f9af.getCoordinates(Unknown Source) [?:?]
	at org.opennms.features.geolocation.services.DefaultGeolocationResolver.resolve(DefaultGeolocationResolver.java:107) [216:org.opennms.features.geolocation.services:23.0.4]
	at org.opennms.netmgt.provision.GeolocationProvisioningAdapter.updateGeolocation(GeolocationProvisioningAdapter.java:127) [?:?]
	at org.opennms.netmgt.provision.GeolocationProvisioningAdapter.doUpdateNodeInternal(GeolocationProvisioningAdapter.java:113) [?:?]
	at org.opennms.netmgt.provision.GeolocationProvisioningAdapter.doAddNode(GeolocationProvisioningAdapter.java:70) [?:?]
	at org.opennms.netmgt.provision.SimplerQueuedProvisioningAdapter$1.doInTransaction(SimplerQueuedProvisioningAdapter.java:119) [?:?]
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) [?:?]
	at org.opennms.netmgt.provision.SimplerQueuedProvisioningAdapter.processPendingOperationForNode(SimplerQueuedProvisioningAdapter.java:115) [?:?]
	at org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter$AdapterOperation.run(SimpleQueuedProvisioningAdapter.java:423) [?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
2019-04-01T12:45:06,364 WARN  org.opennms.features.geolocation.services:23.0.4(216) [pool-11-thread-1] org.opennms.features.geolocation.services.DefaultGeolocationResolver: Couldn't resolve address '950 Windy Rd Suite 300, Apex, North Carolina 27502'
org.opennms.features.geocoder.GeocoderException: Failed to get coordinates for 950 Windy Rd Suite 300, Apex, North Carolina 27502 using Google Geocoder.  Response was: REQUEST_DENIED
	at org.opennms.features.geocoder.google.GoogleGeocoderService.getCoordinates(GoogleGeocoderService.java:134) [213:org.opennms.features.geocoder.google:23.0.4]
	at Proxy31df27c8_6593_451b_bdd6_b231ec27f9af.getCoordinates(Unknown Source) [?:?]
	at org.opennms.features.geolocation.services.DefaultGeolocationResolver.resolve(DefaultGeolocationResolver.java:107) [216:org.opennms.features.geolocation.services:23.0.4]
	at org.opennms.netmgt.provision.GeolocationProvisioningAdapter.updateGeolocation(GeolocationProvisioningAdapter.java:127) [?:?]
	at org.opennms.netmgt.provision.GeolocationProvisioningAdapter.doUpdateNodeInternal(GeolocationProvisioningAdapter.java:113) [?:?]
	at org.opennms.netmgt.provision.GeolocationProvisioningAdapter.doUpdateNode(GeolocationProvisioningAdapter.java:76) [?:?]
	at org.opennms.netmgt.provision.SimplerQueuedProvisioningAdapter$2.doInTransaction(SimplerQueuedProvisioningAdapter.java:129) [?:?]
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) [?:?]
	at org.opennms.netmgt.provision.SimplerQueuedProvisioningAdapter.processPendingOperationForNode(SimplerQueuedProvisioningAdapter.java:125) [?:?]
	at org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter$AdapterOperation.run(SimpleQueuedProvisioningAdapter.java:423) [?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

Diagnose

By default OpenNMS used the freely available “GoogleGeocoderService”. Unfortunately, this service is not available anymore without an API Key.

Solutions

One solution, Instead of using a geo-coordinate service, you can provide the Longitude and Latitude values as asset fields by yourself and bypass the requirement for this external service.

If you want to resolve the address with an external service you have to pay for the Google Geocoder API and you need a Google API Key.

:biohazard: Nominatim is not available anymore!

When you try to use the Nominatim geocoder by setting a mail address in the ${OPENNMS_HOME}/etc/org.opennms.features.geocoder.nominatim.cfg:

emailAddress=<valid@mail.address>

After restart the Nominatim Geocoder is active but you will get the following error messages in the Karaf log file:

2019-04-01 13:44:01,437 | WARN  | pool-11-thread-1 | DefaultGeolocationResolver       | 216 - org.opennms.features.geolocation.services - 23.0.4 | Couldn't resolve address '950 Windy Rd Suite 300, Apex, North Carolina 27502'
org.opennms.features.geocoder.GeocoderException: Nominatim returned a non-OK response code: 403 Forbidden

The Nominatim Geocoder service requires an API Key as well which can’t be configured in OpenNMS right now.

1 Like