Sun Cluster 数据服务开发者指南(适用于 Solaris OS)

Monitor_check 方法

每当 PROBE 方法视图将包含数据服务的资源组故障切换到新节点上时,RGM 都将调用 Monitor_check 方法。

本小节介绍了应用程序样例中的 Monitor_check 方法的重要方面, 但未介绍所有回叫方法都通用的功能,例如 parse_args() 函数和获取 syslog 工具,这些在为所有方法提供通用功能中介绍。

要获得 Monitor_check 方法的完整列表,请参阅Monitor_check 方法

必须实现 Monitor_check 方法,以免与当前运行的其它方法发生冲突。

Monitor_check 方法调用 Validate 方法检验 DNS 配置目录在新节点上是否可用。 Confdir 扩展特性指向 DNS 配置目录。 因此,Monitor_check 将获取 Validate 方法的路径和名称以及 Confdir 的值。 它将把此值传送到 Validate,如下所示。


# Obtain the full path for the Validate method from
# the RT_BASEDIR property of the resource type.
RT_BASEDIR=`scha_resource_get -O RT_BASEDIR -R $RESOURCE_NAME \
   -G $RESOURCEGROUP_NAM?

# Obtain the name of the Validate method for this resource.
VALIDATE_METHOD=`scha_resource_get -O VALIDATE \
   -R $RESOURCE_NAME -G $RESOURCEGROUP_NAM?

# Obtain the value of the Confdir property in order to start the
# data service. Use the resource name and the resource group entered to
# obtain the Confdir value set at the time of adding the resource.
config_info=`scha_resource_get -O Extension -R $RESOURCE_NAME \
 -G $RESOURCEGROUP_NAME Confdir`

# scha_resource_get returns the type as well as the value for extension
# properties. Use awk to get only the value of the extension property.
CONFIG_DIR=`echo $config_info | awk `{print $2}'`

# Call the validate method so that the dataservice can be failed over 
# successfully to the new node.
$RT_BASEDIR/$VALIDATE_METHOD -R $RESOURCE_NAME -G $RESOURCEGROUP_NAME \
   -T $RESOURCETYPE_NAME -x Confdir=$CONFIG_DIR

要了解应用程序样例如何检验一个节点是否适合用作数据服务主机,请参阅Validate 方法