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

Diff of /monit/event.c

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

revision 1.11 by hauk, Fri Jul 25 14:59:28 2003 UTC revision 1.12 by martinp, Sun Aug 3 19:19:39 2003 UTC
# Line 63  struct Event_Table { Line 63  struct Event_Table {
63      {EVENT_CHECKSUM,  "Checksum error"},      {EVENT_CHECKSUM,  "Checksum error"},
64      {EVENT_RESOURCE,  "Resource limit matched"},      {EVENT_RESOURCE,  "Resource limit matched"},
65      {EVENT_TIMEOUT,   "Timeout"},      {EVENT_TIMEOUT,   "Timeout"},
66      {EVENT_TIMESTAMP, "Timestamp changes"}};      {EVENT_TIMESTAMP, "Timestamp rule matched"},
67        {EVENT_SIZE,      "Size rule matched"}
68    };
69    
70    
71  /* -------------------------------------------------------------- Prototypes */  /* -------------------------------------------------------------- Prototypes */
# Line 77  static void handle_timeout(Event_T E); Line 79  static void handle_timeout(Event_T E);
79  static void handle_checksum(Event_T E);  static void handle_checksum(Event_T E);
80  static void handle_resource(Event_T E);  static void handle_resource(Event_T E);
81  static void handle_timestamp(Event_T E);  static void handle_timestamp(Event_T E);
82    static void handle_size(Event_T E);
83    
84    
85  /* ------------------------------------------------------------------ Public */  /* ------------------------------------------------------------------ Public */
# Line 225  static void handle_event(Event_T E) { Line 228  static void handle_event(Event_T E) {
228    case EVENT_CHECKSUM:  handle_checksum(E); break;    case EVENT_CHECKSUM:  handle_checksum(E); break;
229    case EVENT_RESOURCE:  handle_resource(E); break;    case EVENT_RESOURCE:  handle_resource(E); break;
230    case EVENT_TIMESTAMP: handle_timestamp(E); break;    case EVENT_TIMESTAMP: handle_timestamp(E); break;
231      case EVENT_SIZE:      handle_size(E); break;
232    }    }
233        
234    if(E->id != EVENT_NULL) {    if(E->id != EVENT_NULL) {
# Line 327  static void handle_timestamp(Event_T E) Line 331  static void handle_timestamp(Event_T E)
331      }      }
332    }    }
333    
334    }
335    
336    
337    static void handle_size(Event_T E) {
338    
339      Size_T sl;
340      Service_T s= E->source;
341      
342      /* Check for executables to run */
343      for(sl= s->sizelist; sl; sl= sl->next) {
344        if(sl->event_flag && sl->exec != NULL) {
345          /* Reset the event_flag so the command is not executed again
346           * unless the flag is explicit set */
347          sl->event_flag= FALSE;
348          spawn(s, sl->exec);
349        }
350      }
351    
352  }  }
353    
354    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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