Solaris OS용 Sun Cluster 데이터 서비스 개발 안내서

오류 모니터 데몬 디자인

DSDL을 사용한 자원 유형 구현에는 일반적으로 다음 작업을 담당하는 오류 모니터 데몬이 있습니다.

DSDL 유틸리티는 오류 모니터 데몬의 주 루프가 이 장의 끝에 나오는 의사 코드로 표시될 수 있도록 설계되었습니다.

DSDL을 사용하여 오류 모니터를 구현하는 경우 다음을 명심하십시오.

대부분의 경우 응용 프로그램 특정 상태 검사 작업은 별도의 독립 실행형 유틸리티(예: svc_probe())에서 구현되고 다음과 같은 일반적인 주 루프와 통합될 수 있습니다.

for (;;) {
   /* sleep for a duration of thorough_probe_interval between
   *  successive probes.
   */
   (void) scds_fm_sleep(scds_handle,
   scds_get_rs_thorough_probe_interval(scds_handle));
   /* Now probe all ipaddress we use. Loop over
   * 1. All net resources we use.
   * 2. All ipaddresses in a given resource.
   * For each of the ipaddress that is probed,
   * compute the failure history. 
   */
   probe_result = 0;
   /* Iterate through the all resources to get each
   * IP address to use for calling svc_probe()
   */
   for (ip = 0; ip < netaddr->num_netaddrs; ip++) {
   /* Grab the hostname and port on which the
   * health has to be monitored.
   */
   hostname = netaddr->netaddrs[ip].hostname;
   port = netaddr->netaddrs[ip].port_proto.port;
   /*
   * HA-XFS supports only one port and
   * hence obtaint the port value from the
   * first entry in the array of ports.
   */
   ht1 = gethrtime();
   /* Latch probe start time */
   probe_result = svc_probe(scds_handle, hostname, port, timeout);
   /*
   * Update service probe history,
   * take action if necessary.
   * Latch probe end time.
   */
   ht2 = gethrtime();
   /* Convert to milliseconds */
   dt = (ulong_t)((ht2 - ht1) / 1e6);
   /*
   * Compute failure history and take
   * action if needed
   */
   (void) scds_fm_action(scds_handle,
   probe_result, (long)dt);
   }       /* Each net resource */
   }       /* Keep probing forever */