Follow

How to Associate a Script to an Event

Applies to platform: UTM 3.0, Edge 3.0, UTM 5.0, Edge 5.0
Updated on: 09th November 2017

This lesson shows you how to associate a custom script to an event.

Requirements

To successfully complete this lesson, you need:

  • Access to the Endian Appliance.
  • A python script that must be running successfully in the Endian Appliance.

The script must be written according to the guidelines described in this lesson.

Scenario

In our scenario, the Endian Appliance is connected via VPN to a remote OpenVPN server. The purpose of the script is to prevent the OpenVPN client on the Endian Appliance to try a connection to the remote OpenVPN server until the main uplink is down. In this lesson, we associate the script (called closeVPN.py) created in the lesson linked above to event 20110054 - Uplink is dead.

To let the OpenVPN client reconnect after the uplink is up, associate another suitable script to event 20110066 - Uplink back, following the same procedure described in the remainder of this lesson.

Associate The Script to an Event

Before you associate a script to an event, you need to make sure that it runs and it does not produce an unexpected result. After this has been ensured, you're only a few steps away from your goal.

    1. Upload The Script to Your Endian Appliance.Go to Menubar > System > Event notifications > Scripts and click on Add new script.
      events1.png
    2. In the panel that appears above the list of uploaded scripts, supply a name and a description for the scrips, then click on Browse... to open a file-chooser dialog window and select the script that you want to upload. It is called close.py in the example.
      events2.png
    3.  Click on Add to upload the script.
    4. If the upload completes successfully, click on the Apply button in the green callout, wait a few seconds and you will see your script appear in the list.
      events3.png
    5. Now, go to the Events tab, skim the list of events until you find the event to which you want to associate the script. In the example, the scripts's code is 20110054 Uplink is dead.
      events4.png
    6. Click on the pencil icon on the right-hand side of the table to edit the script. In the panel that opens atop the list, tick the checkbox named Run custom script for this event, then select the script from the drop-down menu that appears on the right-hand side of the panel, and finally click on Change.
      events5.png

To decouple the script from the event, edit the event and untick the checkbox.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments