Hitachi

JP1 Version 13 JP1/Integrated Management 3 - Manager Command, Definition File and API Reference


11.3.2 Introduction (AWS Lambda linkage tool (JP1/IM REST version))

Organization of this subsection

(1) Preparation

The preparations for introducing AWS Lambda linkage tool (JP1/IM REST compatible version) are the same as those for AWS Lambda linkage tool (JP1 event register command support version).

See 11.2.2(1) Preparation.

(2) Installation

(a) Creating event information

Create event information.

  1. Login AWS Management Console from a browser.

  2. Select Lambda-Functions from services.

  3. Click Create a Function.

  4. Select Create from scratch and enter the following information: Click Create a Function.

    Table 11‒22: Basic information for creating event information

    No.

    Item

    Values

    1

    Function name

    sendevent_sqs_im2

    2

    Run time

    Python3.7

    3

    Access authority

    Specify a role with the following permission:

    • Permissions that can be written to CloudWatch Logs#1

    • Accessibility that can read S3's file#2

    • Permissions that can be written to SQS#3

    #1

    The following policies are required for accessing CloudWatch Logs:

    - CreateLogGroup

    - CreateLogStream

    - PutLogEvents

    #2

    The following policies are required for accessing S3:

    - GetObject

    #3

    The following policies are required for accessing SQS:

    - SendMessage

  5. Select "Lambda" - "Functions" - "sendevent_sqs_im2" - "Setup".

  6. For Function Code, enter the information shown in the following table.

    Table 11‒23: Function codes for creating event information

    No.

    Item

    Values

    1

    Code entry type

    Upload.zip File

    -Select "sendevent_sqs_im2.zip" in the "sendevent_im2" directory.

    2

    Run time

    Python3.7

    3

    Handler

    sendevent_sqs_im2.lambda_handler

  7. Click Save.

(b) Creating an event information transmission

Create a AWS Lambda linkage tool (send event information).

  1. Login AWS Management Console from a browser.

  2. Select Lambda-Functions from services.

  3. Click Create a Function.

  4. Select Create from scratch and enter the following information: Click Create a Function.

    Table 11‒24: Basic event information transmission

    No.

    Item

    Values

    1

    Function name

    sendevent_im2

    2

    Run time

    Python3.7

    3

    Access authority

    Specify a role with the following permissions:

    • Permissions that can be written to CloudWatch Logs#1

    • Accessibility that can read S3's file#2

    • Message of SQS can be deleted accessible permission#3

    • Access that can be connected to the VPC#4

    #1

    The following policies are required for accessing CloudWatch Logs:

    - CreateLogGroup

    - CreateLogStream

    - PutLogEvents

    #2

    The following policies are required for accessing S3:

    - GetObject

    #3

    The following policies are required for accessing SQS:

    - DeleteMessage

    - ReceiveMessage

    - GetQueueAttributes

    #4

    The following policies are required to access the VPC:

    - CreateNetworkInterface

    - DescribeNetworkInterfaces

    - DeleteNetworkInterface

  5. Select "Lambda" - "Functions" - "sendevent_im2" - "Setup".

  6. For Function Code, enter the information shown in the following table.

    Table 11‒25: Function codes for sending event information

    No.

    Item

    Values

    Remarks

    1

    Code entry type

    Upload.zip File

    Select "sendevent_im2".zip in the "sendevent_im2" directory.

    2

    Run time

    Python3.7

    3

    Handler

    sendevent_im2.lambda_handler

  7. Click Save.

  8. Select [Lambda] - [Functions] - [sendevent_im2] - [Settings] tab.

  9. Select the VPC and set the VPC, subnet, and security group that can access JP1/IM to send event information.

(3) Setup

(a) Event-definition file (eventconf.csv)

This section explains Setup process for JP1 events that are registered for AWS Lambda linkage tool (for JP1/IM REST).

Setup fields
  • JP1 Events registration requirements

  • JP1 event-information

  1. Login AWS Management Console from a browser.

  2. Select S3 from services.

  3. Select the bucket you created in 11.2.2(1)(c) Preparing S3.

  4. Download eventconf.csv from the bucket you selected in step 3 to the appropriate directory.

    If file does not exist in the bucket, please copy the above file under sendevent_im2 to the appropriate directory.

  5. Open eventconf.csv you downloaded or copy in step 4 in a text editor and setup the event-definition.

    • Write in one entry per line.

    • A line with the first character "#" is a comment line and is ignored.

    • Write in CSV format.

    • JP1 event definition is searched from the top, and JP1 event with the condition that matches the condition is fired first.

    The columns in CSV are listed in the following tables.

    Table 11‒26: Event definition columns

    Column number

    Setup values

    Required/Optional

    Scope of values

    1

    Specifies a regular expression that identifies the log that you want to register as a JP1 event.

    Required

    Range supported by regular expressions

    2

    Specifies the log group name of the log that you want to register as a JP1 event.

    If this option is omitted, all log groups are subject to processing.

    Optional

    Range supported by AWS log group name

    3

    Specifies event ID of JP1 event that you want to register.#1

    Optional

    Corresponds to the scope supported by eventId parameter in the Event Publishing API of JP1/IM.

    4

    Specifies message of JP1 event to register.

    If this option is omitted, the target log is used.#2

    Optional

    Corresponds to the scope supported by message parameter in the Event Publishing API of JP1/IM.

    5 or later

    Specifies the extended attribute of the JP1 event to register.#1#3

    When specifying multiple extended attributes, specify in column number 7 or later.

    Optional

    The scope supported by jevsend command-argument-e.

    Corresponds to the scope supported by attrs parameter in the Event Publishing API of JP1/IM.

    Note that you do not need to specify "" even if the extended attribute value contains spaces. ("" is also recognized as an extended attribute value.)

    #1

    If omitted, this is the default behavior for the corresponding jevsend command-option.

    #2

    For messages exceeding 1023 bytes, the range is up to 1023 bytes.

    Also, if message contains a carriage return, the carriage return code is converted to a single-byte space.

    #3

    In addition to the specified extended attributes, there are extended attributes that are added by AWS Lambda linkage tool (for JP1/IM REST). The extended properties to add are as follows:

    Table 11‒27: Extended properties setup by AWS Lambda linkage tool (for JP1/IM REST)

    No.

    Attribute name

    Values

    1

    AWS_LAMBDA_LOG_TIMESTAMP

    UNIX period during which logging was registered to CloudWatch Logs

    2

    AWS_LAMBDA_LOG_GROUP

    Target log group name

    3

    AWS_LAMBDA_LOG_STREAM

    Target log stream name

    4

    AWS_LAMBDA_SUBSCRIPTION_FILTERS

    Value with comma-separated setup of the target subscription filter names

    (No comma if setup value is one)

    5

    AWS_LAMBDA_LOG_DATETIME

    Character string in which item 1 is converted to "YYYY/mm/dd HH:MM:SS"

    The following shows a sample setup:

    #Condition,LogGroupId,EventID,Message,ExtAttr
    .*Error.*,LOGGROUP1,1111,message1, EXATTR1=value1,EXATTR2=value2
    .*Warning.*,,2222,message2,EXATTR1=aaa bbb,EXATTR2=value
  6. After changing setup in step 5, save it with the following character code/end-of-line code.

    Table 11‒28: Event-definition file (eventconf.csv) character code/line feed code

    No.

    Item

    Values

    1

    Character code

    UTF-8 (without BOM)

    2

    End-of-line code

    LF (\n) or CRLF (\r\n)

  7. Re-select the bucket in step 3 and upload setup modified eventconf.csv.

(b) Event-exclusion files (eventignore.csv)

AWS Lambda linkage tool (for JP1/IM REST) uses the same setup procedure as AWS Lambda linkage tool (JP1 event register command support version). See 11.2.2(3)(d) Exclude Events File (eventignore.csv).

In this case, replace "sendevent_sqs" with "sendevent_im2".

(c) Event-information creation (sendevent_sqs_im2)

This section explains setup step of event-information creation.

Setup fields
  • SQS URL

  • S3 bucket name

  • Execution triggering (JP1 event registration log)

  1. Login AWS Management Console from a browser.

  2. Select "Lambda"-"Functions"-"sendevent_sqs_im2"-"Setup" from services.

  3. Setup the following items in "Environment-variable".

    Table 11‒29: Environment variables for creating event information

    No.

    Key

    Values

    1

    SQS_QUEUE_URL

    Specifies JP1 event-information is stored in URL created in 11.2.2(1)(d) Preparing SQS.

    2

    S3_BUCKET_NAME

    Specifies S3 bucket for storing AWS Lambda linkage configuration file created in 11.2.2(1)(c) Preparing S3.

  4. In Designer, press Add Trigger to trigger the log you want to register as a JP1 event. You can add several triggers.

    Table 11‒30: Function codes for sending event information

    No.

    Item

    Values

    Remarks

    1

    Trigger

    CloudWatch Logs

    2

    Log group

    Specify the log group that contains the logs you want to register as JP1 events.

    Do not specify the log group that contains the log information that is output by creating the event information of AWS Lambda linkage tool (for JP1/IM REST).

    3

    Name of filter

    Specifies the name of filter.

    4

    Filter patterning

    Specifies filter pattern for the log that you want to register as a JP1 event.

    It does not matter if you do not specify it.

  5. Click Save.

(d) Send event info (sendevent_im2.py)

This section explains setup process for sending event-information.

Setup fields
  • S3 bucket name

  • IM2 REST based URL

  • IM2 authentication Info User ID

  • IM2 authentication Info Password

  • Execution triggering (JP1 events)

  1. Login AWS Management Console from a browser.

  2. Select "Lambda"-"Functions"-"sendevent_im2"-"Setup" from Services.

  3. Setup the following items in "Environment-variable".

    Table 11‒31: Environment variables for sending event information

    No.

    Attribute name

    Values

    1

    S3_BUCKET_NAME

    Specifies S3 bucket name for storing configuration file of AWS Lambda linkage tool (JP1/IM REST supported version) created in 11.2.2(1)(c) Preparing S3.

    2

    IM2_REST_BASE_URL

    Specifies the base URL of REST of JP1/IM to which the event-information is sent.

    3

    IM2_REST_LOGIN_USER

    Specifies ID for accessing JP1/IM in REST.

    4

    IM2_REST_LOGIN_PASSWORD

    Specifies Password for item 4 for accessing JP1/IM by REST.

  4. In Designer, press Add Trigger to add SQS as a trigger.

    Table 11‒32: Trigger for sending event information

    No.

    Item

    Values

    Remarks

    1

    Trigger

    SQS

    2

    SQS cue

    Specifies SQS queue from which JP1 events are read.

    3

    Batch size

    Specifies how many messages can be retrieved in a single batch.

    The largest value that can be specified is 10.

  5. Click Save.

(e) Logging configuration file (logging.conf)

AWS Lambda linkage tool (for JP1/IM REST) uses the same setup procedure as AWS Lambda linkage tool (JP1 event register command support version). See 11.2.2(3)(f) Logging configuration file of Lambda (logging.conf).

In this case, replace "sendevent_sqs" with "sendevent_sqs_im2".

(4) Uninstallation

(a) Uninstalling AWS Lambda linkage tool (for JP1/IM REST)

The following describes how to uninstall AWS Lambda linkage tool.

  1. Login AWS Management Console from a browser.

  2. Select Lambda-Functions from services.

  3. Select "sendevent_sqs_im2" and then execute "Action"-"Delete".

  4. Select "sendevent_im2" and then execute "Action"-"Delete".

  5. Select S3 from services.

  6. Select the bucket you created in 11.2.2(1)(c) Preparing S3.

  7. Select the following File, and then execute "Action"-"Delete".

    • eventconf.csv

    • eventignore.csv

    • logging.conf