[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 3

mkresponse Command

Purpose

Creates a new response definition.

Syntax

To create a response with no actions:

mkresponse [-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]
[-e a | r | b ] [-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.

When in a cluster environment, use the -p flag to specify the node in the domain that is to contain the response definition. If the -p flag is not specified, the response is defined on the local node.

The chresponse command can be used to add actions to a response or to remove actions from a response. Monitoring can be started by using the startcondresp command. The startcondresp command links a response to a condition if they are not already linked.

Flags

-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 domain. 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.
-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.
-d days_of_week

Specifies the days of the week when he 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 numbers of the days follow:

1
Sunday
2
Monday
3
Tuesday
4
Wednesday
5
Thursday
6
Friday
7
Saturday
-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.

-s action_script
Specifies the fully-qualified path for the script or command to run for the action being defined. See the man pages for logevent, notifyevent, and wallevent for descriptions of the predefined response scripts provided with the application.
-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.
-e a | r | b
Specifies the type of event that causes the action being defined to run:
a
Event. This is the default.
r
Rearm event.
b
Both event and rearm event.
-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.
-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.
-u
Specifies that the action is to be run when a monitored resource becomes undefined.
-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.
-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 RSCT Guide and Reference 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_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.

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 any time" that has an action named "E-mail root", to be used any time Saturday and Sunday and uses the command /usr/sbin/rsct/bin/notifyevent root for both events and rearm events, run this command:
     mkresponse -n "E-mail root" -d 1+7  \                          
    -s "/usr/sbin/rsct/bin/notifyevent root" -e b   \          
    "E-mail root any time"
  3. To define a response with the name "E-mail root any time" 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 /usr/sbin/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 "/usr/sbin/rsct/bin/notifyevent root" -e a  \           
    "E-mail root any time"
  4. To define a response with the name "E-mail root any time" that has an action named "E-mail root" to be used any time Saturday and Sunday, that uses the command /usr/sbin/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 "/usr/sbin/rsct/bin/notifyevent root" -e b \        
    -E LANG="en_US"  "E-mail root any time"
  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 /usr/sbin/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 "/usr/sbin/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"

These examples apply to management domains:

  1. To define a response on the management server with the name "E-mail root any time" that has an action named "E-mail root", to be used any time Saturday and Sunday and uses the command /usr/sbin/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 "/usr/sbin/rsct/bin/notifyevent root" -e b   \          
    "E-mail root any time"
  2. To define a response on the managed node nodeB with the name "E-mail root any time" that has an action named "E-mail root", to be used any time Saturday and Sunday and uses the command /usr/sbin/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 "/usr/sbin/rsct/bin/notifyevent root" -e b   \          
    -p nodeB "E-mail root any time"
  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 any time" that has an action named "E-mail root", to be used any time Saturday and Sunday and uses the command /usr/sbin/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 "/usr/sbin/rsct/bin/notifyevent root" -e b   \          
    "E-mail root any time"
  2. To define a response on the node nodeB in the domain with the name "E-mail root any time" that has an action named "E-mail root", to be used any time Saturday and Sunday, that uses the command /usr/sbin/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 "/usr/sbin/rsct/bin/notifyevent root" -e b   \          
    -p nodeB -E 'ENV1="PAGE ALL", ENV2="TIMER SET"' \  
    "E-mail root any time"
  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

/usr/sbin/rsct/bin/mkresponse
Contains the mkresponse command

Related Information

ERRM commands: chresponse, lsresponse, mkcondition, mkcondresp, rmresponse, startcondresp

Files: rmccli

Books: see the RSCT Guide and Reference for more information about ERRM operations

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]