プロセス
Incident Management が一般に使用できるようになりました。 Incident Management が広範に使用できるようになりました。

GET https://api.datadoghq.eu/api/v2/processeshttps://api.ddog-gov.com/api/v2/processeshttps://api.datadoghq.com/api/v2/processeshttps://api.us3.datadoghq.com/api/v2/processes

概要

Get all processes for your organization.

引数

クエリ文字列

名前

種類

説明

search

string

String to search processes by.

tags

string

Comma-separated list of tags to filter processes by.

from

integer

Unix timestamp (number of seconds since epoch) of the start of the query window. If not provided, the start of the query window will be 15 minutes before the to timestamp. If neither from nor to are provided, the query window will be [now - 15m, now].

to

integer

Unix timestamp (number of seconds since epoch) of the end of the query window. If not provided, the end of the query window will be 15 minutes after the from timestamp. If neither from nor to are provided, the query window will be [now - 15m, now].

page[limit]

integer

Maximum number of results returned.

page[cursor]

string

String to query the next page of results. This key is provided with each valid response from the API in meta.page.after.

応答

OK

List of process summaries.

Expand All

フィールド

種類

説明

data

[object]

Array of process summary objects.

attributes

object

Attributes for a process summary.

cmdline

string

Process command line.

host

string

Host running the process.

pid

int64

Process ID.

ppid

int64

Parent process ID.

start

string

Time the process was started.

tags

[string]

List of tags associated with the process.

timestamp

string

Time the process was seen.

user

string

Process owner.

id

string

Process ID.

type

enum

Type of process summary. Allowed enum values: process

meta

object

Response metadata object.

page

object

Paging attributes.

after

string

The cursor used to get the next results, if any. To make the next request, use the same parameters with the addition of the page[cursor].

size

int32

Number of results returned.

{
  "data": [
    {
      "attributes": {
        "cmdline": "string",
        "host": "string",
        "pid": "integer",
        "ppid": "integer",
        "start": "string",
        "tags": [],
        "timestamp": "string",
        "user": "string"
      },
      "id": "string",
      "type": "process"
    }
  ],
  "meta": {
    "page": {
      "after": "911abf1204838d9cdfcb9a96d0b6a1bd03e1b514074f1ce1737c4cbd",
      "size": "integer"
    }
  }
}

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Authentication Error

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

コード例


# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/processes" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    if site, ok := os.LookupEnv("DD_SITE"); ok {
        ctx = context.WithValue(
            ctx,
            datadog.ContextServerVariables,
            map[string]string{"site": site},
        )
    }

    search := "search_example" // string | String to search processes by. (optional)
    tags := "account:prod,user:admin" // string | Comma-separated list of tags to filter processes by. (optional)
    from := int64(789) // int64 | Unix timestamp (number of seconds since epoch) of the start of the query window. If not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. (optional)
    to := int64(789) // int64 | Unix timestamp (number of seconds since epoch) of the end of the query window. If not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. (optional)
    pageLimit := int32(56) // int32 | Maximum number of results returned. (optional) (default to 1000)
    pageCursor := "pageCursor_example" // string | String to query the next page of results. This key is provided with each valid response from the API in `meta.page.after`. (optional)

    configuration := datadog.NewConfiguration()

    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.ProcessesApi.ListProcesses(ctx).Search(search).Tags(tags).From(from).To(to).PageLimit(pageLimit).PageCursor(pageCursor).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ProcessesApi.ListProcesses``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListProcesses`: ProcessSummariesResponse
    response_content, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from ProcessesApi.ListProcesses:\n%s\n", response_content)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com" go "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.ProcessesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        ProcessesApi apiInstance = new ProcessesApi(defaultClient);
        String search = "search_example"; // String | String to search processes by.
        String tags = "account:prod,user:admin"; // String | Comma-separated list of tags to filter processes by.
        Long from = 56L; // Long | Unix timestamp (number of seconds since epoch) of the start of the query window. If not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`.
        Long to = 56L; // Long | Unix timestamp (number of seconds since epoch) of the end of the query window. If not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`.
        Integer pageLimit = 1000; // Integer | Maximum number of results returned.
        String pageCursor = "pageCursor_example"; // String | String to query the next page of results. This key is provided with each valid response from the API in `meta.page.after`.
        try {
            ProcessSummariesResponse result = apiInstance.listProcesses()
                .search(search)
                .tags(tags)
                .from(from)
                .to(to)
                .pageLimit(pageLimit)
                .pageCursor(pageCursor)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ProcessesApi#listProcesses");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com" java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import processes_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
    configuration.server_variables["site"] = os.environ["DD_SITE"]

# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')

# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = processes_api.ProcessesApi(api_client)
    search = "search_example"  # str | String to search processes by. (optional)
    tags = "account:prod,user:admin"  # str | Comma-separated list of tags to filter processes by. (optional)
    _from = 1  # int | Unix timestamp (number of seconds since epoch) of the start of the query window. If not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. (optional)
    to = 1  # int | Unix timestamp (number of seconds since epoch) of the end of the query window. If not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. (optional)
    page_limit = 1000  # int | Maximum number of results returned. (optional) if omitted the server will use the default value of 1000
    page_cursor = "page[cursor]_example"  # str | String to query the next page of results. This key is provided with each valid response from the API in `meta.page.after`. (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get all processes
        api_response = api_instance.list_processes(search=search, tags=tags, _from=_from, to=to, page_limit=page_limit, page_cursor=page_cursor)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ProcessesApi->list_processes: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com" python3 "example.py"
require 'time'
require 'datadog_api_client'

DatadogAPIClient::V2.configure do |config|
  # Defining the site is optional and defaults to datadoghq.com
  config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'

  # setup authorization
  # Configure API key authorization: apiKeyAuth
  config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]

  # Configure API key authorization: appKeyAuth
  config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
end

api_instance = DatadogAPIClient::V2::ProcessesApi.new
opts = {
  search: 'search_example', # String | String to search processes by.
  tags: 'account:prod,user:admin', # String | Comma-separated list of tags to filter processes by.
  from: 789, # Integer | Unix timestamp (number of seconds since epoch) of the start of the query window. If not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`.
  to: 789, # Integer | Unix timestamp (number of seconds since epoch) of the end of the query window. If not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`.
  page_limit: 56, # Integer | Maximum number of results returned.
  page_cursor: 'page_cursor_example' # String | String to query the next page of results. This key is provided with each valid response from the API in `meta.page.after`.
}

begin
  # Get all processes
  result = api_instance.list_processes(opts)
  p result
rescue DatadogAPIClient::V2::ApiError => e
  puts "Error when calling ProcessesApi->list_processes: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com" rb "example.rb"