From: Florian Forster Date: Fri, 22 Aug 2014 05:23:28 +0000 (+0200) Subject: Merge remote-tracking branch 'github/pr/706' X-Git-Tag: collectd-5.5.0~219 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=bca0f0af973fcd4b34e3cf6072e193ac9dbc65fc;hp=-c;p=collectd.git Merge remote-tracking branch 'github/pr/706' Conflicts: src/write_riemann.c --- bca0f0af973fcd4b34e3cf6072e193ac9dbc65fc diff --combined src/collectd.conf.in index 4d5abe0d,52904a2d..21de8440 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@@ -191,7 -191,6 +191,7 @@@ #@BUILD_PLUGIN_WRITE_MONGODB_TRUE@LoadPlugin write_mongodb #@BUILD_PLUGIN_WRITE_REDIS_TRUE@LoadPlugin write_redis #@BUILD_PLUGIN_WRITE_RIEMANN_TRUE@LoadPlugin write_riemann +#@BUILD_PLUGIN_WRITE_TSDB_TRUE@LoadPlugin write_tsdb #@BUILD_PLUGIN_XMMS_TRUE@LoadPlugin xmms #@BUILD_PLUGIN_ZFS_ARC_TRUE@LoadPlugin zfs_arc @@@ -292,7 -291,7 +292,7 @@@ # # -# +# # CGroup "libvirt" # IgnoreSelected false # @@@ -1239,21 -1238,12 +1239,22 @@@ # StoreRates true # AlwaysAppendDS false # TTLFactor 2.0 + # EventServicePrefix "" # # Tag "foobar" # Attribute "foo" "bar" # +# +# +# Host "localhost" +# Port "4242" +# HostTags "status=production" +# StoreRates false +# AlwaysAppendDS false +# +# + ############################################################################## # Filter configuration # #----------------------------------------------------------------------------# diff --combined src/collectd.conf.pod index 3a8af849,31e2e5a9..bba90557 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@@ -494,8 -494,6 +494,8 @@@ possibly filtering or messages # StoreRates false # GraphitePrefix "collectd." # GraphiteEscapeChar "_" + # GraphiteSeparateInstances false + # GraphiteAlwaysAppendDS false # Receive values from an AMQP broker @@@ -649,19 -647,6 +649,19 @@@ In I metric name, dots are us metric parts (host, plugin, type). Default is "_" (I). +=item B B|B + +If set to B, the plugin instance and type instance will be in their own +path component, for example C. If set to B (the +default), the plugin and plugin instance (and likewise the type and type +instance) are put into one component, for example C. + +=item B B|B + +If set to B, append the name of the I (DS) to the "metric" +identifier. If set to B (the default), this is only done when there is +more than one DS. + =back =head2 Plugin C @@@ -6527,59 -6512,6 +6527,59 @@@ instance) are put into one component, f =item B B|B +If set to B, append the name of the I (DS) to the "metric" +identifier. If set to B (the default), this is only done when there is +more than one DS. + +=back + +=head2 Plugin C + +The C plugin writes data to I, a scalable open-source +time series database. The plugin connects to a I, a masterless, no shared +state daemon that ingests metrics and stores them in HBase. The plugin uses +I over the "line based" protocol with a default port 4242. The data will +be sent in blocks of at most 1428 bytes to minimize the number of network +packets. + +Synopsis: + + + + Host "tsd-1.my.domain" + Port "4242" + HostTags "status=production" + + + +The configuration consists of one or more EBEIE +blocks. Inside the B blocks, the following options are recognized: + +=over 4 + +=item B I
+ +Hostname or address to connect to. Defaults to C. + +=item B I + +Service name or port number to connect to. Defaults to C<4242>. + + +=item B I + +When set, I is added to the end of the metric. It is intended to be +used for name=value pairs that the TSD will tag the metric with. Dots and +whitespace are I escaped in this string. + +=item B B|B + +If set to B, convert counter values to rates. If set to B +(the default) counter values are stored as is, as an increasing +integer number. + +=item B B|B + If set the B, append the name of the I (DS) to the "metric" identifier. If set to B (the default), this is only done when there is more than one DS. @@@ -6918,6 -6850,12 +6918,12 @@@ useful to avoid getting notification ev If set to B, attach state to events based on thresholds defined in the B plugin. Defaults to B. + =item B I + + Add the given string as a prefix to the event service name. + If B not set or set to an empty string (""), + no prefix will be used. + =back =item B I @@@ -7402,36 -7340,19 +7408,36 @@@ Available options =item B I Name of the write plugin to which the data should be sent. This option may be -given multiple times to send the data to more than one write plugin. +given multiple times to send the data to more than one write plugin. If the +plugin supports multiple instances, the plugin's instance(s) must also be +specified. =back If no plugin is explicitly specified, the values will be sent to all available write plugins. -Example: +Single-instance plugin example: Plugin "rrdtool" +Multi-instance plugin example: + + + + ... + + + ... + + + ... + + Plugin "write_graphite/foo" + + =item B Starts processing the rules of another chain, see L<"Flow control"> above. If diff --combined src/write_riemann.c index b59c3e35,61c13914..c3740e1d --- a/src/write_riemann.c +++ b/src/write_riemann.c @@@ -48,11 -48,12 +48,12 @@@ int write_riemann_threshold_check(cons struct riemann_host { char *name; + char *event_service_prefix; #define F_CONNECT 0x01 uint8_t flags; pthread_mutex_t lock; - _Bool notifications; - _Bool check_thresholds; + _Bool notifications; + _Bool check_thresholds; _Bool store_rates; _Bool always_append_ds; char *node; @@@ -97,7 -98,7 +98,7 @@@ static void riemann_event_protobuf_fre sfree (event); } /* }}} void riemann_event_protobuf_free */ -static void riemann_msg_protobuf_free (Msg *msg) /* {{{ */ +static void riemann_msg_protobuf_free(Msg *msg) /* {{{ */ { size_t i; @@@ -319,7 -320,7 +320,7 @@@ static int riemann_event_add_tag (Even return (strarray_add (&event->tags, &event->n_tags, tag)); } /* }}} int riemann_event_add_tag */ -static int riemann_event_add_attribute (Event *event, /* {{{ */ +static int riemann_event_add_attribute(Event *event, /* {{{ */ char const *key, char const *value) { Attribute **new_attributes; @@@ -352,7 -353,7 +353,7 @@@ return (0); } /* }}} int riemann_event_add_attribute */ -static Msg *riemann_notification_to_protobuf (struct riemann_host *host, /* {{{ */ +static Msg *riemann_notification_to_protobuf(struct riemann_host *host, /* {{{ */ notification_t const *n) { Msg *msg; @@@ -459,7 -460,7 +460,7 @@@ return (msg); } /* }}} Msg *riemann_notification_to_protobuf */ -static Event *riemann_value_to_protobuf (struct riemann_host const *host, /* {{{ */ +static Event *riemann_value_to_protobuf(struct riemann_host const *host, /* {{{ */ data_set_t const *ds, value_list_t const *vl, size_t index, gauge_t const *rates, @@@ -484,22 -485,22 +485,22 @@@ event->time = CDTIME_T_TO_TIME_T (vl->time); event->has_time = 1; - if (host->check_thresholds) { - switch (status) { - case STATE_OKAY: - event->state = strdup("ok"); - break; - case STATE_ERROR: - event->state = strdup("critical"); - break; - case STATE_WARNING: - event->state = strdup("warning"); - break; - case STATE_MISSING: - event->state = strdup("unknown"); - break; - } - } + if (host->check_thresholds) { + switch (status) { + case STATE_OKAY: + event->state = strdup("ok"); + break; + case STATE_ERROR: + event->state = strdup("critical"); + break; + case STATE_WARNING: + event->state = strdup("warning"); + break; + case STATE_MISSING: + event->state = strdup("unknown"); + break; + } + } ttl = CDTIME_T_TO_DOUBLE (vl->interval) * host->ttl_factor; event->ttl = (float) ttl; @@@ -569,11 -570,19 +570,22 @@@ /* host = */ "", vl->plugin, vl->plugin_instance, vl->type, vl->type_instance); if (host->always_append_ds || (ds->ds_num > 1)) - ssnprintf (service_buffer, sizeof (service_buffer), - "%s/%s", &name_buffer[1], ds->ds[index].name); - if (host->event_service_prefix == NULL || host->event_service_prefix[0] == '\0') - ssnprintf (service_buffer, sizeof (service_buffer), - "%s/%s", &name_buffer[1], ds->ds[index].name); ++ { ++ if (host->event_service_prefix == NULL) ++ ssnprintf (service_buffer, sizeof (service_buffer), "%s/%s", ++ &name_buffer[1], ds->ds[index].name); + else - ssnprintf (service_buffer, sizeof (service_buffer), - "%s%s/%s", host->event_service_prefix, &name_buffer[1], ds->ds[index].name); ++ ssnprintf (service_buffer, sizeof (service_buffer), "%s%s/%s", ++ host->event_service_prefix, &name_buffer[1], ds->ds[index].name); ++ } else - sstrncpy (service_buffer, &name_buffer[1], - sizeof (service_buffer)); - if (host->event_service_prefix == NULL || host->event_service_prefix[0] == '\0') - sstrncpy (service_buffer, &name_buffer[1], - sizeof (service_buffer)); ++ { ++ if (host->event_service_prefix == NULL) ++ sstrncpy (service_buffer, &name_buffer[1], sizeof (service_buffer)); + else - ssnprintf (service_buffer, sizeof (service_buffer), - "%s%s", host->event_service_prefix, &name_buffer[1]); ++ ssnprintf (service_buffer, sizeof (service_buffer), "%s%s", ++ host->event_service_prefix, &name_buffer[1]); ++ } event->service = strdup (service_buffer); @@@ -645,8 -654,8 +657,8 @@@ static int riemann_notification(const n struct riemann_host *host = ud->data; Msg *msg; - if (!host->notifications) - return 0; + if (!host->notifications) + return 0; msg = riemann_notification_to_protobuf (host, n); if (msg == NULL) @@@ -670,8 -679,8 +682,8 @@@ static int riemann_write(const data_set struct riemann_host *host = ud->data; Msg *msg; - if (host->check_thresholds) - write_riemann_threshold_check(ds, vl, statuses); + if (host->check_thresholds) + write_riemann_threshold_check(ds, vl, statuses); msg = riemann_value_list_to_protobuf (host, ds, vl, statuses); if (msg == NULL) return (-1); @@@ -725,8 -734,8 +737,8 @@@ static int riemann_config_node(oconfig_ host->reference_count = 1; host->node = NULL; host->service = NULL; - host->notifications = 1; - host->check_thresholds = 0; + host->notifications = 1; + host->check_thresholds = 0; host->store_rates = 1; host->always_append_ds = 0; host->use_tcp = 0; @@@ -751,14 -760,18 +763,18 @@@ status = cf_util_get_string (child, &host->node); if (status != 0) break; - } else if (strcasecmp ("Notifications", child->key) == 0) { - status = cf_util_get_boolean(child, &host->notifications); - if (status != 0) - break; - } else if (strcasecmp ("EventServicePrefix", child->key) == 0) { - status = cf_util_get_string (child, &host->event_service_prefix); - if (status != 0) - break; - } else if (strcasecmp ("CheckThresholds", child->key) == 0) { - status = cf_util_get_boolean(child, &host->check_thresholds); - if (status != 0) - break; + } else if (strcasecmp ("Notifications", child->key) == 0) { + status = cf_util_get_boolean(child, &host->notifications); + if (status != 0) + break; ++ } else if (strcasecmp ("EventServicePrefix", child->key) == 0) { ++ status = cf_util_get_string (child, &host->event_service_prefix); ++ if (status != 0) ++ break; + } else if (strcasecmp ("CheckThresholds", child->key) == 0) { + status = cf_util_get_boolean(child, &host->check_thresholds); + if (status != 0) + break; } else if (strcasecmp ("Port", child->key) == 0) { status = cf_util_get_service (child, &host->service); if (status != 0) { @@@ -928,7 -941,7 +944,7 @@@ static int riemann_config(oconfig_item_ child->key); } } - return 0; + return (0); } /* }}} int riemann_config */ void module_register(void)