Amazon Inspector

2017/12/22 - Amazon Inspector - 2 updated api methods

Changes  PreviewAgents API now returns additional fields within the AgentPreview data type. The API now shows the agent health and availability status for all instances included in the assessment target. This allows users to check the health status of Inspector Agents before running an assessment. In addition, it shows the instance ID, hostname, and IP address of the targeted instances.

ListAssessmentRunAgents (updated) Link ¶
Changes (request, response)
Request
{'filter': {'agentHealths': {'UNKNOWN'}}}
Response
{'assessmentRunAgents': {'agentHealth': {'UNKNOWN'}}}

Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs.

See also: AWS API Documentation

Request Syntax

client.list_assessment_run_agents(
    assessmentRunArn='string',
    filter={
        'agentHealths': [
            'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
        ],
        'agentHealthCodes': [
            'IDLE'|'RUNNING'|'SHUTDOWN'|'UNHEALTHY'|'THROTTLED'|'UNKNOWN',
        ]
    },
    nextToken='string',
    maxResults=123
)
type assessmentRunArn

string

param assessmentRunArn

[REQUIRED]

The ARN that specifies the assessment run whose agents you want to list.

type filter

dict

param filter

You can use this parameter to specify a subset of data to be included in the action's response.

For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

  • agentHealths (list) -- [REQUIRED]

    The current health state of the agent. Values can be set to HEALTHY or UNHEALTHY .

    • (string) --

  • agentHealthCodes (list) -- [REQUIRED]

    The detailed health state of the agent. Values can be set to IDLE , RUNNING , SHUTDOWN , UNHEALTHY , THROTTLED , and UNKNOWN .

    • (string) --

type nextToken

string

param nextToken

You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListAssessmentRunAgents action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

type maxResults

integer

param maxResults

You can use this parameter to indicate the maximum number of items that you want in the response. The default value is 10. The maximum value is 500.

rtype

dict

returns

Response Syntax

{
    'assessmentRunAgents': [
        {
            'agentId': 'string',
            'assessmentRunArn': 'string',
            'agentHealth': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
            'agentHealthCode': 'IDLE'|'RUNNING'|'SHUTDOWN'|'UNHEALTHY'|'THROTTLED'|'UNKNOWN',
            'agentHealthDetails': 'string',
            'autoScalingGroup': 'string',
            'telemetryMetadata': [
                {
                    'messageType': 'string',
                    'count': 123,
                    'dataSize': 123
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • assessmentRunAgents (list) --

      A list of ARNs that specifies the agents returned by the action.

      • (dict) --

        Contains information about an Amazon Inspector agent. This data type is used as a response element in the ListAssessmentRunAgents action.

        • agentId (string) --

          The AWS account of the EC2 instance where the agent is installed.

        • assessmentRunArn (string) --

          The ARN of the assessment run that is associated with the agent.

        • agentHealth (string) --

          The current health state of the agent.

        • agentHealthCode (string) --

          The detailed health state of the agent.

        • agentHealthDetails (string) --

          The description for the agent health code.

        • autoScalingGroup (string) --

          The Auto Scaling group of the EC2 instance that is specified by the agent ID.

        • telemetryMetadata (list) --

          The Amazon Inspector application data metrics that are collected by the agent.

          • (dict) --

            The metadata about the Amazon Inspector application data metrics collected by the agent. This data type is used as the response element in the GetTelemetryMetadata action.

            • messageType (string) --

              A specific type of behavioral data that is collected by the agent.

            • count (integer) --

              The count of messages that the agent sends to the Amazon Inspector service.

            • dataSize (integer) --

              The data size of messages that the agent sends to the Amazon Inspector service.

    • nextToken (string) --

      When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.

PreviewAgents (updated) Link ¶
Changes (response)
{'agentPreviews': {'agentHealth': 'HEALTHY | UNHEALTHY | UNKNOWN',
                   'agentVersion': 'string',
                   'hostname': 'string',
                   'ipv4Address': 'string',
                   'kernelVersion': 'string',
                   'operatingSystem': 'string'}}

Previews the agents installed on the EC2 instances that are part of the specified assessment target.

See also: AWS API Documentation

Request Syntax

client.preview_agents(
    previewAgentsArn='string',
    nextToken='string',
    maxResults=123
)
type previewAgentsArn

string

param previewAgentsArn

[REQUIRED]

The ARN of the assessment target whose agents you want to preview.

type nextToken

string

param nextToken

You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the PreviewAgents action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

type maxResults

integer

param maxResults

You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

rtype

dict

returns

Response Syntax

{
    'agentPreviews': [
        {
            'hostname': 'string',
            'agentId': 'string',
            'autoScalingGroup': 'string',
            'agentHealth': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
            'agentVersion': 'string',
            'operatingSystem': 'string',
            'kernelVersion': 'string',
            'ipv4Address': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • agentPreviews (list) --

      The resulting list of agents.

      • (dict) --

        Used as a response element in the PreviewAgents action.

        • hostname (string) --

          The hostname of the EC2 instance on which the Amazon Inspector Agent is installed.

        • agentId (string) --

          The ID of the EC2 instance where the agent is installed.

        • autoScalingGroup (string) --

          The Auto Scaling group for the EC2 instance where the agent is installed.

        • agentHealth (string) --

          The health status of the Amazon Inspector Agent.

        • agentVersion (string) --

          The version of the Amazon Inspector Agent.

        • operatingSystem (string) --

          The operating system running on the EC2 instance on which the Amazon Inspector Agent is installed.

        • kernelVersion (string) --

          The kernel version of the operating system running on the EC2 instance on which the Amazon Inspector Agent is installed.

        • ipv4Address (string) --

          The IP address of the EC2 instance on which the Amazon Inspector Agent is installed.

    • nextToken (string) --

      When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.