« Back to Product

Documentation

IPS_GetFlowScriptStatistic

 array IPS_GetFlowScriptStatistic (int $ScriptID) 

Parameters

ScriptID

ID of the flow plan

Returns

An array with the following key => value pairs:

Index Type Description
RunCount integer Number of started runs since the start of IP-Symcon
Queued array Queued and running runs (see run table)
Completed array The last (at most 25) finished runs (see run table)

Run table

Index Type Description
RunID integer Consecutive number of the run
QueueTime integer Unix timestamp at which the run was queued
StartTime integer Unix timestamp of the start (0 = not started yet)
CurrentStep array Path to the current step (see step table)
CurrentRetry integer Number of retries of the current step so far
FlowScript string Content of the flow plan (JSON) at the time of the run
Parameters array Parameters of the run as key => value pairs
Status integer Status of the run (see status table)
Executed array Executed steps (see execution table)

Step table

Index Type Description
ActionList string Name of the parameter with the nested action list (empty = top level)
ActionStep integer Index of the action in this action list, starting at 0

Execution table

Index Type Description
Step array Path to the step (see step table)
Executed integer Unix timestamp of the execution
Duration integer Duration of the execution in milliseconds
Success boolean TRUE if the step was successful
Result string Output or error message of the step
Retries integer Number of retries

Status table

Value Description
0 Queued
1 Running
2 Finished successfully
3 Skipped
4 Aborted (details in the log)
5 Aborted by the user
6 Aborted by a rerun
7 Aborted by a warning
8 Aborted by an error
9 Aborted by an action

Description

Warning

This function is intended for internal use only and may change or be removed at any time without notice.

The function returns the execution statistics of the flow plan with the ID ScriptID, e.g. for the display of the runs in the console. It contains the queued and running as well as the last 25 finished runs with their executed steps. The statistics are only kept in memory and are empty after a restart of IP-Symcon. If the flow plan has not been executed since then, RunCount is 0 and the lists are empty.

If ScriptID is not a flow plan, the function fails with "Script ... is not a flow script!", if the script does not exist, with "Script #... does not exist".

A path (CurrentStep, Step) starts at the top level of the flow plan. Every further entry descends into a nested action list of the previous action, e.g. into the actions of a condition. There are no PHP constants for the status values.

Example

// Output the finished runs of a flow plan
$statistic = IPS_GetFlowScriptStatistic(12345);
foreach ($statistic['Completed'] as $run) {
    printf("Run %d: status %d, %d steps\n", $run['RunID'], $run['Status'], count($run['Executed']));
}

/* e.g. returns:
Run 1: status 2, 3 steps
Run 2: status 8, 2 steps
*/
Any questions?