JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Cluster Reference Manual     Oracle Solaris Cluster
search filter icon
search icon

Document Information

Preface

Introduction

OSC33 1

OSC33 1cl

OSC33 1ha

rt_callbacks(1HA)

scdsbuilder(1HA)

scdsconfig(1HA)

scdscreate(1HA)

scha_cluster_get(1HA)

scha_cmds(1HA)

scha_control(1HA)

scha_resource_get(1HA)

scha_resourcegroup_get(1HA)

scha_resource_setstatus(1HA)

scha_resourcetype_get(1HA)

OSC33 1m

OSC33 3ha

OSC33 4

OSC33 5

OSC33 5cl

OSC33 7

OSC33 7p

Index

scha_resource_get

- access resource information

Synopsis

scha_resource_get [-Q] -O optag -R resource [-G group]

 [-Z zoneclustername] [args]

Description

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.

Options

The following options are supported:

-G group

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.

-O optag

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 or zone 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 or zone 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.

The EXTENSION property also refers to the value on the node or zone where the command is executed, provided that the PER_NODE property attribute is set. See the property_attributes(5) man page.

AFFINITY_TIMEOUT

ALL_EXTENSIONS

BOOT_TIMEOUT

CHEAP_PROBE_INTERVAL

EXTENSION

EXTENSION_NODE

FAILOVER_MODE

FINI_TIMEOUT

GLOBAL_ZONE_OVERRIDE

GROUP

INIT_TIMEOUT

LOAD_BALANCING_POLICY

LOAD_BALANCING_WEIGHTSMONITORED_SWITCH

MONITORED_SWITCH_NODE

MONITOR_CHECK_TIMEOUT

MONITOR_START_TIMEOUT

MONITOR_STOP_TIMEOUT

NETWORK_RESOURCES_USED

NUM_RESOURCE_RESTARTSNUM_RESOURCE_RESTARTS_ZONE

NUM_RG_RESTARTSNUM_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.

ALL_EXTENSIONS

Generates, on successive lines, the names of all extension properties of the resource.

EXTENSION

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 or zone 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.

EXTENSION_NODE

Generates the type of property followed by its value, on successive lines, for the named node or zone. This value requires two unflagged arguments, in the following order, that name an extension of the resource on a particular node or zone:

  • Extension property name

  • Node or zone 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 or zone 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.

GROUP

Generates the name of the resource group in which the resource is configured.

RESOURCE_STATE_NODE

Generates the value of the resource's RESOURCE_STATE property for the named node or zone. Requires an unflagged argument that names a node or zone.

STATUS_NODE

Generates the value of the resource's STATUS property for the named node or zone. Requires an unflagged argument that names a node or zone.

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.

-Q

Include any specified qualifiers in resource dependency lists. The {LOCAL_NODE}, {ANY_NODE}, and {FROM_RG_AFFINITIES} qualifiers are described in the r_properties(5) man page. If you omit the -Q option, the returned value of resource dependency lists contain only the resource names, without any declared qualifiers.

-R resource

The name of a resource that is being managed by the RGM cluster facility.

-Z zoneclustername

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.

zoneclustername

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 state in the global cluster, do not use the -Z option. Instead, use the per-zone form of the query tag. For example, use RESOURCE_STATE_NODE instead of RESOURCE_STATE, and provide an extra command-line argument of the form nodename:zonename.

Examples

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

# 

Exit Status

The following exit status codes are returned:

0

The command completed successfully.

nonzero

An error occurred.

Failure error codes are described in scha_calls(3HA).

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
SUNWscdev
Interface Stability
Evolving

See Also

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)