Hitachi

Hitachi Application Server V10 Command Reference Guide (For UNIX® Systems)


2.26.1 create-event-hook

The create-event-hook subcommand registers an event hook command.

Synopsis

asadmin [asadmin_options] create-event-hook --messageid=messageid
    --script=script_file_path
    [--monitoring-time-span=monitoring_time_span
    --monitoring-max-count=monitoring_max_count] event_hook_name

Storage location

Application Server installation directory/javaee/glassfish/bin

Function

The create-event-hook subcommand registers an event hook command, which is executed automatically when an event occurs in the domain administration server. You need to specify a script file created by the user for the event hook command.

When an event is detected, the registered command is executed in the location where the specified script file is placed.

You can specify any name for the event hook command. However, if another event hook command is already registered and uses the same value for the following argument, an error occurs even if the name is not yet registered:

This subcommand is supported only in the remote mode.

Execution permission

General user

Arguments

--messageid=messageid

Specifies the message ID that triggers the execution of the event hook command.

Type: String

You can specify the following values:

  • Message ID published by the system.

Default value: (None. You must specify a value.)

--script=script_file_path

Specifies the script file to be registered as the event hook command. Specify an absolute path in the domain administration server.

Type: String

You can specify the following values:

  • Absolute path of the existing file.

Default value: (None. You must specify a value.)

--monitoring-time-span=monitoring_time_span

Specifies the time interval to configure the maximum permitted number of executions.

The value is specified in seconds. If this value is set to 0, the event hook command runs indefinitely without monitoring the execution.

Executing an event hook command when an event is detected might result in repeatedly issuing the event that is subject to detection. As a result, the event hook command might be executed indefinitely. You can prevent the command from running indefinitely by specifying this option and the --monitoring-max-count option simultaneously.

Type: Integer

You can specify the following values:

  • 0 to 2147483647

Default value: 0

--monitoring-max-count=monitoring_max_count

Specify the maximum permitted number of executions for the same event type, within the time specified in the --monitoring-time-span option. If 0 is specified, the event hook command is executed indefinitely.

The events that satisfy the conditions below are referred to as "events of the same type".

Server events are of the same type if all the following items are identical among the server events:

  • Message ID that triggered the event.

  • Name of the server where the event occurred.

Node events are of the same type if all the following items are identical among the node events:

  • Message ID that triggered the event.

  • Name of the node where the event occurred.

Non-server events and non-node events are of the same type if all the following items are identical among those servers:

  • Message ID that triggered the event.

Type: Integer

You can specify the following values:

  • 0 to 256

Default value: 0

event_hook_name

Specifies the name of the event hook command.

Type: String

You can specify the following values:

  • ASCII characters

  • The name can contain the following characters:

    Lowercase letters: a to z

    Uppercase letters: A to Z

    Numbers: 0 to 9

    Hyphens: -

    Underscores: _

  • The first character can either be an uppercase or a lowercase letter.

  • The following names that exist in the domain cannot be specified:

    Node name

    Java EE server name

    Web server name

    PRF server name

    Cluster name

    Name of a dependency relation between servers

    Name of the configuration of the Java EE server

  • The following names that are listed cannot be specified because they are either used by the system or are reserved words:

    domain

    server

    default

    server-config

    default-config

    default-webserver-config

    default-prf-config

    javaee

    webserver

    prf

    cluster

    redirect

    prf-relation

    Name that begins with HJES_

    prebuilt_web_server_name-config

    prebuilt_PRF_name-config

Default value: (None. You must specify a value.)

Examples

The following example runs the event hook command when the server starts successfully.

asadmin create-event-hook --messageid KDKD10083-I
 --script /work/failure-script.sh Event01

The following example runs the event hook command when the server stops successfully (and the execution monitoring option of the event hook command is specified).

asadmin create-event-hook --messageid KDKD10094-I
--script /work/failure-script.sh --monitoring-time-span=180
--monitoring-max-count=3  Event02

Exit Status

Exit Status

Explanation

0

Normal termination.

1

Abnormal termination.

Notes