Skip Navigation Links | |
Exit Print View | |
![]() |
Oracle Solaris Cluster Reference Manual Oracle Solaris Cluster 4.1 |
- access resource information
scha_resource_get [-Q] -O optag -R resource [-G group] [-Z zoneclustername] [args]
The scha_resource_get command accesses information about a resource that is under the control of the Resource Group Manager (RGM). You can use this command to query the properties of the resource's type, as described in rt_properties(5), as well as the properties of the resource, as described in r_properties(5).
Use the scha_resource_get command in shell script implementations of the callback methods for resource types that represent services that are controlled by the cluster's RGM. This command provides the same information as the scha_resource_get(3HA) C function.
Information is generated by the command to stdout in formatted strings on separate lines, as described in scha_cmds(1HA). The output can be stored in shell variables and parsed by 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:
The name of the resource group in which the resource has been configured. Although this argument is optional, the command will run more efficiently if you include it.
Indicates the information to be accessed. Depending on the optag value that you specify, you might need to include an additional value to indicate the cluster node for which information is to be retrieved.
Note - optag values, such as AFFINITY_TIMEOUT and BOOT_TIMEOUT, are not case sensitive. You can use any combination of uppercase and lowercase letters when you specify optag values.
The following optag values retrieve the corresponding resource properties. The value of the named property of the resource is generated. The NUM_RG_RESTARTS, NUM_RESOURCE_RESTARTS, MONITORED_SWITCH, ON_OFF_SWITCH, RESOURCE_STATE, and STATUS properties refer to the value on the node where the command is executed. See the r_properties(5) man page for descriptions of the resource properties that correspond to the following optag values. Note that some optag values in the following list are described after the list rather than in the r_properties(5) man page.
AFFINITY_TIMEOUT ALL_EXTENSIONS APPLICATION_USER BOOT_TIMEOUT CHEAP_PROBE_INTERVAL EXTENSION EXTENSION_NODE FAILOVER_MODE FINI_TIMEOUT GLOBAL_ZONE_OVERRIDE GROUP INIT_TIMEOUT LOAD_BALANCING_POLICY LOAD_BALANCING_WEIGHT SMONITORED_SWITCH MONITORED_SWITCH_NODE MONITOR_CHECK_TIMEOUT MONITOR_START_TIMEOUT MONITOR_STOP_TIMEOUT NETWORK_RESOURCES_USED NUM_RESOURCE_RESTARTS NUM_RESOURCE_RESTARTS_ZONE NUM_RG_RESTARTS NUM_RG_RESTARTS_ZONE ON_OFF_SWITCH ON_OFF_SWITCH_NODE PORT_LIST POSTNET_STOP_TIMEOUT PRENET_START_TIMEOUT RESOURCE_DEPENDENCIES RESOURCE_DEPENDENCIES_OFFLINE_RESTART RESOURCE_DEPENDENCIES_RESTART RESOURCE_DEPENDENCIES_WEAK RESOURCE_PROJECT_NAME RESOURCE_STATE RESOURCE_STATE_NODE RETRY_COUNT RETRY_INTERVAL R_DESCRIPTION SCALABLE START_TIMEOUT STATUS STATUS_NODE STOP_TIMEOUT THOROUGH_PROBE_INTERVAL TYPE TYPE_VERSION UDP_AFFINITY UPDATE_TIMEOUT VALIDATE_TIMEOUT WEAK_AFFINITY
The following optag values are not described in the r_properties(5) man page.
Generates, on successive lines, the names of all extension properties of the resource.
Generates the type of property followed by its value, on successive lines. If the property is a per-node extension property, the value that is returned is the value of the property on the node on which scha_resource_get is executed. Requires an unflagged argument that names an extension property of the resource. Shell scripts might need to discard the type to obtain the value, as shown in EXAMPLES.
When a user requests the value of this property on a node for which an explicit value has not been assigned, the default value that is declared in the Resource Type Registration (RTR) file is returned. See the rt_reg(4) man page.
Generates the type of property followed by its value, on successive lines, for the named node. This value requires two unflagged arguments, in the following order, that name an extension of the resource on a particular node:
Extension property name
Node name
Shell scripts might need to discard the type to obtain the value.
When a user requests the value of this property on a node for which an explicit value has not been assigned, the default value that is declared in the RTR file is returned. See the rt_reg(4) man page.
Generates the name of the resource group in which the resource is configured.
Generates the value of the resource's RESOURCE_DEPENDENCIES property for the named node. Requires an unflagged argument that names a node.
Generates the value of the resource's RESOURCE_DEPENDENCIES_OFFLINE_RESTART property for the named node. Requires an unflagged argument that names a node.
Generates the value of the resource's RESOURCE_DEPENDENCIES_RESTART property for the named node. Requires an unflagged argument that names a node.
Generates the value of the resource's RESOURCE_DEPENDENCIES_WEAK property for the named node. Requires an unflagged argument that names a node.
Generates the value of the resource's RESOURCE_STATE property for the named node. Requires an unflagged argument that names a node.
Generates the value of the resource's STATUS property for the named node. Requires an unflagged argument that names a node.
The following optag values retrieve the corresponding resource type properties. The value of the named property of the resource's type is generated.
Note - optag values, such as API_VERSION and BOOT, are not case sensitive. You can use any combination of uppercase and lowercase letters when you specify optag values.
For descriptions of resource type properties, see rt_properties(5).
API_VERSION BOOT FAILOVER FINI GLOBAL_ZONE INIT INIT_NODES INSTALLED_NODES IS_LOGICAL_HOSTNAME IS_SHARED_ADDRESS MONITOR_CHECK MONITOR_START MONITOR_STOP PKGLIST POSTNET_STOP PRENET_START PROXY RT_BASEDIR RT_DESCRIPTION RT_SYSTEM RT_VERSION SINGLE_INSTANCE START STOP UPDATE VALIDATE
If this resource's type declares the GLOBAL_ZONE_OVERRIDE resource property, the value that is retrieved by the GLOBAL_ZONE optag is the current value of the GLOBAL_ZONE_OVERRIDE property, rather than the value of the GLOBAL_ZONE property. For more information, see the description of the Global_zone property in the rt_properties(5) man page and the Global_zone_override property in the r_properties(5) man page.
Include any specified qualifiers in resource dependency lists. The {LOCAL_NODE}, {ANY_NODE}, @nodename, and {FROM_RG_AFFINITIES} qualifiers are described in the r_properties(5) man page. If you omit the -Q option, the returned value of a resource dependency list contains only the resource names for dependencies that are applicable on the local node, without any declared qualifiers.
The name of a resource that is being managed by the RGM cluster facility.
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.
Example 1 Sample Script That Uses the scha_resource_get Command
The following script is passed -R and -G arguments, which provide the required resource name and resource group name. Next, the scha_resource_get command accesses the Retry_count property of the resource and the enum-type LogLevel extension property of the resource.
#!/bin/sh while getopts R:G: opt do case $opt in R) resource="$OPTARG";; G) group="$OPTARG";; esac done retry_count=`scha_resource_get -O Retry_count -R $resource \\ -G $group` printf "retry count for resource %s is %d\n" $resource \\ $retry_count LogLevel_info=`scha_resource_get -O Extension -R $resource \\ -G $group LogLevel` # Get the enum value that follows the type information # of the extension property. Note that the preceding # assignment has already changed the newlines separating # the type and the value to spaces for parsing by awk. loglevel=`echo $LogLevel_info | awk '{print $2}'`
Example 2 Using the scha_resource_get Command With and Without the -Q Option to Query Resource Dependencies
This example shows how to use the clresource command to create a resource named myres, with several resource dependencies that have a {LOCAL_NODE} scope qualifier, a {ANY_NODE} scope qualifier, or no scope qualifier. This example then shows how to use the scha_resource_get command to query the Resource_dependencies property. Without the -Q option, only resource names are returned. With the -Q option, the declared scope qualifiers are returned as well.
# clresource create -g mygrp -t myrestype \ -p Resource_dependencies=myres2{LOCAL_NODE},myres3{ANY_NODE},myres4 \ myres # scha_resource_get -O Resource_dependencies -R myres -G mygrp myres2 myres3 myres4 # scha_resource_get -Q -O Resource_dependencies -R myres -G mygrp myres2{LOCAL_NODE} myres3{ANY_NODE} myres4 #
Example 3 Viewing Resource Dependency Properties
The following example shows how to use the scha_resource_get command to retrieve a per-node resource dependency that is dependent on two different logical hostname resources. To set a per-node resource dependency, you must use the clresource set command. The example uses a scalable resource called gds-rs and sets the dependency of gds-rs on trancos-3-rs on ptrancos1 and trancos-4-rs on ptrancos2.
From the ptrancos1 node:
ptrancos1(/root)$ scha_resource_get -O RESOURCE_DEPENDENCIES -R gds-rs trancos-3-rs ptrancos1(/root)$ scha_resource_get -O RESOURCE_DEPENDENCIES_NODE -R gds-rs ptrancos1 trancos-3-rs ptrancos1(/root)$ scha_resource_get -O RESOURCE_DEPENDENCIES_NODE -R gds-rs ptrancos2 trancos-4-rs ptrancos1(/root)$ scha_resource_get -Q -O RESOURCE_DEPENDENCIES -R gds-rs trancos-3-rs@ptrancos1 trancos-4-rs@ptrancos2 ptrancos1(/root)$ scha_resource_get -O NETWORK_RESOURCES_USED -R gds-rs trancos-3-rs
From the ptrancos2 node:
ptrancos2(/root)$ scha_resource_get -O RESOURCE_DEPENDENCIES -R gds-rs trancos-4-rs ptrancos2(/root)$ scha_resource_get -O RESOURCE_DEPENDENCIES_NODE -R gds-rs ptrancos1 trancos-3-rs ptrancos2(/root)$ scha_resource_get -O RESOURCE_DEPENDENCIES_NODE -R gds-rs ptrancos2 trancos-4-rs ptrancos2(/root)$ scha_resource_get -Q -O RESOURCE_DEPENDENCIES -R gds-rs trancos-3-rs@ptrancos1 trancos-4-rs@ptrancos2 ptrancos2(/root)$ scha_resource_get -O NETWORK_RESOURCES_USED -R gds-rs trancos-4-rs
The following exit status codes are returned:
The command completed successfully.
An error occurred.
Failure error codes are described in scha_calls(3HA).
See attributes(5) for descriptions of the following attributes:
|
awk(1), scha_cmds(1HA), scha_calls(3HA), scha_resource_get(3HA), rt_reg(4), attributes(5), property_attributes(5), r_properties(5), rt_properties(5)