GraphWidth 400
#UnixSockAddr "/var/run/collectd-unixsock"
<Type apache_bytes>
- DataSources count
+ DataSources value
DSName "count Bytes/s"
RRDTitle "Apache Traffic"
RRDVerticalLabel "Bytes/s"
Color count 0000ff
</Type>
<Type apache_requests>
- DataSources count
+ DataSources value
DSName "count Requests/s"
RRDTitle "Apache Traffic"
RRDVerticalLabel "Requests/s"
</Type>
<Type apache_scoreboard>
Module GenericStacked
- DataSources count
+ DataSources value
RRDTitle "Apache scoreboard on {hostname}"
RRDVerticalLabel "Slots"
RRDFormat "%6.2lf"
RRDFormat "%6.1lf"
</Type>
<Type conntrack>
- DataSources conntrack
+ DataSources value
DSName conntrack Conntrack count
RRDTitle "nf_conntrack connections on {hostname}"
RRDVerticalLabel "Count"
RRDFormat "%4.0lf"
</Type>
<Type entropy>
- DataSources entropy
+ DataSources value
DSName entropy Entropy bits
RRDTitle "Available entropy on {hostname}"
RRDVerticalLabel "Bits"
Color value 00b000
</Type>
<Type frequency>
- DataSources frequency
+ DataSources value
DSName frequency Frequency
RRDTitle "Frequency ({type_instance})"
RRDVerticalLabel "Hertz"
Scale 8
</Type>
<Type percent>
- DataSources percent
+ DataSources value
DSName percent Percent
RRDTitle "Percent ({type_instance})"
RRDVerticalLabel "Percent"
Color percent 0000ff
</Type>
<Type ping>
- DataSources ping
+ DataSources value
DSName "ping Latency"
RRDTitle "Network latency ({type_instance})"
RRDVerticalLabel "Milliseconds"
Scale 0.001
</Type>
<Type users>
- DataSources users
+ DataSources value
DSName users Users
RRDTitle "Users ({type_instance}) on {hostname}"
RRDVerticalLabel "Users"
apcups_detail.battv = -1.0;
apcups_detail.loadpct = -1.0;
apcups_detail.bcharge = -1.0;
- apcups_detail.timeleft = -1.0;
+ apcups_detail.timeleft = NAN;
apcups_detail.itemp = -300.0;
apcups_detail.linefreq = -1.0;
* </Plugin>
*/
-static int cdbi_config_set_string (char **ret_string, /* {{{ */
- oconfig_item_t *ci)
-{
- char *string;
-
- if ((ci->values_num != 1)
- || (ci->values[0].type != OCONFIG_TYPE_STRING))
- {
- WARNING ("dbi plugin: The `%s' config option "
- "needs exactly one string argument.", ci->key);
- return (-1);
- }
-
- string = strdup (ci->values[0].value.string);
- if (string == NULL)
- {
- ERROR ("dbi plugin: strdup failed.");
- return (-1);
- }
-
- if (*ret_string != NULL)
- free (*ret_string);
- *ret_string = string;
-
- return (0);
-} /* }}} int cdbi_config_set_string */
-
static int cdbi_config_add_database_driver_option (cdbi_database_t *db, /* {{{ */
oconfig_item_t *ci)
{
}
memset (db, 0, sizeof (*db));
- status = cdbi_config_set_string (&db->name, ci);
+ status = cf_util_get_string (ci, &db->name);
if (status != 0)
{
sfree (db);
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("Driver", child->key) == 0)
- status = cdbi_config_set_string (&db->driver, child);
+ status = cf_util_get_string (child, &db->driver);
else if (strcasecmp ("DriverOption", child->key) == 0)
status = cdbi_config_add_database_driver_option (db, child);
else if (strcasecmp ("SelectDB", child->key) == 0)
- status = cdbi_config_set_string (&db->select_db, child);
+ status = cf_util_get_string (child, &db->select_db);
else if (strcasecmp ("Query", child->key) == 0)
status = udb_query_pick_from_list (child, queries, queries_num,
&db->queries, &db->queries_num);
return (status);
interfaces_num++;
- INFO("ethstat plugin: Registred interface %s",
+ INFO("ethstat plugin: Registered interface %s",
interfaces[interfaces_num - 1]);
return (0);
{
value_map_t *map;
int status;
+ char *key;
if ((ci->values_num < 2)
|| (ci->values_num > 3)
return (-1);
}
+ key = strdup (ci->values[0].value.string);
+ if (key == NULL)
+ {
+ ERROR ("ethstat plugin: strdup(3) failed.");
+ return (ENOMEM);
+ }
+
map = malloc (sizeof (*map));
if (map == NULL)
{
+ sfree (key);
ERROR ("ethstat plugin: malloc(3) failed.");
return (ENOMEM);
}
if (value_map == NULL)
{
sfree (map);
+ sfree (key);
ERROR ("ethstat plugin: c_avl_create() failed.");
return (-1);
}
}
status = c_avl_insert (value_map,
- /* key = */ ci->values[0].value.string,
+ /* key = */ key,
/* value = */ map);
if (status != 0)
{
- sfree (map);
if (status > 0)
- ERROR ("ethstat plugin: Multiple mappings for \"%s\".",
- ci->values[0].value.string);
+ ERROR ("ethstat plugin: Multiple mappings for \"%s\".", key);
else
- ERROR ("ethstat plugin: c_avl_insert(\"%s\") failed.",
- ci->values[0].value.string);
+ ERROR ("ethstat plugin: c_avl_insert(\"%s\") failed.", key);
+
+ sfree (map);
+ sfree (key);
return (-1);
}
return 0;
}
+static int ethstat_shutdown (void)
+{
+ void *key = NULL;
+ void *value = NULL;
+
+ if (value_map == NULL)
+ return (0);
+
+ while (c_avl_pick (value_map, &key, &value) == 0)
+ {
+ sfree (key);
+ sfree (value);
+ }
+
+ c_avl_destroy (value_map);
+ value_map = NULL;
+
+ return (0);
+}
+
void module_register (void)
{
plugin_register_complex_config ("ethstat", ethstat_config);
plugin_register_read ("ethstat", ethstat_read);
+ plugin_register_shutdown ("ethstat", ethstat_shutdown);
}
/* vim: set sw=2 sts=2 et fdm=marker : */
temperature value:GAUGE:-273.15:U
threads value:GAUGE:0:U
time_dispersion value:GAUGE:-1000000:1000000
-timeleft value:GAUGE:0:3600
+timeleft value:GAUGE:0:U
time_offset value:GAUGE:-1000000:1000000
total_bytes value:DERIVE:0:U
total_connections value:DERIVE:0:U
/**
* collectd - src/varnish.c
- * Copyright (C) 2010 Jérôme Renard
- * Copyright (C) 2010 Marc Fournier
- * Copyright (C) 2010 Florian Forster
+ * Copyright (C) 2010 Jérôme Renard
+ * Copyright (C) 2010 Marc Fournier
+ * Copyright (C) 2010-2012 Florian Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Authors:
* Jérôme Renard <jerome.renard at gmail.com>
* Marc Fournier <marc.fournier at camptocamp.com>
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
**/
/**
vd = VSM_New();
VSC_Setup(vd);
- if (VSM_n_Arg(vd, conf->instance) == -1)
+
+ if (conf->instance != NULL)
{
- ERROR ("Varnish plugin : unable to load statistics from instance");
- return (-1);
+ int status;
+
+ status = VSM_n_Arg (vd, conf->instance);
+ if (status < 0)
+ {
+ ERROR ("varnish plugin: VSM_n_Arg (\"%s\") failed "
+ "with status %i.",
+ conf->instance, status);
+ return (-1);
+ }
}
+
if (VSC_Open (vd, /* diag = */ 1))
{
ERROR ("varnish plugin: Unable to load statistics.");
za_read_derive (ksp, "stolen", "cache_operation", "stolen");
/* Issue indicators */
- za_read_derive (ksp, "mutex_miss", "mutex_operation", "miss");
+ za_read_derive (ksp, "mutex_miss", "mutex_operations", "miss");
za_read_derive (ksp, "hash_collisions", "hash_collisions", "");
/* Evictions */