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

Diff of /monit/alert.c

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

revision 1.38 by hauk, Sun Dec 12 23:45:08 2004 UTC revision 1.39 by hauk, Mon Dec 13 03:12:20 2004 UTC
# Line 177  void handle_alert(Event_T E) { Line 177  void handle_alert(Event_T E) {
177    
178    
179  static void substitute(Mail_T *m, char *name, const char *event,  static void substitute(Mail_T *m, char *name, const char *event,
180    const char *action) {                         const char *action) {
181    
182    char host[STRLEN];    char host[STRLEN];
183    char *now= Util_getRFC822Date(NULL);    char now[STRLEN];
184    
185    ASSERT(m && name && event && action);    ASSERT(m && name && event && action);
186    
187      Util_getRFC822Date(NULL, now, STRLEN);
188    if(gethostname(host, sizeof(host)) < 0) {    if(gethostname(host, sizeof(host)) < 0) {
189      snprintf(host, STRLEN, "%s", LOCALHOST);      snprintf(host, STRLEN, "%s", LOCALHOST);
190    }    }
   
191    Util_replaceString(&(*m)->from, "$HOST", host);    Util_replaceString(&(*m)->from, "$HOST", host);
192    Util_replaceString(&(*m)->subject, "$DATE", now);    Util_replaceString(&(*m)->subject, "$DATE", now);
193    Util_replaceString(&(*m)->message, "$DATE", now);    Util_replaceString(&(*m)->message, "$DATE", now);
# Line 201  static void substitute(Mail_T *m, char * Line 201  static void substitute(Mail_T *m, char *
201    Util_replaceString(&(*m)->message, "$EVENT", event);    Util_replaceString(&(*m)->message, "$EVENT", event);
202    Util_replaceString(&(*m)->subject, "$ACTION", action);    Util_replaceString(&(*m)->subject, "$ACTION", action);
203    Util_replaceString(&(*m)->message, "$ACTION", action);    Util_replaceString(&(*m)->message, "$ACTION", action);
   
   FREE(now);  
   
204  }  }
205    
206    

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

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