aommen-esristaff

Scripting tasks using the GeoEvent Admin API

Blog Post created by aommen-esristaff Employee on Oct 19, 2016

While working on a project that required the use of thegeoevent extension to send emails based on updates to a hosted feature service, we found that we needed to quickly stop the email output connectors before performing a server restart. To do this you can go through the GeoEvent Manager and manually stop the email output connectors, but this assumes that your GeoEvent admin will always be available when a server restart is needed. Also, many times server maintenance is performed late at night while staff are usually not around. Fortunately, there is a way to script the process of stopping and starting your GeoEvent input and output connectors.  

 

The attached zip file contains a sample script that will stop GeoEvent output connectors whose Name values are contained within a python list. This script requires that you have downloaded and installed the latest ArcREST python site-package which can be accessed on GitHub. The script has been developed to start or stop GeoEvent output connectors but can easily be modified to perform the same actions on input connectors. To get started with the sample script, please do the following:

 

  1. Download and unzip the attached StopGEEOutputs.zip file
  2. Open the StopGEEOutputs.py in your preferred python IDE application
  3. Locate the Input parameters comment and review the input parameter variables:
    1. Update the server variable with your GeoEvent host server name (e.g. myserver.domain.com)
    2. Update the username variable with your GeoEvent admin username
    3. Update the password variable with your GeoEvent password
    4. For runType, enter either stop or start depending on what action you want to perform on the output connectors

 

The outputLst variable stores each output connectors Name value within a python list. The script will loop through the list of Name values and perform either the start or stop action on that specific output connector. First you need to access the Name parameter values, which are in a GUID format, by doing the following:

  1. Open a web browser and log into the GeoEvent Admin API using your GeoEvent admin credentials (e.g. https://myserver.domain.com:6143/geoevent/admin)
    1. Follow the directions to acquire a security token to access the GeoEvent Admin API
  2. Click on the Outputs link located on the top row of menu items
  3. In the list of Outputs, click on an output that will need to be started or stopped
  4. Copy the Name parameter value and paste it into the outputLst (be sure to put quotes around the Name string and separate with commas if adding more than one Name value)
  5. Perform steps 3 and 4 for each applicable output, when complete the outputLst should look similar to the one below
  6. Save your edits when you have finished

 

The script is now ready to run against your GeoEvent Admin API and should stop or start the output connectors you have stored in the python list. You can schedule this script to run on a regular basis or import the arcpy module and create a GP tool. 

 

I hope this helps GeoEvent users with their administrative tasks.

Attachments

Outcomes