scha_resourcegroup_get -O optag -G group [-Z zonecluster] [args]
The scha_resourcegroup_get command accesses information about a resource group that is under the control of the Resource Group Manager (RGM) cluster facility.
This command is intended to be used in shell script implementations of the callback methods for resource types. These resource types represent services that are controlled by the cluster's RGM. This command provides the same information as the scha_resourcegroup_get() C function. For more information, see the scha_resourcegroup_open(3HA) man page.
Information is generated by the command to standard output (stdout) in formatted strings as described in scha_cmds(1HA). The output is a string or several strings on separate lines. The output can be stored in shell variables and parsed using shell facilities or awk (1) for further use by the script.
You need solaris.cluster.resource.read role-based access control (RBAC) authorization to use this command. See rbac (5) .
You must also be able to assume a role to which the Oracle Solaris Cluster Commands rights profile has been assigned to use this command. Authorized users can issue privileged Oracle Solaris Cluster commands on the command line from the pfsh (1) , pfcsh (1) , or pfksh (1) profile shell. A profile shell is a special kind of shell that enables you to access privileged Oracle Solaris Cluster commands that are assigned to the Oracle Solaris Cluster Commands rights profile. A profile shell is launched when you run su (1M) to assume a role. You can also use pfexec (1) to issue privileged Oracle Solaris Cluster commands.
The following options are supported:
Name of the resource group.
Specifies the information that is to be accessed. Depending on the optag that you specify, you might need to include an additional operand to indicate the node or zone for which information is to be retrieved.
The following optag values retrieve the corresponding resource group properties. The value of the named property of the resource group is generated. The RG_STATE property refers to the value on the particular node where the command is executed.
ALL_LOAD_FACTORS ALL_LOAD_FACTOR_NAMES AUTO_START_ON_NEW_CLUSTER DESIRED_PRIMARIES FAILBACK GLOBAL_RESOURCES_USED IMPLICIT_NETWORK_DEPENDENCIES LOAD_FACTOR MAXIMUM_PRIMARIES NODELIST PATHPREFIX PINGPONG_INTERVAL PREEMPTION_MODE PRIORITY RESOURCE_LIST RG_AFFINITIES RG_DEPENDENCIES RG_DESCRIPTION RG_IS_FROZEN RG_MODE RG_PROJECT_NAME RG_SLM_TYPE RG_SLM_PSET_TYPE RG_SLM_CPU RG_SLM_CPU_MIN RG_STATE RG_STATE_NODE RG_SYSTEM SUSPEND_AUTOMATIC_RECOVERY TARGET_NODES
Specifies the cluster in which the resource group exists and on which you want to operate. This option is applicable when the command is executed in the global zone but needs to operate on a specified zone cluster. It cannot be used within a zone cluster to access a different zone cluster.
Specifies that the query is to be performed in the zone cluster named zoneclustername.
If the –Z option is omitted, the query is performed in the cluster in which the command is executed.
To query the value of a per-zone property such as resource group state in the global cluster, do not use the –Z option. Instead, use the per-zone form of the query tag. For example, use RG_STATE_NODE instead of RG_STATE, and provide an extra command-line argument of the form nodename:zonename.
The following script is passed a –G argument, which provides the required resource group name. Next, the scha_resourcegroup_get command is used to get the list of resources in the resource group.
#!/bin/sh while getopts G: opt do case $opt in G) group="$OPTARG";; esac done resource_list=`scha_resourcegroup_get -O Resource_list -G $group` for resource in $resource_list do printf "Group: %s contains resource: %s\n" "$group" "$resource" doneExample 2 Using the scha_resourcegroup_get Command to Query All Load Factors on a Resource Group
Use the following command to view all load factors on a resource group called rg1.
# scha_resourcegroup_get -O ALL_LOAD_FACTORS -G rg1 factor1=50 factor2=1 factor3=0Example 3 Using the scha_resourcegroup_get Command to List All Defined Load Factor Names for a Resource Group
Use the following command to retrieve a list of all defined load factors on a resource group called rg1.
# scha_resourcegroup_get -O ALL_LOAD_FACTOR_NAMES -G rg1 factor1 factor2 factor3Example 4 Using the scha_resourcegroup_get Command to Query a Specific Load Factor for a Resource Group
Use the following command to view a specific defined load factor on a resource group called rg1.
# scha_resourcegroup_get -O LOAD_FACTOR -G rg1 factor1 50Example 5 Using the scha_resourcegroup_get Command to Query the Priority of a Resource Group
Use the following command to view the priority set for a resource group called rg1.
# scha_resourcegroup_get -O PRIORITY -G rg1 501Example 6 Using the scha_resourcegroup_get Command to Query the Preemption Mode for a Resource Group
Use the following command to view the preemption mode set for a resource group called rg1.
# scha_resourcegroup_get -O PREEMPTION_MODE -G rg1 Has_Cost
The following exit status codes are returned:
The command completed successfully.
An error occurred.
Failure error codes are described scha_calls(3HA).
See attributes (5) for descriptions of the following attributes: