aggregation and monitoring system. The plugin sends I<JSON> encoded data to
a local I<Sensu> client using a TCP socket.
-At the moment, the I<write_sensu plugin> does not send over a collectd_host
-parameter so it is not possible to use one collectd instance as a gateway for
-others. Each collectd host must pair with one I<Sensu> client.
-
Synopsis:
<Plugin "write_sensu">
Port "3030"
StoreRates true
AlwaysAppendDS false
+ IncludeSource false
MetricHandler "influx"
MetricHandler "default"
NotificationHandler "flapjack"
Consider the two given strings to be the key and value of an additional
attribute for each metric being sent out to I<Sensu>.
+=item B<IncludeSource> B<false>|B<true>
+
+If set to B<true>, then the source host of the metrics/notification is passed
+on to sensu using the source attribute. This may register the host as a proxy
+client in sensu.
+
+If set to B<false> (the default), then the hostname is discarded, making it appear
+as if the event originated from the connected sensu agent.
+
=back
=head2 Plugin C<write_stackdriver>
bool metrics;
bool store_rates;
bool always_append_ds;
+ bool include_source;
char *separator;
char *node;
char *service;
}
}
+ if (host->include_source) {
+ res = my_asprintf(&temp_str, "%s, \"source\": \"%s\"", ret_str, vl->host);
+ free(ret_str);
+ if (res == -1) {
+ ERROR("write_sensu plugin: Unable to alloc memory");
+ return NULL;
+ }
+ ret_str = temp_str;
+ }
+
// incorporate the plugin name information
res = my_asprintf(&temp_str, "%s, \"collectd_plugin\": \"%s\"", ret_str,
vl->plugin);
}
ret_str = temp_str;
+ if (host->include_source) {
+ res = my_asprintf(&temp_str, "%s, \"source\": \"%s\"", ret_str, n->host);
+ free(ret_str);
+ if (res == -1) {
+ ERROR("write_sensu plugin: Unable to alloc memory");
+ return NULL;
+ }
+ ret_str = temp_str;
+ }
+
char *handlers_str =
build_json_str_list("handlers", &(host->notification_handlers));
if (handlers_str == NULL) {
host->metrics = false;
host->store_rates = true;
host->always_append_ds = false;
+ host->include_source = false;
host->metric_handlers.nb_strs = 0;
host->metric_handlers.strs = NULL;
host->notification_handlers.nb_strs = 0;
status = cf_util_get_boolean(child, &host->always_append_ds);
if (status != 0)
break;
+ } else if (strcasecmp("IncludeSource", child->key) == 0) {
+ status = cf_util_get_boolean(child, &host->include_source);
+ if (status != 0)
+ break;
} else {
WARNING("write_sensu plugin: ignoring unknown config "
"option: \"%s\"",