mkrsrc Command

Purpose

Defines a new resource.

Syntax

To define a new resource, using data that is...
  • entered on the command line:

    mkrsrc [ -a | -N { node_file | "-" } ] [-v] [-h] [-TV] resource_class attr=value…

  • predefined in an input file:

    mkrsrc -f resource_data_input_file [-v] [ -a | -N { node_file | "-" } ] [-h] [-TV] resource_class

To display the names and datatypes of the command arguments:

mkrsrc -l [ -h ] resource_class

To see examples of the mkrsrc command for a resource class:

mkrsrc -e [-h] [-TV] resource_class

Description

The mkrsrc command requests that the RMC subsystem define a new resource instance for the class specified by the resource_class parameter. At least one persistent attribute name and its value must be specified either as a parameter or by a resource definition file using the -f flag.

Before you run mkrsrc, you should run the lsrsrcdef command to determine which attributes are designated as reqd_for_define (required) or option_for_define (optional). Only attributes that are designated as reqd_for_define or option_for_define can be defined using the mkrsrc command. The lsrsrcdef command also identifies the datatype for each attribute. The value specified for each attribute must match this datatype.

To verify that all of the attribute names that are specified on the command line or in resource_data_input_file are defined as persistent attributes and are designated as reqd_for_define or option_for_define, use the -v flag. When the mkrsrc command is run with the -v flag, the resource is not defined. Instead, the resource attributes are merely verified to be persistent and designated as reqd_for_define or option_for_define. Once you have run mkrsrc -v to verify that all of the attributes that are specified on the command line or in resource_data_input_file are valid, you can issue the mkrsrc command without the -v flag to define the new resource.

If you are running in an RSCT peer domain or on the management server in an RSCT management domain and the resource class management type is subdivided, you can create the same resource on multiple nodes in one of two ways. The first way is to use the -N node_file flag to indicate that the node names to create the resources on are in a file. Use -N "-" to read the node names from standard input. The second way is to specify multiple node names in the NodeNameList resource attribute. The NodeNameList attribute defines where the resource is created when a cluster is present. If the NodeNameList attribute is not used, the resource is created on the local node. To find out if a resource class management type is subdivided, enter lsrsrcdef -c resource_class | grep properties.

Flags

-e
Displays examples of mkrsrc command-line input for:
  1. required attributes only
  2. required and optional attributes
-f resource_data_input_file
Specifies the name of the file that contains resource attribute information.
-l
Lists the command arguments and datatypes. Some resource managers accept additional arguments that are passed to the define request. Use this flag to list any defined command arguments and the datatypes of the command argument values.
-N { node_file | "-" }
Specifies that node names are read from a file or from standard input. Use -N node_file to indicate that the node names are in a file.
  • There is one node name per line in node_file
  • A number sign (#) in column 1 indicates that the line is a comment
  • Any blank characters to the left of a node name are ignored
  • Any characters to the right of a node name are ignored
Use -N "-" to read the node names from standard input.

The CT_MANAGEMENT_SCOPE environment variable determines the scope of the cluster. If the resource class management type of the resource that is to be defined is subdivided and CT_MANAGEMENT_SCOPE is not set, management domain scope is chosen first (if a management domain exists), peer domain scope is chosen next (if a peer domain exists), and then local scope is chosen, until the scope is valid for the command. The command runs once for the first valid scope it finds. For example, if a management domain and a peer domain both exist and CT_MANAGEMENT_SCOPE is not set, this command applies to the management domain. If you want this command to apply to the peer domain, set CT_MANAGEMENT_SCOPE to 2.

-v
Verifies that all of the attribute names specified on the command line or in the input file are defined as persistent attributes and are designated as reqd_for_define or option_for_define. The mkrsrc command does not define any resources when you use this flag.
-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

resource_class
Specifies the resource class name of the resource to be defined.
attr=value…
Specifies the attributes of the resource being defined. When defining a new resource instance, there are specific required attributes for each resource that must be defined. These attributes can be specified as parameters on the command line or defined in an input file by using the -f flag.
attr
The name of a persistent attribute for this resource. This attribute must be designated as reqd_for_define or option_for_define. Use the lsrsrcdef command to check the designation.
value
The value for this persistent attribute. The data type for this value must match the defined data type for the value of this attribute. Use the lsrsrcdef command to verify the data type for each attribute.

Security

The user needs write permission for the resource_class specified in mkrsrc to run mkrsrc. Permissions are specified in the access control list (ACL) file on the contacted system. See Administering RSCT guide for information about the ACL file and how to modify it.

Exit Status

0
The command has run successfully.
1
An error occurred with RMC.
2
An error occurred with the command-line interface (CLI) script.
3
An incorrect flag was specified on the command line.
4
An incorrect parameter was specified on the command line.
5
An error occurred with RMC that was based on incorrect command-line input.

Environment Variables

CT_CONTACT
When the CT_CONTACT environment variable is set to a host name or IP address, the command contacts the Resource Monitoring and Control (RMC) daemon on the specified host. If the environment variable is not set, the command contacts the RMC daemon on the local system where the command is being run. The resource class or resources that are displayed or modified by the command are located on the system to which the connection is established.
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 to monitor and control the resources and resource classes. The management scope determines the set of possible target nodes where the resources and resource classes can be monitored and controlled. 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 rsct.rmc fileset for the AIX® operating system.

Standard Output

Standard Error

All trace messages are written to standard error.

Examples

  1. To create a new resource in the IBM.Host class, assuming you already know which persistent attributes are required when defining a resource of this class, enter:
    mkrsrc IBM.Host Name=c175n05
  2. To create a new resource in the IBM.Processor class by first generating a template to aid in the defining of these resources, enter:
    lsrsrcdef -i IBM.Processor > /tmp/IBM.Processor.rdef

    Then, edit the file /tmp/IBM.Processor.rdef and enter values for all of the attributes, substituting the type for an appropriate value, or leaving it blank for the default value.

    Finally, enter:
    mkrsrc -f /tmp/IBM.Processor.rdef IBM.Processor
  3. To create two new IBM.Host resources using the information defined in file /tmp/IBM.Host.rdef, enter:
    mkrsrc -f /tmp/IBM.Host.rdef IBM.Host
    where the file /tmp/IBM.Host.rdef looks like this:
    PersistentResourceAttributes::
    resource 1:
        Name        = c175n04
    
    resource 2:
        Name        = c175n05 
  4. This example creates a new resource in the IBM.Foo class. In this class, Name and NodeList are required attributes. The Binary, SD, StringArray, and SDArray attributes are optional. This example shows how to enter the more difficult data types from the command line. The data types for the optional attributes (Binary, SD, StringArray, and SDArray) are self-explanatory. Enter:
    mkrsrc IBM.Foo Name=c175n05 \
    NodeList={1} \
    Binary="0xaabbccddeeff00" \
    SD='[testing123,1,{2,4,6}]' \
    StringArray='{"testing 1 2 3",testing123,"testing 1 2 3"}' \
    SDArray='{["testing 1 2 3",1,{1,3,5}],[testing,2,{2,4,6}]}'
  5. To create resources for the IBM®.Example class on multiple nodes in a peer domain, run this command:
    mkrsrc -N /u/joe/common_node_file  IBM.Example  Name=Example_bar1 \
    Binary="0xaabbccddeeff00"
    where the contents of /u/joe/common_node_file look like this:
    # common node file
    #
    node1.ibm.com      main node
    node2.ibm.com      main node
    node4.ibm.com      backup node
    node6.ibm.com      backup node
    #
  6. To create resources of the IBM.Example class on multiple managed nodes in a management domain, run this command on the management server:
    mkrsrc IBM.Example  Name=Example_bar1 Binary="0xaabbccddeeff00" \
    NodeNameList='{"mgnode1.ibm.com","mgnode2.ibm.com"}'
    where the contents of /u/joe/common_node_file look like this:
    # common node file
    #
    node1.ibm.com      main node
    node2.ibm.com      main node
    node4.ibm.com      backup node
    node6.ibm.com      backup node
    #
Note: As discussed in the rmccli general information file, attribute values for certain data types (structured data, array of structured data, and arrays containing strings enclosed in double quotation marks) should be enclosed in single quotation marks.

Location

/usr/sbin/rsct/bin/mkrsrc