From the Axeda® Platform you can start scripts on connected assets. Scripts can gather data from a variety of sources, such as an asset's environment, Windows Registry, database tables, configuration and log files, and SNMP. You can install these scripts on assets when installing the Axeda Agents or deploy them to the assets from the Service or Software Management applications.
You can start a script by selecting to run it in the Scripts module on an Asset dashboard. In addition, you can start a script through a configured business rule (rule_action_run_script) from the Rules module on an Asset dashboard. When it receives the command from the Axeda® Platform to start a script, the Axeda Agent executes the [RUN] lines of the script in sequential order (or all lines, if sections are not defined) and sends a status message back to the Platform.
If the script was configured to save information or script results to a snapshot file (XML format), the asset creates that file and uploads it to the server. You can view uploaded snapshot files from the Asset dashboard Uploaded Files list, or from Software Management - Uploaded Files page. The snapshot file is shown in the Axeda Snapshot Viewer.
An Axeda Agent sends its list of registered scripts to the Platform each time it starts or as instructed from the Axeda® Connected Product Management Applications. This communication ensures the Platform knows the scripts currently registered with the asset. Scripts are registered by name, and each script must have a unique, case-sensitive name within the related model. If two scripts for a single model have the same name, they are assumed to be the same and the script registered or created last overwrites the original script.
Axeda Applications scripting uses two types of script files:
§ Script sequence files - You create these files in the Scripts tab of the Axeda® Service application, as part of configuring a Software Management package that runs a script, as part of configuring the Agent project using Axeda® Builder, or outside of Axeda Applications in a text editor. A script sequence file points to each script the Axeda Agent will run, and contains the actual sequence in which those scripts should run. When you select to run a script on an asset, it is the script sequence file that you select to run. The sequence file, in turn, starts any scripts defined in the sequence script and available on that asset. One sequence file can contain commands to run multiple scripts. In the script sequence file, you can direct the Axeda Agent to create a snapshot file with asset information. The Agent can then upload the XML file to the Platform for viewing by the Applications users.
§ Script files - You create these scripts outside the Axeda Applications in a text editor or scripting language editor. You can either add them to the server so that you can deploy them to an asset, or include them in the installation of the Axeda Agent on the asset. These scripts are called and run by the commands defined in the sequence script file. You can write these scripts in any scripting language supported by the asset. Axeda Applications includes example scripts written in the Perl language.
When you create a script sequence file from the Service
application, it is available for use on the related asset only. You can
publish the script so that
it is available for deployment to other assets of the same model, or for
configuration as an action (Run
Script).
For information about security for scripts when Delegated Administration
is disabled, refer to Security
for Objects in Axeda® Connected Product Management Applications
and for information about security for these objects when Delegated Administration
is enabled, refer to Security
for Objects in Delegated Administration Units.
When it receives a command to run a script, the Axeda Agent starts the
script and sends status information back to the Platform. This status
information includes the current line number and command being run (line
of the script sequence file). If the script returns errors, the Axeda
Agent sends the error as an event to the Platform and stops running the
script. To notify appropriate personnel that a script has not run properly,
you can configure the script
error event to trigger a notification to an operator at the asset
or to the service technician for that asset.
In addition to starting a script remotely from the Platform, Axeda Applications
scripting supports running any script command locally (at the asset) or
through a Telnet connection to the asset. Examples of additional uses
of scripts include running an asset utility that generates a report and
uploads the report to the Platform or performing maintenance that cleans
up processes that are no longer running and temporary files that are no
longer needed, based on a condition being true.
You can run scripts on a gateway asset and on the assets managed by
(and connected to) a gateway asset. If you create the script sequence
file for the gateway asset using the Service
application, you need to publish the script so that it is available to
the managed assets and then register the script with those assets.
Script results are always returned to the Platform, no matter how the scripts are started. You can view the results through the Service application -- in the Recent Actions module on the Asset dashboard or on the Recent Actions page of the related asset.
Script results include any runtime errors. An example of an error would be if a script could not perform its configured operations. For example, if a script is configured to initiate a file upload and the Axeda Policy Server for the Axeda Agent denies the upload, then the script stops processing and the Agent notifies the Platform that a script error occurred.