.libs/
src/collectd
src/collectd-nagios
+src/collectd-tg
src/collectdctl
src/collectdmon
src/*.1
src/*.5
-src/libcollectdclient/lcc_features.h
+src/libcollectdclient/collectd/lcc_features.h
# patch stuff
*.rej
&& rm -f Makefile \
&& rm -f Makefile.in \
&& rm -f missing \
+&& rm -f INSTALL \
&& rm -f -r src/.deps \
&& rm -f -r src/.libs \
&& rm -f src/*.o \
&& rm -f src/*.lo \
&& rm -f src/collectd \
&& rm -f src/collectd.1 \
+&& rm -f src/collectd.conf \
+&& rm -f src/collectdctl \
+&& rm -f src/collectd-tg \
+&& rm -f src/collectd-nagios \
+&& rm -f src/collectdmon \
&& rm -f src/config.h \
&& rm -f src/config.h.in \
&& rm -f src/config.h.in~ \
&& rm -f src/Makefile.in \
&& rm -f src/stamp-h1 \
&& rm -f src/stamp-h1.in \
+&& rm -f src/*.pb-c.c \
+&& rm -f src/*.pb-c.h \
+&& rm -f src/Makefile.in \
+&& rm -f src/liboconfig/*.o \
+&& rm -f src/liboconfig/*.la \
+&& rm -f src/liboconfig/*.lo \
+&& rm -f -r src/liboconfig/.libs \
+&& rm -f -r src/liboconfig/Makefile \
+&& rm -f -r src/liboconfig/Makefile.in \
+&& rm -f -r src/liboconfig/parser.c \
+&& rm -f -r src/liboconfig/parser.h \
+&& rm -f -r src/liboconfig/scanner.c \
&& rm -f -r src/libping/.libs \
&& rm -f src/libping/*.o \
&& rm -f src/libping/*.la \
&& rm -f src/libcollectdclient/*.o \
&& rm -f src/libcollectdclient/*.la \
&& rm -f src/libcollectdclient/*.lo \
+&& rm -f src/libcollectdclient/Makefile \
+&& rm -f src/libcollectdclient/Makefile.in \
+&& rm -f src/libcollectdclient/collectd/lcc_features.h \
+&& rm -f src/libcollectdclient/libcollectdclient.pc \
+&& rm -f bindings/Makefile \
+&& rm -f bindings/Makefile.in \
+&& rm -f -r bindings/java/.libs \
+&& rm -f bindings/java/Makefile \
+&& rm -f bindings/java/Makefile.in \
+&& rm -f bindings/java/java-build-stamp \
+&& rm -f bindings/java/org/collectd/api/*.class \
+&& rm -f bindings/java/org/collectd/java/*.class \
&& rm -f bindings/.perl-directory-stamp \
&& rm -f -r bindings/buildperl
value from a JSON map object. If a path element of B<Key> is the
I<*>E<nbsp>wildcard, the values for all keys will be collectd.
+The B<Key> string argument must be in a path format. Each component is
+used to match the key from a JSON map or the index of an JSON
+array. If a path component of a B<Key> is a I<*>E<nbsp>wildcard, the
+values for all map keys or array indices will be collectd.
+
The following options are valid within B<URL> blocks:
=over 4
c_avl_tree_t *tree;
cj_key_t *key;
};
+ _Bool in_array;
+ int index;
char name[DATA_MAX_NAME_LEN];
} state[YAJL_MAX_DEPTH];
};
return ds->ds[0].type;
}
+static int cj_cb_map_key (void *ctx, const unsigned char *val,
+ yajl_len_t len);
+
+static void cj_cb_inc_array_index (void * ctx, _Bool ignore)
+{
+ cj_t *db = (cj_t *)ctx;
+
+ if (db->state[db->depth].in_array) {
+ if (ignore)
+ db->state[db->depth].index++;
+ else {
+ char name[DATA_MAX_NAME_LEN];
+ cj_cb_map_key (ctx, (unsigned char *)name,
+ ssnprintf (name, sizeof (name),
+ "%d", db->state[db->depth].index++));
+ }
+ }
+}
+
/* yajl callbacks */
#define CJ_CB_ABORT 0
#define CJ_CB_CONTINUE 1
+static int cj_cb_boolean (void * ctx, int boolVal)
+{
+ cj_cb_inc_array_index (ctx, 1);
+ return (CJ_CB_CONTINUE);
+}
+
+static int cj_cb_null (void * ctx)
+{
+ cj_cb_inc_array_index (ctx, 1);
+ return (CJ_CB_CONTINUE);
+}
+
/* "number" may not be null terminated, so copy it into a buffer before
* parsing. */
static int cj_cb_number (void *ctx,
int type;
int status;
- if ((key == NULL) || !CJ_IS_KEY (key))
+ if ((key == NULL) || !CJ_IS_KEY (key)) {
+ if (key != NULL)
+ NOTICE ("curl_json plugin: Found \"%.*s\", but the configuration expects"
+ " a map.", (int)number_len > number_len ? 0 : (int)number_len,
+ number);
+ cj_cb_inc_array_index (ctx, 1);
return (CJ_CB_CONTINUE);
+ } else
+ cj_cb_inc_array_index (ctx, 0);
memcpy (buffer, number, number_len);
buffer[sizeof (buffer) - 1] = 0;
static int cj_cb_string (void *ctx, const unsigned char *val,
yajl_len_t len)
{
- cj_t *db = (cj_t *)ctx;
- char str[len + 1];
-
- /* Create a null-terminated version of the string. */
- memcpy (str, val, len);
- str[len] = 0;
-
- /* No configuration for this string -> simply return. */
- if (db->state[db->depth].key == NULL)
- return (CJ_CB_CONTINUE);
-
- if (!CJ_IS_KEY (db->state[db->depth].key))
- {
- NOTICE ("curl_json plugin: Found string \"%s\", but the configuration "
- "expects a map here.", str);
- return (CJ_CB_CONTINUE);
- }
-
/* Handle the string as if it was a number. */
return (cj_cb_number (ctx, (const char *) val, len));
} /* int cj_cb_string */
static int cj_cb_start_map (void *ctx)
{
+ cj_cb_inc_array_index (ctx, 0);
return cj_cb_start (ctx);
}
static int cj_cb_start_array (void * ctx)
{
+ cj_t *db = (cj_t *)ctx;
+ cj_cb_inc_array_index (ctx, 0);
+ if (db->depth+1 < YAJL_MAX_DEPTH) {
+ db->state[db->depth+1].in_array = 1;
+ db->state[db->depth+1].index = 0;
+ }
return cj_cb_start (ctx);
}
static int cj_cb_end_array (void * ctx)
{
+ cj_t *db = (cj_t *)ctx;
+ db->state[db->depth].in_array = 0;
return cj_cb_end (ctx);
}
static yajl_callbacks ycallbacks = {
- NULL, /* null */
- NULL, /* boolean */
+ cj_cb_null, /* null */
+ cj_cb_boolean, /* boolean */
NULL, /* integer */
NULL, /* double */
cj_cb_number,
static double *conf_timer_percentile = NULL;
static size_t conf_timer_percentile_num = 0;
+static _Bool conf_timer_lower = 0;
+static _Bool conf_timer_upper = 0;
+static _Bool conf_timer_sum = 0;
+static _Bool conf_timer_count = 0;
+
/* Must hold metrics_lock when calling this function. */
static statsd_metric_t *statsd_metric_lookup_unsafe (char const *name, /* {{{ */
metric_type_t type)
cf_util_get_boolean (child, &conf_delete_gauges);
else if (strcasecmp ("DeleteSets", child->key) == 0)
cf_util_get_boolean (child, &conf_delete_sets);
+ else if (strcasecmp ("TimerLower", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_lower);
+ else if (strcasecmp ("TimerUpper", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_upper);
+ else if (strcasecmp ("TimerSum", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_sum);
+ else if (strcasecmp ("TimerCount", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_count);
else if (strcasecmp ("TimerPercentile", child->key) == 0)
statsd_config_timer_percentile (child);
else
latency_counter_get_average (metric->latency));
plugin_dispatch_values (&vl);
+ if (conf_timer_lower) {
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
+ "%s-lower", name);
+ values[0].gauge = CDTIME_T_TO_DOUBLE (
+ latency_counter_get_min (metric->latency));
+ plugin_dispatch_values (&vl);
+ }
+
+ if (conf_timer_upper) {
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
+ "%s-upper", name);
+ values[0].gauge = CDTIME_T_TO_DOUBLE (
+ latency_counter_get_max (metric->latency));
+ plugin_dispatch_values (&vl);
+ }
+
+ if (conf_timer_sum) {
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
+ "%s-sum", name);
+ values[0].gauge = CDTIME_T_TO_DOUBLE (
+ latency_counter_get_sum (metric->latency));
+ plugin_dispatch_values (&vl);
+ }
+
for (i = 0; i < conf_timer_percentile_num; i++)
{
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
plugin_dispatch_values (&vl);
}
+ /* Keep this at the end, since vl.type is set to "gauge" here. The
+ * vl.type's above are implicitly set to "latency". */
+ if (conf_timer_count) {
+ sstrncpy (vl.type, "gauge", sizeof (vl.type));
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
+ "%s-count", name);
+ values[0].gauge = latency_counter_get_num (metric->latency);
+ plugin_dispatch_values (&vl);
+ }
+
latency_counter_reset (metric->latency);
return (0);
}
ipt_bytes value:DERIVE:0:U
ipt_packets value:DERIVE:0:U
irq value:DERIVE:0:U
-latency value:GAUGE:0:65535
+latency value:GAUGE:0:U
links value:GAUGE:0:U
load shortterm:GAUGE:0:5000, midterm:GAUGE:0:5000, longterm:GAUGE:0:5000
md_disks value:GAUGE:0:U
return (lc->max);
} /* }}} cdtime_t latency_counter_get_max */
+cdtime_t latency_counter_get_sum (latency_counter_t *lc) /* {{{ */
+{
+ if (lc == NULL)
+ return (0);
+ return (lc->sum);
+} /* }}} cdtime_t latency_counter_get_sum */
+
+size_t latency_counter_get_num (latency_counter_t *lc) /* {{{ */
+{
+ if (lc == NULL)
+ return (0);
+ return (lc->num);
+} /* }}} size_t latency_counter_get_num */
+
cdtime_t latency_counter_get_average (latency_counter_t *lc) /* {{{ */
{
double average;
cdtime_t latency_counter_get_min (latency_counter_t *lc);
cdtime_t latency_counter_get_max (latency_counter_t *lc);
+cdtime_t latency_counter_get_sum (latency_counter_t *lc);
+size_t latency_counter_get_num (latency_counter_t *lc);
cdtime_t latency_counter_get_average (latency_counter_t *lc);
cdtime_t latency_counter_get_percentile (latency_counter_t *lc,
double percent);
#endif
_Bool collect_struct;
_Bool collect_totals;
+#ifdef HAVE_VARNISH_V3
_Bool collect_uptime;
+#endif
_Bool collect_vcl;
_Bool collect_workers;
};
varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess", stats->n_sess);
/* N struct object */
varnish_submit_gauge (conf->instance, "struct", "objects", "object", stats->n_object);
+#ifdef HAVE_VARNISH_V3
/* N unresurrected objects */
varnish_submit_gauge (conf->instance, "struct", "objects", "vampireobject", stats->n_vampireobject);
/* N struct objectcore */
varnish_submit_gauge (conf->instance, "struct", "objects", "objectcore", stats->n_objectcore);
+#endif
/* N struct objecthead */
varnish_submit_gauge (conf->instance, "struct", "objects", "objecthead", stats->n_objecthead);
#ifdef HAVE_VARNISH_V2
varnish_submit_derive (conf->instance, "totals", "total_bytes", "body-bytes", stats->s_bodybytes);
}
+#ifdef HAVE_VARNISH_V3
if (conf->collect_uptime)
{
/* Client uptime */
varnish_submit_gauge (conf->instance, "uptime", "uptime", "client_uptime", stats->uptime);
}
+#endif
if (conf->collect_vcl)
{
conf->collect_sms = 0;
conf->collect_struct = 0;
conf->collect_totals = 0;
+#ifdef HAVE_VARNISH_V3
conf->collect_uptime = 0;
+#endif
conf->collect_vcl = 0;
conf->collect_workers = 0;
cf_util_get_boolean (child, &conf->collect_struct);
else if (strcasecmp ("CollectTotals", child->key) == 0)
cf_util_get_boolean (child, &conf->collect_totals);
+#ifdef HAVE_VARNISH_V3
else if (strcasecmp ("CollectUptime", child->key) == 0)
cf_util_get_boolean (child, &conf->collect_uptime);
+#endif
else if (strcasecmp ("CollectVCL", child->key) == 0)
cf_util_get_boolean (child, &conf->collect_vcl);
else if (strcasecmp ("CollectWorkers", child->key) == 0)
#endif
&& !conf->collect_struct
&& !conf->collect_totals
+#ifdef HAVE_VARNISH_V3
&& !conf->collect_uptime
+#endif
&& !conf->collect_vcl
&& !conf->collect_workers)
{