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

Diff of /monit/p.y

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

revision 1.92 by hauk, Thu Jul 31 00:24:45 2003 UTC revision 1.93 by martinp, Sun Aug 3 19:19:39 2003 UTC
# Line 115  Line 115 
115      int  action;      int  action;
116    };    };
117    
118      struct SizeSet {
119        int  operator;
120        unsigned int size;
121        int  test_changes;
122        int  action;
123      };
124    
125    struct DeviceSet {    struct DeviceSet {
126      int  resource;      int  resource;
127      int  operator;      int  operator;
# Line 148  Line 155 
155      ACTION_ALERT};      ACTION_ALERT};
156    static struct TimestampSet timestampset= {NULL, OPERATOR_EQUAL, 0, 0,    static struct TimestampSet timestampset= {NULL, OPERATOR_EQUAL, 0, 0,
157      ACTION_ALERT};      ACTION_ALERT};
158      static struct SizeSet sizeset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT};
159    static struct DeviceSet deviceset= {0, OPERATOR_EQUAL, -1, -1, ACTION_ALERT};    static struct DeviceSet deviceset= {0, OPERATOR_EQUAL, -1, -1, ACTION_ALERT};
160    
161    /* Private prototypes */    /* Private prototypes */
# Line 160  Line 168 
168    static void addport(struct PortSet *);    static void addport(struct PortSet *);
169    static void addresource(struct ResourceSet *);    static void addresource(struct ResourceSet *);
170    static void addtimestamp(struct TimestampSet *);    static void addtimestamp(struct TimestampSet *);
171      static void addsize(struct SizeSet *);
172    static void adddevice(struct DeviceSet *);    static void adddevice(struct DeviceSet *);
173    static void *addprotocol(int);    static void *addprotocol(int);
174    static void addcommand(int);    static void addcommand(int);
# Line 176  Line 185 
185    static void reset_portset();    static void reset_portset();
186    static void reset_resourceset();    static void reset_resourceset();
187    static void reset_timestampset();    static void reset_timestampset();
188      static void reset_sizeset();
189    static void reset_deviceset();    static void reset_deviceset();
190    static void check_name(char *);    static void check_name(char *);
191    static void check_timeout(int, int);    static void check_timeout(int, int);
# Line 219  Line 229 
229  %token TIMESTAMP CHANGED SECOND MINUTE HOUR DAY  %token TIMESTAMP CHANGED SECOND MINUTE HOUR DAY
230  %token SSLAUTO SSLV2 SSLV3 TLSV1 CERTMD5  %token SSLAUTO SSLV2 SSLV3 TLSV1 CERTMD5
231  %token BYTE KILOBYTE MEGABYTE GIGABYTE  %token BYTE KILOBYTE MEGABYTE GIGABYTE
232  %token INODE SPACE PERM  %token INODE SPACE PERM SIZE
233  %token EXEC  %token EXEC
234    
235  %left GREATER LESS EQUAL NOTEQUAL  %left GREATER LESS EQUAL NOTEQUAL
# Line 290  optfile         : start Line 300  optfile         : start
300                  | every                  | every
301                  | alert                  | alert
302                  | perm                  | perm
303                    | size {
304                       addsize(&sizeset);
305                      }
306                  | checksum                  | checksum
307                  | autostart                  | autostart
308                  | mode                  | mode
# Line 306  optdev          : start Line 319  optdev          : start
319                  | timeout                  | timeout
320                  | every                  | every
321                  | alert                  | alert
322                    | perm
323                  | autostart                  | autostart
324                  | mode                  | mode
325                  | group                  | group
# Line 529  useroptionlist  : useroption Line 543  useroptionlist  : useroption
543                  | useroptionlist useroption                  | useroptionlist useroption
544                  ;                  ;
545    
546  argument        : STRING { addargument($1); } | PATH { addargument($1); }  argument        : STRING { addargument($1); }
547                    | PATH   { addargument($1); }
548                  ;                  ;
549    
550  useroption      : UID STRING { adduid($2, 0); free($2); }  useroption      : UID STRING { adduid($2, 0); free($2); }
# Line 620  eventoption     : START     { eventset | Line 635  eventoption     : START     { eventset |
635                  | RESOURCE  { eventset |= EVENT_RESOURCE; }                  | RESOURCE  { eventset |= EVENT_RESOURCE; }
636                  | TIMEOUT   { eventset |= EVENT_TIMEOUT; }                  | TIMEOUT   { eventset |= EVENT_TIMEOUT; }
637                  | TIMESTAMP { eventset |= EVENT_TIMESTAMP; }                  | TIMESTAMP { eventset |= EVENT_TIMESTAMP; }
638                    | SIZE      { eventset |= EVENT_SIZE; }
639                  ;                  ;
640    
641  formatlist      : /* EMPTY */  formatlist      : /* EMPTY */
# Line 826  unit            : BYTE     { $<number>$= Line 842  unit            : BYTE     { $<number>$=
842  perm            : PERM NUMBER { current->perm=check_perm($2); }  perm            : PERM NUMBER { current->perm=check_perm($2); }
843                  ;                  ;
844    
845    size            : SIZE operator NUMBER unit action {
846                        sizeset.operator= $<number>2;
847                        sizeset.size= ((unsigned long)$3 * $<number>4);
848                        sizeset.action= $<number>5;
849                        sizeset.test_changes= FALSE;
850                      }
851                    | SIZE CHANGED action {
852                        sizeset.test_changes= TRUE;
853                        sizeset.action= $<number>3;
854                      }
855                    ;
856    
857  %%  %%
858    
859    
# Line 930  static void createservice(int task, char Line 958  static void createservice(int task, char
958    ASSERT(path);    ASSERT(path);
959    
960    if(current) {    if(current) {
   
961      createinfo();      createinfo();
962      addservice(current);      addservice(current);
       
963    }    }
964    else {    else {
       
965      NEW(current);      NEW(current);
       
966    }    }
967    
968    /* Reset the current object */    /* Reset the current object */
# Line 951  static void createservice(int task, char Line 975  static void createservice(int task, char
975    current->task= task;    current->task= task;
976    current->name= name;    current->name= name;
977    current->path= path;    current->path= path;
   current->group= NULL;  
   current->dependantlist= NULL;  
978    current->perm= -1;    current->perm= -1;
979    
980    pthread_mutex_init(&current->mutex, NULL);    pthread_mutex_init(&current->mutex, NULL);
# Line 1221  static void addtimestamp(struct Timestam Line 1243  static void addtimestamp(struct Timestam
1243    
1244    
1245  /*  /*
1246     * Add a new file object to the current service size list
1247     */
1248    static void addsize(struct SizeSet *ss) {
1249    
1250      struct stat buf;
1251      Size_T s;
1252    
1253      ASSERT(ss);
1254    
1255      if(ss->test_changes && stat(current->path, &buf) != 0) {
1256        log("%s: Cannot get size for '%s' at line %d -- %s\n",
1257            prog, current->path, lineno, STRERROR);
1258        cfg_errflag++;
1259      }
1260    
1261      NEW(s);
1262      s->operator= ss->operator;
1263      s->size= ss->size;
1264      s->action= ss->action;
1265      s->test_changes= ss->test_changes;
1266      if(ss->test_changes)
1267        s->runsize= (unsigned long)buf.st_size;
1268    
1269      if((s->action == ACTION_EXEC) && command) {
1270        s->exec= command;
1271        command= NULL;
1272      }
1273    
1274      s->next= current->sizelist;
1275      current->sizelist= s;
1276    
1277      reset_sizeset();
1278    }
1279    
1280    
1281    /*
1282   * Add a new device to the current tasks device list   * Add a new device to the current tasks device list
1283   */   */
1284  static void adddevice(struct DeviceSet *ds) {  static void adddevice(struct DeviceSet *ds) {
# Line 1688  static void reset_timestampset() { Line 1746  static void reset_timestampset() {
1746    timestampset.pathname= NULL;    timestampset.pathname= NULL;
1747    timestampset.operator= OPERATOR_EQUAL;    timestampset.operator= OPERATOR_EQUAL;
1748    timestampset.time= 0;    timestampset.time= 0;
1749      timestampset.test_changes= 0;
1750    timestampset.action= ACTION_ALERT;    timestampset.action= ACTION_ALERT;
1751    
1752  }  }
1753    
1754    
1755    /*
1756     * Reset the Size set to default values
1757     */
1758    static void reset_sizeset() {
1759    
1760      sizeset.operator= OPERATOR_EQUAL;
1761      sizeset.size= 0;
1762      sizeset.test_changes= 0;
1763      sizeset.action= ACTION_ALERT;
1764    
1765    }
1766    
1767    
1768  /*  /*
1769   * Reset the Device set to default values   * Reset the Device set to default values

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93

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