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

Diff of /monit/p.y

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

revision 1.192 by martinp, Thu Dec 23 23:29:57 2004 UTC revision 1.193 by martinp, Mon Jan 3 20:33:15 2005 UTC
# Line 196  Line 196 
196    static void  addeuid(uid_t);    static void  addeuid(uid_t);
197    static void  addegid(gid_t);    static void  addegid(gid_t);
198    static void  addeventaction(EventAction_T *, int, int);    static void  addeventaction(EventAction_T *, int, int);
199      static void  seteventaction(EventAction_T *, int, int);
200    static void  prepare_urlrequest(URL_T U);    static void  prepare_urlrequest(URL_T U);
201    static void  seturlrequest(int, char *);    static void  seturlrequest(int, char *);
202    static void  setlogfile(char *);    static void  setlogfile(char *);
# Line 261  Line 262 
262  %token BYTE KILOBYTE MEGABYTE GIGABYTE  %token BYTE KILOBYTE MEGABYTE GIGABYTE
263  %token INODE SPACE PERMISSION SIZE  %token INODE SPACE PERMISSION SIZE
264  %token EXEC UNMONITOR ICMP ICMPECHO NONEXIST INVALID DATA RECOVERED  %token EXEC UNMONITOR ICMP ICMPECHO NONEXIST INVALID DATA RECOVERED
265  %token URL CONTENT  %token URL CONTENT PID PPID
266  %token <url> URLOBJECT  %token <url> URLOBJECT
267    
268  %left GREATER LESS EQUAL NOTEQUAL  %left GREATER LESS EQUAL NOTEQUAL
# Line 299  optproclist     : /* EMPTY */ Line 300  optproclist     : /* EMPTY */
300    
301  optproc         : start  optproc         : start
302                  | stop                  | stop
303                    | pid
304                    | ppid
305                  | connection                  | connection
306                  | connectionunix                  | connectionunix
307                  | timeout                  | timeout
# Line 829  apache_stat     : LOGLIMIT operator NUMB Line 832  apache_stat     : LOGLIMIT operator NUMB
832                    }                    }
833                  ;                  ;
834    
835    pid             : IF CHANGED PID THEN action1 {
836                        seteventaction(&(current)->action_PID, $<number>5,
837                          ACTION_IGNORE);
838                      }
839                    ;
840    
841    ppid            : IF CHANGED PPID THEN action1 {
842                        seteventaction(&(current)->action_PPID, $<number>5,
843                          ACTION_IGNORE);
844                      }
845                    ;
846    
847  nettimeout      : /* EMPTY */ {  nettimeout      : /* EMPTY */ {
848                     $<number>$= NET_TIMEOUT;                     $<number>$= NET_TIMEOUT;
849                    }                    }
# Line 1478  static void createservice(int type, char Line 1493  static void createservice(int type, char
1493    current->check= check;    current->check= check;
1494    
1495    createinfo();    createinfo();
1496      Util_resetInfo(current);
1497    
1498    /* Initialize general event handlers */    /* Initialize general event handlers */
1499    addeventaction(&(current)->action_DATA,     ACTION_ALERT,     ACTION_ALERT);    addeventaction(&(current)->action_DATA,     ACTION_ALERT,     ACTION_ALERT);
# Line 1485  static void createservice(int type, char Line 1501  static void createservice(int type, char
1501    addeventaction(&(current)->action_INVALID,  ACTION_RESTART,   ACTION_ALERT);    addeventaction(&(current)->action_INVALID,  ACTION_RESTART,   ACTION_ALERT);
1502    addeventaction(&(current)->action_NONEXIST, ACTION_RESTART,   ACTION_ALERT);    addeventaction(&(current)->action_NONEXIST, ACTION_RESTART,   ACTION_ALERT);
1503    addeventaction(&(current)->action_TIMEOUT,  ACTION_UNMONITOR, ACTION_ALERT);    addeventaction(&(current)->action_TIMEOUT,  ACTION_UNMONITOR, ACTION_ALERT);
1504      addeventaction(&(current)->action_PID,      ACTION_ALERT,     ACTION_IGNORE);
1505      addeventaction(&(current)->action_PPID,     ACTION_ALERT,     ACTION_IGNORE);
1506        
1507    pthread_mutex_init(&current->mutex, NULL);    pthread_mutex_init(&current->mutex, NULL);
1508    
# Line 1940  static void addeventaction(EventAction_T Line 1958  static void addeventaction(EventAction_T
1958    
1959    
1960  /*  /*
1961     * Redefine EventAction object (used for default action overloading)
1962     */
1963    static void seteventaction(EventAction_T *_ea, int failed, int passed) {
1964    
1965      EventAction_T ea = *_ea;
1966    
1967      ASSERT(ea);
1968      ASSERT(ea->failed);
1969      ASSERT(ea->passed);
1970    
1971      ea->failed->id= failed;
1972      ea->passed->id= passed;
1973    
1974      if(failed == ACTION_EXEC) {
1975        ASSERT(command1);
1976        ea->failed->exec = command1;
1977        command1 = NULL;
1978      }
1979      if(passed == ACTION_EXEC) {
1980        ASSERT(command2);
1981        ea->passed->exec = command2;
1982        command2 = NULL;
1983      }
1984    }
1985    
1986    
1987    /*
1988   * Adds runtime info to current service   * Adds runtime info to current service
1989   */   */
1990  static void createinfo() {  static void createinfo() {
# Line 1947  static void createinfo() { Line 1992  static void createinfo() {
1992    Info_T inf;    Info_T inf;
1993    
1994    NEW(inf);    NEW(inf);
1995      
1996    current->inf= inf;    current->inf= inf;
1997        
1998  }  }

Legend:
Removed from v.1.192  
changed lines
  Added in v.1.193

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