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

Diff of /monit/collector.c

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

revision 1.8 by martinp, Thu Oct 6 21:14:42 2005 UTC revision 1.9 by martinp, Sat Nov 5 14:09:00 2005 UTC
# Line 65  static int data_check(Collector_T); Line 65  static int data_check(Collector_T);
65  /**  /**
66   * Post event or status data message to the collector   * Post event or status data message to the collector
67   * @param E An event object or NULL for status data   * @param E An event object or NULL for status data
68     * @return If failed, return HANDLER_COLLECTOR flag or inverse flag if passed
69   */   */
70  void handle_collector(Event_T E) {  int handle_collector(Event_T E) {
71    
72    char        *D = NULL;    char        *D = NULL;
73    Collector_T  C = Run.collectors;    Collector_T  C = Run.collectors;
74    sigset_t     ns;    sigset_t     ns;
75    sigset_t     os;    sigset_t     os;
76      int          rv = HANDLER_PASSED;
77    
78    /* The event is send to the collector just once - only in the case    /* The event is send to the collector just once - only in the case
79     * that the state changed/matched */     * that the state changed/matched */
80    if(!C || (!E->state_changed && (E->id != EVENT_CHANGED || E->id != EVENT_MATCH)))    if(!C || (!E->state_changed && (E->id != EVENT_CHANGED || E->id != EVENT_MATCH)))
81    {    {
82      return;      return rv;
83    }    }
84    
85    set_signal_block(&ns, &os);    set_signal_block(&ns, &os);
# Line 96  void handle_collector(Event_T E) { Line 98  void handle_collector(Event_T E) {
98      }      }
99      else      else
100      {      {
101        log("Collector: no server available -- aborting message\n");        log("Collector: no server available\n");
102        /* FIXME: Add message to a queue for later retry */        rv = HANDLER_COLLECTOR;
103        goto exit2;        goto exit2;
104      }      }
105    }    }
# Line 106  void handle_collector(Event_T E) { Line 108  void handle_collector(Event_T E) {
108    
109    if(!data_send(C, D))    if(!data_send(C, D))
110    {    {
111      log("Collector: communication failure -- aborting message\n");      log("Collector: communication failure\n");
112      /* FIXME: Try other collector or add message to a queue for later retry */      rv = HANDLER_COLLECTOR;
113      goto exit1;      goto exit1;
114    }    }
115    if(!data_check(C))    if(!data_check(C))
116    {    {
117      log("Collector: communication failure -- aborting message\n");      log("Collector: communication failure\n");
118      /* FIXME: Try other collector or add message to a queue for later retry */      rv = HANDLER_COLLECTOR;
119      goto exit1;      goto exit1;
120    }    }
121    DEBUG("Collector: %s message send to %s\n", E?"event":"status", C->url->url);    DEBUG("Collector: %s message send to %s\n", E?"event":"status", C->url->url);
# Line 126  exit1: Line 128  exit1:
128    }    }
129  exit2:  exit2:
130    unset_signal_block(&os);    unset_signal_block(&os);
131      return rv;
132  }  }
133    
134    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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