11. Extend Zipline using scripts

11. Extend Zipline using scripts

Zipline can easily be extended using external scripts in any scripting language. The script that you want to use should be invokable from the command line.

Custom-built external scripts can be executed from within Zipline using the Parameter Test tool. Open the Parameter Test wizard using the Add Parameter Test menu option from the right click menu in the Capture area.

In the previous Parameter Test instance we created, we used the Evaluate Expression option. To trigger an external script, we need to select the External Script option. Use the Browse button to select the external script that you want to use. Basic mathematical or string operations can easily be executed using the Evaluate Expression option. External scripts are recommended for operations that are more complex in nature. Select the parameter that we captured (maxPingResponseTime) to send it to the external script. You can even send additional parameters to the script by listing them in the Command-line suffix box. In this case we send ‘2’ as an additional parameter. The external Tcl script TestStdDeviatioin.tcl records the maxPingResponseTime value somewhere and calculates a standard deviation over the current and past recorded values. If the standard deviation is less than or equal to 2, the script would respond with a ‘1’ indicating that the test passed. If the standard deviation is greater than 2, the script responds with a ‘0’ indicating that the test failed. In case you have pre-built scripts that send alternate pass/fail error codes, you can specify them in the Pass response and the Fail response boxes and Zipline will interpret the results based on your inputs.