/[monit]/monit/validate.c
ViewVC logotype

Diff of /monit/validate.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.95 by hauk, Fri Oct 17 16:00:54 2003 UTC revision 1.96 by hauk, Fri Oct 17 17:18:32 2003 UTC
# Line 547  static int check_device(Service_T s) { Line 547  static int check_device(Service_T s) {
547   */   */
548  static int check_remote_host(Service_T s) {  static int check_remote_host(Service_T s) {
549    
550    Port_T pp;    Port_T p= NULL;
   Icmp_T icmp;  
551    char report[STRLEN]={0};    char report[STRLEN]={0};
552      Icmp_T icmp, last_ping= NULL;
553    
554    /* Test each icmp type in the service's icmplist */    /* Test each icmp type in the service's icmplist */
555    for(icmp= s->icmplist; icmp; icmp= icmp->next) {    for(icmp= s->icmplist; icmp; icmp= icmp->next) {
556      if(!check_icmp_connection(s, icmp, report)) {      if(!check_icmp_connection(s, icmp, report)) {
557        icmp->is_available= FALSE;        icmp->is_available= FALSE;
558          last_ping= icmp;
559        if(! icmp->event_handled) {        if(! icmp->event_handled) {
560          icmp->event_handled= TRUE;          icmp->event_handled= TRUE;
561          icmp->event_flag= TRUE;          icmp->event_flag= TRUE;
# Line 569  static int check_remote_host(Service_T s Line 570  static int check_remote_host(Service_T s
570      }      }
571    }    }
572    
573      /* If we could not ping the host we assume it's down and do not
574       * continue to check any port connections  */
575      if(last_ping && !last_ping->is_available) {
576        DEBUG("'%s' icmp ping failed, skipping any port connection tests\n",
577              s->name);
578        return FALSE;
579      }
580        
581    
582    /* Test each host:port and protocol in the service's portlist */    /* Test each host:port and protocol in the service's portlist */
583    for(pp= s->portlist; pp; pp= pp->next) {    for(p= s->portlist; p; p= p->next) {
584      if(!check_process_connection(s, pp, report)) {      if(!check_process_connection(s, p, report)) {
585        pp->is_available= FALSE;        p->is_available= FALSE;
586        if(! pp->event_handled) {        if(! p->event_handled) {
587          pp->event_flag= TRUE;          p->event_flag= TRUE;
588          pp->event_handled= TRUE;          p->event_handled= TRUE;
589          if(! eval_actions(pp->action, s, report, "connection",          if(! eval_actions(p->action, s, report, "connection",
590                            EVENT_CONNECTION)) {                            EVENT_CONNECTION)) {
591            return FALSE;            return FALSE;
592          }          }
593        }        }
594      } else {      } else {
595        pp->is_available= TRUE;        p->is_available= TRUE;
596        pp->event_handled= FALSE;        p->event_handled= FALSE;
597      }      }
598    }    }
599    

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.96

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26