/[monit]/monit/p.y
ViewVC logotype

Diff of /monit/p.y

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

revision 1.122 by hauk, Wed Sep 10 00:32:41 2003 UTC revision 1.123 by martinp, Wed Sep 10 16:15:30 2003 UTC
# Line 208  Line 208 
208    static void  addservice(Service_T);    static void  addservice(Service_T);
209    static void  addmail(char *, Mail_T, unsigned int);    static void  addmail(char *, Mail_T, unsigned int);
210    static void  createservice(int, char *, char *);    static void  createservice(int, char *, char *);
   static void  create_remote_service(char *);  
211    static void  adddependant(char *);    static void  adddependant(char *);
212    static void  addport(struct PortSet *);    static void  addport(struct PortSet *);
213    static void  addresource(struct ResourceSet *);    static void  addresource(struct ResourceSet *);
# Line 321  optproclist     : /* EMPTY */ Line 320  optproclist     : /* EMPTY */
320  optproc         : start  optproc         : start
321                  | stop                  | stop
322                  | connection                  | connection
323                    | connectionunix
324                  | timeout                  | timeout
325                  | alert                  | alert
326                  | every                  | every
# Line 393  opthostlist     : /* EMPTY */ Line 393  opthostlist     : /* EMPTY */
393    
394  opthost         : start  opthost         : start
395                  | stop                  | stop
396                  | remoteconnection                  | connection
397                  | timeout                  | timeout
398                  | alert                  | alert
399                  | every                  | every
# Line 577  checkdir        : CHECKDIR SERVICENAME P Line 577  checkdir        : CHECKDIR SERVICENAME P
577                    }                    }
578                  ;                  ;
579    
580  checkhost       : CHECKHOST STRING {  checkhost       : CHECKHOST SERVICENAME ADDRESS STRING {
581                     check_hostname($2);                     check_hostname($4);
582                     check_name($<string>2);                     check_name($<string>2);
583                     create_remote_service($2);                     createservice(TYPE_REMOTE, $<string>2, $4);
584                    }                    }
585                  ;                  ;
586    
# Line 615  connection      : IF FAILED host port ty Line 615  connection      : IF FAILED host port ty
615                     portset.action= $<number>9;                     portset.action= $<number>9;
616                     addport(&portset);                     addport(&portset);
617                    }                    }
                 | IF FAILED unixsocket type protocol nettimeout THEN action {  
                    portset.timeout= $<number>6;  
                    portset.action= $<number>8;  
                    addport(&portset);  
                   }  
618                  ;                  ;
619    
620  remoteconnection: IF FAILED port type protocol nettimeout THEN action {  connectionunix  : IF FAILED unixsocket type protocol nettimeout THEN action {
                    ASSERT(current && current->name);  
                    portset.hostname= xstrdup(current->name);  
621                     portset.timeout= $<number>6;                     portset.timeout= $<number>6;
622                     portset.action= $<number>8;                     portset.action= $<number>8;
623                     addport(&portset);                     addport(&portset);
624                    }                    }
625                  ;                  ;
626    
627  host            : /* EMPTY */ { portset.hostname= xstrdup(LOCALHOST); }  host            : /* EMPTY */ {
628                        if(current->type == TYPE_REMOTE)
629                          portset.hostname= xstrdup(current->path);
630                        else
631                          portset.hostname= xstrdup(LOCALHOST);
632                      }
633                  | HOST STRING { check_hostname($2); portset.hostname= $2; }                  | HOST STRING { check_hostname($2); portset.hostname= $2; }
634                  ;                  ;
635    
# Line 1152  static void createservice(int type, char Line 1150  static void createservice(int type, char
1150    
1151    pthread_mutex_init(&current->mutex, NULL);    pthread_mutex_init(&current->mutex, NULL);
1152    
 }  
   
   
 /*  
  * Create a new remote service object and add any current objects  
  * to the service list.  
  */  
 static void create_remote_service(char *hostname) {  
   
   ASSERT(hostname);  
   
   if(current) {  
     addservice(current);  
   }  
   else {  
     NEW(current);  
   }  
   
   /* Reset the current object */  
   memset(current, 0, sizeof(*current));  
   
   /* Set default values */  
   current->do_monitor= TRUE;  
   current->mode= MODE_ACTIVE;  
   
   current->type= TYPE_REMOTE;  
   current->name= hostname; /* The remote host name */  
   
   pthread_mutex_init(&current->mutex, NULL);  
   
1153  }  }
1154    
1155    

Legend:
Removed from v.1.122  
changed lines
  Added in v.1.123

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