无论 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 方法的工作方式,以查看样例应用程序如何验证某节点主管数据服务的适当性。