在节点上启动资源后,RGM 将对该节点调用 Monitor_start 方法,以启动故障监视器。 xfnts_monitor_start 方法将使用 scds_pmf_start() 在 PMF 的控制下启动监视器守护程序。
在 xfnts_monitor_start 中首先调用的是 scds_initialize(),该函数可以执行一些必要的内务处理功能(scds_initialize() 函数和 scds_initialize(3HA) 手册页中包含了详细信息)。
xfnts_monitor_start 方法将调用在 xfnts.c 中定义的 mon_start 方法,如下所示。
scds_syslog_debug(DBG_LEVEL_HIGH, "Calling Monitor_start method for resource <%s>.", scds_get_resource_name(scds_handle)); /* Call scds_pmf_start and pass the name of the probe. */ err = scds_pmf_start(scds_handle, SCDS_PMF_TYPE_MON, SCDS_PMF_SINGLE_INSTANCE, "xfnts_probe", 0); if (err != SCHA_ERR_NOERR) { scds_syslog(LOG_ERR, "Failed to start fault monitor."); return (1); } scds_syslog(LOG_INFO, "Started the fault monitor."); return (SCHA_ERR_NOERR); /* Successfully started Monitor */ }
请注意以下关于在 svc_mon_start() 中调用 scds_pmf_start() 函数的内容。
SCDS_PMF_TYPE_MON 参数用来标识要作为故障监视器启动的程序 — 此方法也可以启动数据服务或一些其它类型的应用程序。
SCDS_PMF_SINGLE_INSTANCE 参数用来将此资源标识为单实例资源。
xfnts_probe 参数用来标识要启动的监视器守护程序。 假设监视器守护程序与其它回叫程序位于同一个目录。
最后一个参数 0 用来指定子监视级别 — 在这种情况下,仅监视监视器守护程序。
在退出之前,xfnts_monitor_start 方法将调用 scds_close() 来回收通过 scds_initialize() 分配的资源。 有关详细信息,请参阅scds_initialize() 函数和 scds_close(3HA) 手册页。