Hi - Please find attached a tiny patch for 5.0.1 notifications which:

1. Fixes bug with non interesting values being notified when data is missing.

2. Adds a new option 'SendNotify' to the network plugin to disable sending of notifications. Useful when you have collectd processes monitoring each other (or local notifications are dealt with locally and therefore should not be sent upstream). Usage:

<Plugin network>

  SendNotify false

<Listen ...>
    ...
</Listen>
<Server ...>
    ...
</Server>
</Plugin>


Kind regards

Chris
diff -pur collectd-5.0.1/src/network.c collectd-5.0.1-mine/src/network.c
--- collectd-5.0.1/src/network.c        2011-10-14 20:49:49.000000000 +0000
+++ collectd-5.0.1-mine/src/network.c   2012-01-04 21:49:45.000000000 +0000
@@ -261,6 +261,7 @@ typedef struct receive_list_entry_s rece
 static int network_config_ttl = 0;
 static size_t network_config_packet_size = 1452;
 static int network_config_forward = 0;
+static int network_config_send_notify = 1;
 static int network_config_stats = 0;
 
 static sockent_t *sending_sockets = NULL;
@@ -3072,6 +3073,8 @@ static int network_config (oconfig_item_
       network_config_set_buffer_size (child);
     else if (strcasecmp ("Forward", child->key) == 0)
       network_config_set_boolean (child, &network_config_forward);
+    else if (strcasecmp ("SendNotify", child->key) == 0)
+      network_config_set_boolean (child, &network_config_send_notify);
     else if (strcasecmp ("ReportStats", child->key) == 0)
       network_config_set_boolean (child, &network_config_stats);
     else
@@ -3092,6 +3095,10 @@ static int network_notification (const n
   int   buffer_free = sizeof (buffer);
   int   status;
 
+  /* Check if sending notifications through the network has been disabled */
+  if (!network_config_send_notify)
+    return (0);
+
   memset (buffer, '\0', sizeof (buffer));
 
   status = write_part_number (&buffer_ptr, &buffer_free, TYPE_TIME_HR,
diff -pur collectd-5.0.1/src/threshold.c collectd-5.0.1-mine/src/threshold.c
--- collectd-5.0.1/src/threshold.c      2011-10-14 20:49:49.000000000 +0000
+++ collectd-5.0.1-mine/src/threshold.c 2012-01-04 21:52:06.000000000 +0000
@@ -994,6 +994,11 @@ static int ut_missing (const value_list_
   if (th == NULL)
     return (0);
 
+  /* If the value is not interesting then do not notify */
+
+  if (!(th->flags & UT_FLAG_INTERESTING))
+    return (0);
+
   missing_time = cdtime () - vl->time;
   FORMAT_VL (identifier, sizeof (identifier), vl);
 
_______________________________________________
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd

Reply via email to