Update src/apps/monitoring/iplabel/ekara/restapi/mode/scenarios.pm

Co-authored-by: omercier <32134301+omercier@users.noreply.github.com>
This commit is contained in:
Evan-Adam 2025-03-04 11:52:09 +01:00 committed by GitHub
parent 1b7b8d7468
commit 148030bf66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,11 +194,11 @@ sub manage_selection {
$self->{scenarios}->{ $scenario->{scenarioName} }->{steps_index}->{$steps->{index} - 1} = $steps->{name};
}
}
# api is expected to sort the output to get the most recent data at the end of the array.
# we store the last execution date, and check it for every data point sent back by the api.
# If a step fail, no data is sent by the api for this step, but the older execution are present.
# this allow to get perfdata for the last execution with a successfull first step.
# if the first step fail, the script will take older data.
# The API is expected to sort the output to get the most recent data at the end of the array.
# We store the last execution date, and check it for every data point sent back by the api.
# If a step has failed, no data is sent by the api for this step, but the results of the previous executions are present.
# This allows to get perfdata for the last execution with a successful first step.
# If the first step fails, the script will take older data.
my $last_execution = @{$scenario_detail->{results}}[-1]->{planningTime};
foreach my $step_metrics (@{$scenario_detail->{results}}) {
if ($step_metrics->{planningTime} ne $last_execution){