Sun Cluster 資料服務開發者指南 (適用於 Solaris 作業系統)

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 方法,以查看應用程式範例如何確認節點扥管資料服務的適合性。