Modify User-Defined Action, Function, and Workflow Engines
The following section describes how you can modify the UDA/UDF/workflow engine in Paragon Automation command line interface (CLI).
You can modify the UDA, UDF, or workflow engine using the Paragon Automation CLI, as shown below.
You must run the following bash commands from the primary node of Paragon Automation.
user@paragon-master:/var/local/healthbot# ./healthbot modify-uda-engine --help usage: healthbot modify-uda-engine [-h] (-s SCRIPT | --rollback) [--simulate] optional arguments: -h, --help show this help message and exit -s SCRIPT, --script SCRIPT Run script in UDA engine --rollback, -r Rollback UDA engine to original state --simulate Run script in simulated UDA engine and show output user@paragon-master:/var/local/healthbot# ./healthbot modify-udf-engine --help usage: healthbot modify-udf-engine [-h] (-s SCRIPT | --rollback) [--simulate] [--service SERVICE] optional arguments: -h, --help show this help message and exit -s SCRIPT, --script SCRIPT Run script in UDF engine --rollback, -r Rollback UDF engine to original state --simulate Run script in simulated UDF engine and show output --service SERVICE Modify specific service UDF root@paragon-master:/var/local/healthbot# ./healthbot modify-workflow-engine --help usage: healthbot.py modify-workflow-engine [-h] (-s SCRIPT | --rollback) [--simulate] optional arguments: -h, --help show this help message and exit -s SCRIPT, --script SCRIPT Run script in WORKFLOW engine --rollback, -r Rollback WORKFLOW engine to original state --simulate Run script in simulated WORKFLOW engine and show output
The commands have three main options:
-
Simulate—test a script (and view its output) in the simulated UDA/UDF/workflow engine environment without affecting the running Paragon Automation system
-
Modify—modify the actual UDA/UDF/workflow engine using a script
-
Rollback—revert to the original version of the UDA/UDF/workflow engine
Usage Notes
-
The bash script will run in a container running Ubuntu OS Release 16.04 or 18.04; write the script accordingly.
-
The script must be non-interactive; any questions must be pre-answered. For example, use the ‘-y’ option when installing a package using apt-get.
-
If you prefer to copy the source packages of the dependency modules onto the Paragon Insights server so the engine can manually install them instead of downloading them from the Internet, place the required source packages in the /var/local/healthbot/input directory. Then within your bash script, point to the /input directory. For example, to use a file placed in /var/local/healthbot/input/myfile.txt, set the bash script to access it at /input/myfile.txt.
-
Modifying the UDA/UDF/workflow engine more than once is not an incremental procedure; use a new bash script that includes both the original and new instructions, and re-run the modify procedure using the new script.
-
Modifications to UDA/UDF/workflow engines are applicable in current installation.
Once you upgrade the version, you must run the script to modify UDA/UDF/workflow engines.
The following examples use the UDA engine; these procedures apply equally to the UDF and workflow engines.
The following procedure assumes that you installed Paragon Automation server.
Simulate
Use the simulate feature to test your bash script in the simulated environment, without affecting the running Paragon Insights system.
To simulate modifying the UDA engine:
-
Enter the command
./healthbot modify-uda-engine -s /<path>/<script-file> --simulate
. -
The script runs and the output shows on screen, just as if you entered the script commands yourself.
user@paragon-master:/var/local/healthbot# ./healthbot modify-uda-engine -s /var/tmp/test-script.sh --simulate Running /var/tmp/test-script.sh in simulated alerta engine.. Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB] ... Fetched 4296 kB in 15s (278 kB/s) Reading package lists... Building dependency tree... Reading state information… ...
Modify
When you are satisfied with the simulation results, go ahead with the actual modification procedure.
To modify the UDA engine:
-
Load the desired bash script onto the Paragon Insights server.
-
If your Paragon Insights server is fully up and running, issue the command
./healthbot stop -s alerta
to stop the running services. -
Run the command
./healthbot modify-uda-engine -s /<path>/<script-file>
.user@paragon-master:/var/local/healthbot# ./healthbot modify-uda-engine -s /var/tmp/test-script.sh Running /var/tmp/test-script.sh in simulated alerta engine.. Success! See /tmp/.alerta_modification.log for logs Please restart alerta by issuing './healthbot start --device-group healthbot -s alerta'
-
(Optional) As noted in the output, you can check the log file to further verify the script was loaded successfully.
-
Restart the alerta service using the command
./healthbot start -s alerta
. -
Once complete, verify that the alerta service is up and running using the command
./healthbot status
. -
To verify that the UDA engine has been updated, use the command
./healthbot version -s alerta
and check that the healthot_alerta container is using the<version>-custom
tag.user@paragon-master:/var/local/healthbot# ./healthbot version -s alerta {'alerta': 'healthbot_alerta:2.1.0-custom'}
The UDA engine is now running with the installed dependencies as per the bash script.
Rollback
If you have a need or desire to remove the changes to the engine, you can revert the engine to its original state.
To rollback the UDA engine:
-
Enter the command
./healthbot modify-uda-engine --rollback
.user@paragon-master:/var/local/healthbot# ./healthbot modify-uda-engine --rollback Rolling back alerta engine to original state.. Successfully rolled back alerta engine Please restart alerta by issuing './healthbot start --device-group healthbot -s alerta'
Note that it is not necessary to restart the alerta service at this point.
-
Once complete, verify that the alerta service is up and running using the command
./healthbot status
. -
To verify that the UDA engine has reverted back, use the command
./healthbot version -s alerta
and check that the healthot_alerta container is using the<version>
tag.user@paragon-master:/var/local/healthbot# ./healthbot version -s alerta {'alerta': 'healthbot_alerta:2.1.0'}
The UDA engine is now running in its original state, with no additional installed dependencies.