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

Diff of /monit/p.y

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

revision 1.215 by martinp, Tue Nov 1 14:32:38 2005 UTC revision 1.216 by martinp, Sat Nov 5 14:09:01 2005 UTC
# Line 265  Line 265 
265  %token CPUUSAGE MEMUSAGE MEMKBYTE CHILDREN  %token CPUUSAGE MEMUSAGE MEMKBYTE CHILDREN
266  %token RESOURCE MEMORY TOTALMEMORY CPU LOADAVG1 LOADAVG5 LOADAVG15  %token RESOURCE MEMORY TOTALMEMORY CPU LOADAVG1 LOADAVG5 LOADAVG15
267  %token MODE ACTIVE PASSIVE MANUAL  %token MODE ACTIVE PASSIVE MANUAL
268  %token GROUP REQUEST DEPENDS  %token GROUP REQUEST DEPENDS BASEDIR SLOT EVENTQUEUE
269  %token UID GID COLLECTOR  %token UID GID COLLECTOR INSTANCE
270  %token TIMESTAMP CHANGED SECOND MINUTE HOUR DAY  %token TIMESTAMP CHANGED SECOND MINUTE HOUR DAY
271  %token SSLAUTO SSLV2 SSLV3 TLSV1 CERTMD5  %token SSLAUTO SSLV2 SSLV3 TLSV1 CERTMD5
272  %token BYTE KILOBYTE MEGABYTE GIGABYTE  %token BYTE KILOBYTE MEGABYTE GIGABYTE
# Line 290  statement_list  : statement Line 290  statement_list  : statement
290  statement       : setalert  statement       : setalert
291                  | setdaemon                  | setdaemon
292                  | setlog                  | setlog
293                    | seteventqueue
294                  | setcollectors                  | setcollectors
295                  | setmailservers                  | setmailservers
296                  | setmailformat                  | setmailformat
# Line 435  setlog          : SET LOGFILE PATH   { Line 436  setlog          : SET LOGFILE PATH   {
436                    }                    }
437                  ;                  ;
438    
439    seteventqueue   : SET EVENTQUEUE BASEDIR PATH {
440                        Run.eventlist_dir= $4;
441                      }
442                    | SET EVENTQUEUE BASEDIR PATH SLOT NUMBER {
443                        Run.eventlist_dir= $4;
444                        Run.eventlist_slots= $6;
445                      }
446                    | SET EVENTQUEUE SLOT NUMBER {
447                        Run.eventlist_dir= xstrdup(MYEVENTLISTBASE);
448                        Run.eventlist_slots= $4;
449                      }
450                    ;
451    
452  setstate        : SET STATEFILE PATH {  setstate        : SET STATEFILE PATH {
453                      Run.statefile= $3;                      Run.statefile= $3;
454                    }                    }
# Line 997  eventoptionlist : eventoption Line 1011  eventoptionlist : eventoption
1011                  | eventoptionlist eventoption                  | eventoptionlist eventoption
1012                  ;                  ;
1013    
1014  eventoption     : CHANGED    { eventset |= EVENT_CHANGED; }  eventoption     : CHANGED         { eventset |= EVENT_CHANGED; }
1015                  | CHECKSUM   { eventset |= EVENT_CHECKSUM; }                  | CHECKSUM        { eventset |= EVENT_CHECKSUM; }
1016                  | CONNECTION { eventset |= EVENT_CONNECTION; }                  | CONNECTION      { eventset |= EVENT_CONNECTION; }
1017                  | DATA       { eventset |= EVENT_DATA; }                  | DATA            { eventset |= EVENT_DATA; }
1018                  | EXEC       { eventset |= EVENT_EXEC; }                  | EXEC            { eventset |= EVENT_EXEC; }
1019                  | GID        { eventset |= EVENT_GID; }                  | GID             { eventset |= EVENT_GID; }
1020                  | ICMP       { eventset |= EVENT_ICMP; }                  | ICMP            { eventset |= EVENT_ICMP; }
1021                  | INVALID    { eventset |= EVENT_INVALID; }                  | INSTANCE        { eventset |= EVENT_INSTANCE; }
1022                  | NONEXIST   { eventset |= EVENT_NONEXIST; }                  | INVALID         { eventset |= EVENT_INVALID; }
1023                  | PERMISSION { eventset |= EVENT_PERMISSION; }                  | MATCH           { eventset |= EVENT_MATCH; }
1024                  | RESOURCE   { eventset |= EVENT_RESOURCE; }                  | NONEXIST        { eventset |= EVENT_NONEXIST; }
1025                  | SIZE       { eventset |= EVENT_SIZE; }                  | PERMISSION      { eventset |= EVENT_PERMISSION; }
1026                  | MATCH      { eventset |= EVENT_MATCH; }                  | RESOURCE        { eventset |= EVENT_RESOURCE; }
1027                  | TIMEOUT    { eventset |= EVENT_TIMEOUT; }                  | SIZE            { eventset |= EVENT_SIZE; }
1028                  | TIMESTAMP  { eventset |= EVENT_TIMESTAMP; }                  | TIMEOUT         { eventset |= EVENT_TIMEOUT; }
1029                  | UID        { eventset |= EVENT_UID; }                  | TIMESTAMP       { eventset |= EVENT_TIMESTAMP; }
1030                    | UID             { eventset |= EVENT_UID; }
1031                  /* deprecated values kept for backward compatibility                  /* deprecated values kept for backward compatibility
1032                   * as aliases to valid events */                   * as aliases to valid events */
1033                  | START      { eventset |= EVENT_NONEXIST|EVENT_INVALID; }                  | START           { eventset |= EVENT_NONEXIST|EVENT_INVALID; }
1034                  | STOP       { eventset |= EVENT_NONEXIST|EVENT_INVALID; }                  | STOP            { eventset |= EVENT_NONEXIST|EVENT_INVALID; }
1035                  | RESTART    { eventset |= EVENT_NONEXIST|EVENT_INVALID; }                  | RESTART         { eventset |= EVENT_NONEXIST|EVENT_INVALID; }
1036                  | UNMONITOR  { eventset |= EVENT_TIMEOUT; }                  | UNMONITOR       { eventset |= EVENT_TIMEOUT; }
1037                  ;                  ;
1038    
1039  formatlist      : /* EMPTY */  formatlist      : /* EMPTY */
# Line 1056  mode            : MODE ACTIVE  { Line 1071  mode            : MODE ACTIVE  {
1071  group           : GROUP STRING { current->group= $2; }  group           : GROUP STRING { current->group= $2; }
1072                  ;                  ;
1073    
1074    
1075  depend          : DEPENDS dependlist  depend          : DEPENDS dependlist
1076                  ;                  ;
1077    
# Line 1571  int parse(char *controlfile) { Line 1587  int parse(char *controlfile) {
1587   * Initialize objects used by the parser.   * Initialize objects used by the parser.
1588   */   */
1589  static void preparse() {  static void preparse() {
1590      char host[STRLEN];
1591    
1592      if(gethostname(host, sizeof(host)) < 0) {
1593        snprintf(host, STRLEN, "%s", LOCALHOST);
1594      }
1595    
1596    /* Set instance incarnation ID */    /* Set instance incarnation ID */
1597    time(&Run.incarnation);    time(&Run.incarnation);
1598    /* Reset lexer */    /* Reset lexer */
# Line 1590  static void preparse() { Line 1612  static void preparse() {
1612    Run.clientssl= FALSE;    Run.clientssl= FALSE;
1613    Run.mailserver_timeout= NET_TIMEOUT;    Run.mailserver_timeout= NET_TIMEOUT;
1614    Run.bind_addr= NULL;    Run.bind_addr= NULL;
1615      Run.eventlist= NULL;
1616      Run.eventlist_dir= NULL;
1617      Run.eventlist_slots= -1;
1618    Run.maillist= NULL;    Run.maillist= NULL;
1619    Run.mailservers= NULL;    Run.mailservers= NULL;
1620    Run.MailFormat.from= NULL;    Run.MailFormat.from= NULL;
# Line 1611  static void preparse() { Line 1636  static void preparse() {
1636    reset_resourceset();    reset_resourceset();
1637    reset_checksumset();    reset_checksumset();
1638    reset_timestampset();    reset_timestampset();
1639      /* Add the general system service */
1640      createservice(TYPE_SYSTEM, xstrdup(host), xstrdup(""), check_system);
1641  }  }
1642    
1643    
# Line 1637  static void postparse() { Line 1664  static void postparse() {
1664      cfg_errflag++;      cfg_errflag++;
1665    }    }
1666    
   /* Verify that a remote service has a port or an icmp list */  
1667    for(s= servicelist; s; s= s->next) {    for(s= servicelist; s; s= s->next) {
1668        /* Set the general system service shortcut */
1669        if(s->type == TYPE_SYSTEM) {
1670          Run.system = s;
1671          continue;
1672        }
1673      if(s->type != TYPE_HOST)      if(s->type != TYPE_HOST)
1674          continue;          continue;
1675        /* Verify that a remote service has a port or an icmp list */
1676      if(!s->portlist && !s->icmplist) {      if(!s->portlist && !s->icmplist) {
1677        log("%s: Error: 'check host' statement is incomplete; Please specify a"        log("%s: Error: 'check host' statement is incomplete; Please specify a"
1678            " port number to test\n or an icmp test at the remote host: '%s'\n",            " port number to test\n or an icmp test at the remote host: '%s'\n",
# Line 1675  static void createservice(int type, char Line 1707  static void createservice(int type, char
1707    current->monitor= MONITOR_INIT;    current->monitor= MONITOR_INIT;
1708    current->mode= MODE_ACTIVE;    current->mode= MODE_ACTIVE;
1709    
   current->type= type;  
1710    current->name= name;    current->name= name;
1711      current->type= type;
1712    current->check= check;    current->check= check;
1713    current->path= value;    current->path= value;
1714    
# Line 1691  static void createservice(int type, char Line 1723  static void createservice(int type, char
1723    addeventaction(&(current)->action_TIMEOUT,  ACTION_UNMONITOR, ACTION_ALERT);    addeventaction(&(current)->action_TIMEOUT,  ACTION_UNMONITOR, ACTION_ALERT);
1724    addeventaction(&(current)->action_PID,      ACTION_ALERT,     ACTION_IGNORE);    addeventaction(&(current)->action_PID,      ACTION_ALERT,     ACTION_IGNORE);
1725    addeventaction(&(current)->action_PPID,     ACTION_ALERT,     ACTION_IGNORE);    addeventaction(&(current)->action_PPID,     ACTION_ALERT,     ACTION_IGNORE);
1726    
1727      /* Initialize internal event handlers */
1728      addeventaction(&(current)->action_MONIT_START,  ACTION_ALERT, ACTION_ALERT);
1729      addeventaction(&(current)->action_MONIT_STOP,   ACTION_ALERT, ACTION_ALERT);
1730      addeventaction(&(current)->action_MONIT_RELOAD, ACTION_ALERT, ACTION_ALERT);
1731        
1732    pthread_mutex_init(&current->mutex, NULL);    pthread_mutex_init(&current->mutex, NULL);
1733    

Legend:
Removed from v.1.215  
changed lines
  Added in v.1.216

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