Skip to content

script_execution_get

Tech

Returns information about past and current script executions.

Note

A script instance is a script configuration defining start / stop triggers and a specific set of flags and arguments for it to be started with. Each script instance can only run in at most one instance at any given time.

Params

attribute description
filter
Filter
Filter defining what executions to retrieve
pagination*
Pagination
Defines the subset of the filtered results to return

Filter

attribute description
exit_codes
[int]
The exit codes of the script instance. If omitted all exit codes are returned.
include_outdated
bool
Indicates if the result should include executions that were executed with a script source version that has been changed since. If omitted false is assumed.
instances
[Instance]
The script instances whose execution logs should be returned; if omitted all instances of all scripts are returned
states
["running"|"terminating"|"finished"|"killed"]
The states of the script instance. If omitted all states are returned.

Instance

Because instance names are guaranteed to be unique only in the context of a script, the instance_names parameter can only be used in conjunction with the script_name parameter.

attribute description
script_name*
string
The script name
instance_names
[string]
The script instance names; if omitted all instances of the script are returned

Pagination

Selection rules for extracting records from the filtered list:

If limit is a positive nonzero number, select the given number of records following the reference point defined by id_exclusive:

  • If id_exclusive is set, selection starts from the next higher ID.
  • If id_exclusive is missing, selection starts from the lowest available ID.

If limit is a negative nonzero number, select the given number of records preceding the reference point defined by id_exclusive:

  • If id_exclusive is set, selection starts from the next lower ID.
  • If id_exclusive is missing, selection starts from the highest available ID

The records are always sorted by id in descending order.

attribute description
limit*
int; -1000 – 1000
The maximum number of lines to return
id_exclusive
unsigned int
The ID of the result immediately preceding / following the requested result set

Example

{
  "filter": {
    "instances": [
      {
        "script_name": "hello_world",
        "instance_names": ["manual", "verbose"]
      },
      {
        "script_name": "monitor",
        "instance_names": ["verbose"]
      }
    ],
    "states": ["running"]
  },
  "pagination": {
    "limit": -10
  }
}

Return

attribute description
executions*
[Execution]
The script executions that match the filter options

Execution

attribute description
id*
unsigned int
The ID of the script execution
script_name*
string
The name of the script
instance_name*
string
The name of the script instance
start_timestamp*
unsigned int
The Unix timestamp of the start of the script instance
start_trigger*
Start Trigger
The trigger that started the script instance
state*
"running"|"terminating"|"finished"|"killed"
The state of the script instance
arguments
string
The arguments passed to the script instance
duration
unsigned int
The duration of the script instance in milliseconds. If the script is in state running or terminating this field must not be set.
exit_code
int
The exit code of the script instance. If the script is in state running or terminating this field must not be set.
stop_trigger
Stop Trigger
The trigger that stopped the script instance. If the script is in state running this field must not be set.
is_outdated
bool
Indicates whether executed with a script source version that has been changed since.

Start Trigger

attribute description
type*
"manual"|"xpath"
The type of the trigger
setting
string
The configuration of the trigger, not applicable if the type is manual.
username
string
The username of the user that started the script manually, only applicable if the type is manual.

Stop Trigger

attribute description
type*
"manual"|"xpath"|"system"
The type of the trigger
setting
string
The configuration of the trigger, not applicable if the type is manual or system.
username
string
The username of the user that stopped the script manually, only applicable if the type is manual.

Example

{
  "executions": [
    {
      "id": 1234,
      "script_name": "hello_world",
      "instance_name": "verbose",
      "start_timestamp": 1743335196,
      "arguments": "-v --arg1 value1",
      "start_trigger": {
        "type": "xpath",
        "setting": "/networking/eth0"
      },
      "stop_trigger": {
        "type": "system"
      },
      "state": "killed",
      "duration": 60,
      "exit_code": -9
    }
  ]
}