Table of Contents

— Anna Dowling 2019/05/17 05:29

Gis Integration

The following wiki details the gis_integration application which handles api calls for transferring kmz files from a specified endpoint to the NocPortal.

Use Case

Extenet wanted to automate the retrieval and storage of kmz files in the NocPortal Previously this was a manual task :

Architecture Diagram

Technology Stack

Key Configuration Points

Cron job Scheduler configurable via /var/spring-boot/gis_integration/application.properties

scheduler.cronTrigger.expression=0 0 3 * * *

Mail Setup for Success / Failure Notifications configurable via /var/spring-boot/gis_integration/application.properties

(Differ per environment - templated in env-configuration)

spring.mail.enabled=true
spring.mail.port=587
spring.mail.host=smtp.gmail.com
spring.mail.username=rightofway@errigal.com
spring.mail.password=#Rightofway321!#

gis.mail.from=kevin.fan@errigal.com
gis.mail.replyTo=support@errigal.com
gis.mail.recipients=kevin.fan@errigal.com

NocPortal API endpoints configurable via /var/spring-boot/gis_integration/application.properties

(Differ per environment - templated in env-configuration)

nocportal.integration.states.url=http://localhost:8080/NocPortal/api/v1/geographicLocation
nocportal.integration.overlay.url=http://localhost:8080/NocPortal/api/v1/mapOverLay
nocportal.integration.upload.timeout=30000
nocportal.api.userName=userapiadmin
nocportal.api.password=notsame1

KMZ File Storage configurable via /var/spring-boot/gis_integration/application.properties

file.directory.location=kmzfiles/
file.directory.retention.period=-7

ArcGis API endpoints configurable via /var/spring-boot/gis_integration/application.properties

(Differ per environment - templated in env-configuration)

remote.timeout=60000
remote.tokenUrl=https://gis.extenetsystems.com/arcgis/tokens/generateToken?httpClient.soTimeout=
remote.username=mzubal_errigal
remote.password=mzubal_errigal123
remote.client=remoteip
remote.expiration=60
remote.request.format=json
remote.request.referer=https://www.arcgis.com
remote.queryUrl=https://gis.extenetsystems.com/arcgis/rest/services/FeaturedContent/Errigal_CL_TEST/MapServer/6/query?where=ProjectState=''&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&returnGeometry=true&returnTrueCurves=false&returnIdsOnly=false&returnCountOnly=false&returnZ=false&returnM=false&returnDistinctValues=false&returnExtentOnly=false&f=kmz
remote.whereQuery=where=ProjectState=''       

NocPortal API

  * GET /api/v1/geographicLocation
  * POST /api/v1/mapOverLay

Log Location

  * /var/spring-boot/gis_integration/gis_integration.log

Prometheus setup

Monitoring is configured for the following servers:

  1. sfqaapps1
  2. qaextapps1
  3. extapps1

Springboot 2 Prometheus Setup

Actuator setup tutorial: https://www.callicoder.com/spring-boot-actuator/

Metrics setup tutorial: https://www.callicoder.com/spring-boot-actuator-metrics-monitoring-dashboard-prometheus-grafana/

Added dependencies to build.gradle:

 compile("org.springframework.boot:spring-boot-starter-actuator")

// Micrometer + Prometheus exporter
compile(group: 'io.micrometer', name: 'micrometer-core')
compile(group: 'io.micrometer', name: 'micrometer-registry-prometheus') 

Added config to application.properties:

# Metrics related configurations
management.endpoint.metrics.enabled=true
management.endpoints.web.exposure.include=*
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true
management.metrics.tags.application=gis_integration

prometheus–monitoring-config:

Troubleshooting

  1. Check failure email for exception - This will be emailed to operations
  2. Check endpoints are reachable (ArcGis and NocPortal)
  3. Restart Application if necessary or wait for the next cron schedule to run.
  4. ensure gis_integration app is running on apps1 handler
  5. Check developer console for errors with KMZ file when loading

EXT GIS Contacts

* Coy Potts cpotts@extenetsystems.com ( No longer part of GIS team)

GIS Endpoint Manual KMZ Download

If for some reason you need to login to the gis application and manually download a state kmz file you can do so as follows:

Login to the following url using the credentials in application.properties (remote.username, remote.password): https://gis.extenetsystems.com/arcgis/rest/services/FeaturedContent/ExteNetFiberAssets_Errigal/MapServer/6/Query

Use the following field population in the form to export the kmz (things to note: ProjectState = 'StateName' & Format = kmz)