mkresponse Command

Purpose

Creates a new response definition.

Syntax

To create a response with no actions:

mkresponse [ -b ] [-p node_name] [-h] [-TV] response

To create a response with one action:

mkresponse -n action [ -d days_of_week[,days_of_week… ] ] [ -t time_of_day[,time_of_day… ] ] -s action_script [ -r return_code ] [ -b | [ -e a | A | b | e | r ] ] [ -o ] [ -E env_var=value[,env_var=value... ] ] [-u] [ -p node_name ] [-h] [-TV] response

To copy a response:

mkresponse -c existing_response[:node_name] [-p node_name] [-h] [-TV] response

Description

The mkresponse command creates a new response definition with the name specified by the response parameter. One action can also be specified when the response is defined. Actions define commands to be run when the response is used with a condition and the condition occurs. The action defines days of the week when the action can be used, the time of day for those days of the week, the script or command to be run, what type of event causes the command to be run, the expected return code of the script or command, and whether to keep standard output. The days and times are paired so that different times can be specified for different days. A response with no actions only logs the events.

Use the -b flag to specify that the response, and all actions to be defined in this response, support event batching. For event batching, multiple events can be batched or grouped together and passed to a response. The actions of the response are directed to a file that contains the details for the batched events. A response that supports event batching can only be used for conditions that specify the events are to be batched. The -b flag cannot be specified with the -e flag.

In a cluster environment, use the -p flag to specify the node in the domain that is to contain the response definition. If you are using mkresponse on the management server and you want the response to be defined on the management server, do not specify the -p flag. If the -p flag is not specified, the response is defined on the local node.

Use the chresponse command to add actions to a response or to remove actions from a response. Use the startcondresp command to start monitoring. The startcondresp command links a response to a condition, if they are not already linked.

To lock a response so it cannot be modified or removed, use the chresponse command with the -L flag.

Flags

-b
Specifies that the response, and all actions to be defined in this response, support event batching. For event batching, multiple events can be batched or grouped together and passed to a response. The actions of the response are directed to a file that contains the details for the batched events. A response that supports event batching can only be used for conditions that specify the events are to be batched.

An event response can be created for batched event conditions without an action script.

The -b flag cannot be specified with the -e flag.

-c existing_response[:node_name]
Copies an existing response. Links with conditions are not copied. The existing response is defined on the node known as node_name in a cluster. If node_name is not specified, the local node is used. node_name is a node within the scope determined by the CT_MANAGEMENT_SCOPE environment variable. If any other flags are specified, update the new response as indicated by the flags.
-d days_of_week

Specifies the days of the week when the action being defined can be run. days_of_week and time_of_day together define the interval when the action can be run.

Enter the numbers of the days separated by a plus sign (+) or as a range of days separated by a hyphen (-). More than one days_of_week parameter can be specified, but the parameters must be separated by a comma (,). The number of days_of_week parameters specified must match the number of time_of_day parameters specified. The default is all days. If no value is specified but a comma is entered, the default value is used. The values for each day follow:
1
Sunday
2
Monday
3
Tuesday
4
Wednesday
5
Thursday
6
Friday
7
Saturday
-e a | A | b | e | r
Specifies the type of event that causes the action being defined to run:
a
Specifies an event. This is the default.
A
Specifies any type of event (event, error event, or rearm event).
b
Specifies an event and a rearm event.
e
Specifies an error event.
r
Specifies a rearm event.
More than one event type can be specified, for example: -e ae. The -e flag cannot be specified with the -b flag.
-E env_var=value[,env_var=value...]
Specifies any environment variables to be set before running the action. If multiple env_var=value variables are specified, they must be separated by commas.
-n action
Specifies the name of the action being defined. Only one action can be defined when the response is created. Use the chresponse command to add more actions to the response.
-o
Directs all standard output from action_script to the audit log. The default is not to keep standard output. Standard error is always directed to the audit log.
-p node_name
Specifies the name of the node where the response is defined. This is used in a cluster environment and the node name is the name by which the node is known in the domain. The default node_name is the local node on which the command runs. node_name is a node within the scope determined by the CT_MANAGEMENT_SCOPE environment variable.

If you are using mkresponse on the management server and you want the response to be defined on the management server, do not specify the -p flag.

-r return_code
Specifies the expected return code for action_script. If the expected return code is specified, the actual return code of action_script is compared to the expected return code. A message is written to the audit log indicating whether they match. If the -r flag is not specified, the actual return code is written to the audit log, and no comparison is performed.
-s action_script
Specifies the fully-qualified path for the script or command to run for the action being defined. See the logevent, notifyevent, and wallevent commands for descriptions of the predefined response scripts provided with the application.
-t time_of_day
Specifies the time range when action can be run, consisting of the start time followed by the end time, separated by a hyphen. days_of_week and time_of_day together define the interval when the action can be run.

The time is in 24-hour format (HHMM) where the first two digits represent the hour and the last two digits represent the minutes. The start time must be less than the end time because the time is specified by day of the week. More than one time_of_day parameter can be specified, but the parameters must be separated by a comma (,). The number of days_of_week parameters specified must match the number of time_of_day parameters specified. The default value is 0000-2400. If no value is specified but a comma is entered, the default value is used.

-u
Specifies that the action is to be run when a monitored resource becomes undefined.
-h
Writes the command's usage statement to standard output.
-T
Writes the command's trace messages to standard error. For your software service organization's use only.
-V
Writes the command's verbose messages to standard output.

Parameters

response
The response name is a character string that identifies the response. If the name contains spaces, it must be enclosed in quotation marks. A name cannot consist of all spaces, be null, or contain embedded double quotation marks.

Security

The user needs write permission for the IBM.EventResponse resource class to run mkresponse. Permissions are specified in the access control list (ACL) file on the contacted system. See the Administering RSCT guide for details on the ACL file and how to modify it.

Exit Status

0
The command ran successfully.
1
An error occurred with RMC.
2
An error occurred with a command-line interface script.
3
An incorrect flag was entered on the command line.
4
An incorrect parameter was entered on the command line.
5
An error occurred that was based on incorrect command-line input.

Environment Variables

CT_CONTACT
Determines the system where the session with the resource monitoring and control (RMC) daemon occurs. When CT_CONTACT is set to a host name or IP address, the command contacts the RMC daemon on the specified host. If CT_CONTACT is not set, the command contacts the RMC daemon on the local system where the command is being run. The target of the RMC daemon session and the management scope determine the resource classes or resources that are processed.
CT_IP_AUTHENT
When the CT_IP_AUTHENT environment variable exists, the RMC daemon uses IP-based network authentication to contact the RMC daemon on the system that is specified by the IP address to which the CT_CONTACT environment variable is set. CT_IP_AUTHENT only has meaning if CT_CONTACT is set to an IP address; it does not rely on the domain name system (DNS) service.
CT_MANAGEMENT_SCOPE
Determines the management scope that is used for the session with the RMC daemon in processing the resources of the event-response resource manager (ERRM). The management scope determines the set of possible target nodes where the resources can be processed. The valid values are:
0
Specifies local scope.
1
Specifies local scope.
2
Specifies peer domain scope.
3
Specifies management domain scope.

If this environment variable is not set, local scope is used.

Implementation Specifics

This command is part of the Reliable Scalable Cluster Technology (RSCT) fileset for AIX®.

Standard Output

When the -h flag is specified, this command's usage statement is written to standard output. All verbose messages are written to standard output.

Standard Error

All trace messages are written to standard error.

Examples

These examples apply to standalone systems:
  1. To define a response with the name "Log event in audit log", run this command:
    mkresponse "Log event in audit log"
  2. To define a response with the name "E-mail root anytime" that has an action named "E-mail root", to be used any time Saturday and Sunday and uses the command /opt/rsct/bin/notifyevent root for both events and rearm events, run this command:
     mkresponse -n "E-mail root" -d 1+7  \                          
    -s "/opt/rsct/bin/notifyevent root" -e b   \          
    "E-mail root anytime"
  3. To define a response with the name "E-mail root anytime" that has an action named "E-mail root", to be used anytime Saturday and Sunday but only 8 am to 5 pm Monday through Friday and that uses the command /opt/rsct/bin/notifyevent root for events, run this command:
    mkresponse -n "E-mail root"     \                              
    -d 1+7,2-6  -t 0000-2400,0800-1700  \                          
    -s "/opt/rsct/bin/notifyevent root" -e a  \           
    "E-mail root anytime"
  4. To define a response with the name "E-mail root anytime" that has an action named "E-mail root" to be used any time Saturday and Sunday, that uses the command /opt/rsct/bin/notifyevent root for both events and rearm events, and that sets the environment variable LANG to en_US, run this command:
    mkresponse -n "E-mail root" -d 1+7  \           
    -s "/opt/rsct/bin/notifyevent root" -e b \        
    -E LANG="en_US"  "E-mail root anytime"
  5. To define a response with the name "E-mail root first shift" that has an action named "E-mail root" to be used Monday through Friday from 8 am to 6 pm, that uses the command /opt/rsct/bin/notifyevent root for rearm events, and that saves standard output in the audit log, expecting return code 5, run this command:
    mkresponse -n "E-mail root" -d 2-6  -t 0800-1800  \           
    -s "/opt/rsct/bin/notifyevent root" -e r  -o   \        
    -r 5  "E-mail root first shift"
  6. To define a response with the name "Critical notifications" as a copy of "Warning notifications", enter:
    mkresponse -c "Warning notifications" "Critical notifications"
  7. To define a batching-capable response called "Batched Event Response" without an action script, enter:
    mkresponse -b "Batched Event Response"
These examples apply to management domains:
  1. To define a response on the management server with the name "E-mail root anytime" that has an action named "E-mail root", to be used any time Saturday and Sunday and uses the command /opt/rsct/bin/notifyevent root for both events and rearm events, run this command on the management server:
     mkresponse -n "E-mail root" -d 1+7  \                          
    -s "/opt/rsct/bin/notifyevent root" -e b   \          
    "E-mail root anytime"
  2. To define a response on the managed node nodeB with the name "E-mail root anytime" that has an action named "E-mail root", to be used any time Saturday and Sunday and uses the command /opt/rsct/bin/notifyevent root for both events and rearm events, run this command on the management server:
     mkresponse -n "E-mail root" -d 1+7  \                          
    -s "/opt/rsct/bin/notifyevent root" -e b   \          
    -p nodeB "E-mail root anytime"
  3. To define a response on the managed node nodeB with the name "nodeB Warning notifications" as a copy of "nodeA Warning notifications" on the managed node nodeA, run this command on the management server:
    mkresponse -c "nodeA Warning notifications":nodeA \
    -p nodeB "nodeB Warning notifications"  
These examples apply to peer domains:
  1. To define a response on the current node with the name "E-mail root anytime" that has an action named "E-mail root", to be used any time Saturday and Sunday and uses the command /opt/rsct/bin/notifyevent root for both events and rearm events, run this command from any node in the domain:
     
    mkresponse -n "E-mail root" -d 1+7  \                          
    -s "/opt/rsct/bin/notifyevent root" -e b   \          
    "E-mail root anytime"
  2. To define a response on the node nodeB in the domain with the name "E-mail root anytime" that has an action named "E-mail root", to be used any time Saturday and Sunday, that uses the command /opt/rsct/bin/notifyevent root for both events and rearm events, and that sets two environment variables (PAGE ALL and TIMER SET), run this command from any node in the domain:
     mkresponse -n "E-mail root" -d 1+7  \                          
    -s "/opt/rsct/bin/notifyevent root" -e b   \          
    -p nodeB -E 'ENV1="PAGE ALL", ENV2="TIMER SET"' \  
    "E-mail root anytime"
  3. To define a response on the node nodeB in the domain with the name "nodeB Warning notifications" as a copy of "nodeA Warning notifications" on the node nodeA in the domain, run this command from any node in the domain:
    mkresponse -c "nodeA Warning notifications":nodeA \
    -p nodeB "nodeB Warning notifications"  

Location

/opt/rsct/bin/mkresponse