]> granicus.if.org Git - icinga2/commitdiff
API: Add execution_{start,end} attribute to 'process-check-result' action 5527/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Mon, 21 Aug 2017 15:20:56 +0000 (17:20 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Mon, 21 Aug 2017 15:20:56 +0000 (17:20 +0200)
fixes #5002

doc/12-icinga2-api.md
lib/icinga/apiactions.cpp

index ab14ff65a7279dc13e0f960c906db67684df0bd8..89ec60e7e99ab8bd8d1246a767230afc06e4575d 100644 (file)
@@ -805,6 +805,8 @@ Send a `POST` request to the URL endpoint `/v1/actions/process-check-result`.
   performance\_data | string array | **Optional.** The performance data.
   check\_command    | string array | **Optional.** The first entry should be the check commands path, then one entry for each command line option followed by an entry for each of its argument.
   check\_source     | string       | **Optional.** Usually the name of the `command_endpoint`
+  execution\_start  | timestamp    | **Optional.** The timestamp where a script/process started its execution.
+  execution\_end    | timestamp    | **Optional.** The timestamp where a script/process ended its execution. This timestamp is used in features to determine e.g. the metric timestamp.
 
 In addition to these parameters a [filter](12-icinga2-api.md#icinga2-api-filters) must be provided. The valid types for this action are `Host` and `Service`.
 
index d488cd5996c6fed826e94da219a62faa8d51a959..9d900524a9428f90547bf74dae38b62f799230d3 100644 (file)
@@ -103,6 +103,12 @@ Dictionary::Ptr ApiActions::ProcessCheckResult(const ConfigObject::Ptr& object,
        cr->SetOutput(HttpUtility::GetLastParameter(params, "plugin_output"));
        cr->SetState(state);
 
+       if (params->Contains("execution_start"))
+               cr->SetExecutionStart(HttpUtility::GetLastParameter(params, "execution_start"));
+
+       if (params->Contains("execution_end"))
+               cr->SetExecutionEnd(HttpUtility::GetLastParameter(params, "execution_end"));
+
        cr->SetCheckSource(HttpUtility::GetLastParameter(params, "check_source"));
        cr->SetPerformanceData(params->Get("performance_data"));
        cr->SetCommand(params->Get("check_command"));