# FSType "ext3"
# IgnoreSelected false
# ReportByDevice false
-# ReportReserved false
# ReportInodes false
# ValuesAbsolute true
# ValuesPercentage false
B<Interface> is inverted: All selected interfaces are ignored and all
other interfaces are collected.
+It is possible to use regular expressions to match interface names, if the
+name is surrounded by I</.../> and collectd was compiled with support for
+regexps. This is useful if there's a need to collect (or ignore) data
+for a group of interfaces that are similarly named, without the need to
+explicitly list all of them (especially useful if the list is dynamic).
+Example:
+
+ Interface "lo"
+ Interface "/^veth/"
+ Interface "/^tun[0-9]+/"
+ IgnoreSelected "true"
+
+This will ignore the loopback interface, all interfaces with names starting
+with I<veth> and all interfaces with names starting with I<tun> followed by
+at least one digit.
+
+
=back
=head2 Plugin C<ipmi>
=head2 Plugin C<ntpd>
+The C<ntpd> plugin collects per-peer ntpd data such as time offset and time
+dispersion.
+
+For talking to B<ntpd>, it mimics what the B<ntpdc> control program does on
+wire - using B<mode 7> specific requests. This mode is deprecated with
+newer B<ntpd> releases (4.2.7p230 and later). For the C<ntpd> plugin to work
+correctly with them, the ntp daemon must be explicitly configured to
+enable B<mode 7> (which is disabled by default). Refer to the I<ntp.conf(5)>
+manual page for details.
+
+Available configuration options for the C<ntpd> plugin:
+
=over 4
=item B<Host> I<Hostname>
"FSType",
"IgnoreSelected",
"ReportByDevice",
- "ReportReserved",
"ReportInodes",
"ValuesAbsolute",
"ValuesPercentage"
else
{
if (strcmp (mnt_ptr->dir, "/") == 0)
- {
- if (strcmp (mnt_ptr->type, "rootfs") == 0)
- continue;
sstrncpy (disk_name, "root", sizeof (disk_name));
- }
else
{
int i, len;
{
if (virInitialize () != 0)
return -1;
-
- return 0;
+ else
+ return 0;
}
static int
if (host == NULL)
return (EINVAL);
+#if COLLECT_DEBUG
modbus_set_debug (&host->connection, 1);
+#endif
/* We'll do the error handling ourselves. */
modbus_set_error_handling (&host->connection, NOP_ON_ERROR);
return (-1);
}
+#if COLLECT_DEBUG
modbus_set_debug (host->connection, 1);
+#endif
/* We'll do the error handling ourselves. */
modbus_set_error_recovery (host->connection, 0);
uint16_t values[2];
int values_num;
const data_set_t *ds;
- int status;
+ int status = 0;
if ((host == NULL) || (slave == NULL) || (data == NULL))
return (EINVAL);
"`ProcessMatch' with the same name. "
"All but the first setting will be "
"ignored.");
+#if HAVE_REGEX_H
sfree (new->re);
+#endif
sfree (new);
return;
}
/* Leave the rest at zero if this is only a zombi */
if (ps->num_proc == 0)
{
- DEBUG ("processes plugin: This is only a zombi: pid = %i; "
+ DEBUG ("processes plugin: This is only a zombie: pid = %i; "
"name = %s;", pid, ps->name);
return (0);
}
#endif /*KERNEL_LINUX */
#if KERNEL_SOLARIS
-static const char *ps_get_cmdline (long pid, /* {{{ */
- char *buffer, size_t buffer_size)
+static char *ps_get_cmdline (pid_t pid, char *name __attribute__((unused)), /* {{{ */
+ char *buffer, size_t buffer_size)
{
char path[PATH_MAX];
psinfo_t info;
ps_list_add (ps.name,
- ps_get_cmdline (pid, cmdline, sizeof (cmdline)),
+ ps_get_cmdline (pid, ps.name, cmdline, sizeof (cmdline)),
&pse);
} /* while(readdir) */
closedir (proc);
return (1);
}
- len = strlen (datadir);
- while ((len > 0) && (datadir[len - 1] == '/'))
+ len = strlen (tmp);
+ while ((len > 0) && (tmp[len - 1] == '/'))
{
len--;
- datadir[len] = 0;
+ tmp[len] = 0;
}
if (len == 0)
return (1);
}
- sfree (datadir);
+ if (datadir != NULL)
+ {
+ sfree (datadir);
+ }
+
datadir = tmp;
}
else if (strcasecmp ("StepSize", key) == 0)
for (i = 0; i < ci->children_num; i++)
{
oconfig_item_t *option = ci->children + i;
- int status;
+ int status = 0;
if (strcasecmp ("Match", option->key) == 0)
{
#elif HAVE_UTMP_H
# include <utmp.h>
/* #endif HAVE_UTMP_H */
-
-#else
-# error "No applicable input method."
#endif
static void users_submit (gauge_t value)
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Lubos Stanek <lubek at users.sourceforge.net>
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Lubos Stanek <lubek at users.sourceforge.net>
#include "common.h"
#include <math.h>
+#include <limits.h>
+
+#ifndef LLONG_MAX
+# define LLONG_MAX 9223372036854775807LL
+#endif
#ifndef HISTOGRAM_NUM_BINS
# define HISTOGRAM_NUM_BINS 1000
#endif
-static const int HISTOGRAM_DEFAULT_BIN_WIDTH = 1;
+#ifndef HISTOGRAM_DEFAULT_BIN_WIDTH
+/* 1048576 = 2^20 ^= 1/1024 s */
+# define HISTOGRAM_DEFAULT_BIN_WIDTH 1048576
+#endif
struct latency_counter_s
{
cdtime_t min;
cdtime_t max;
- int bin_width;
+ cdtime_t bin_width;
int histogram[HISTOGRAM_NUM_BINS];
};
*
* So, if the required bin width is 300, then new bin width will be 512 as it is
* the next nearest power of 2.
-*
*/
-void change_bin_width (latency_counter_t *lc, size_t val) /* {{{ */
+void change_bin_width (latency_counter_t *lc, cdtime_t latency) /* {{{ */
{
- int i=0;
/* This function is called because the new value is above histogram's range.
* First find the required bin width:
* requiredBinWidth = (value + 1) / numBins
* then get the next nearest power of 2
* newBinWidth = 2^(ceil(log2(requiredBinWidth)))
*/
- double required_bin_width = (double)(val + 1) / HISTOGRAM_NUM_BINS;
- double required_bin_width_logbase2 = log(required_bin_width) / log(2.0);
- int new_bin_width = (int)(pow(2.0, ceil( required_bin_width_logbase2)));
- int old_bin_width = lc->bin_width;
+ double required_bin_width = ((double) (latency + 1)) / ((double) HISTOGRAM_NUM_BINS);
+ double required_bin_width_logbase2 = log (required_bin_width) / log (2.0);
+ cdtime_t new_bin_width = (cdtime_t) (pow (2.0, ceil (required_bin_width_logbase2)) + .5);
+ cdtime_t old_bin_width = lc->bin_width;
+
lc->bin_width = new_bin_width;
- /*
- * bin width has been increased, now iterate through all bins and move the
- * old bin's count to new bin.
- */
+ /* bin_width has been increased, now iterate through all bins and move the
+ * old bin's count to new bin. */
if (lc->num > 0) // if the histogram has data then iterate else skip
{
- double width_change_ratio = old_bin_width / new_bin_width;
- for (i=0; i<HISTOGRAM_NUM_BINS; i++)
+ double width_change_ratio = ((double) old_bin_width) / ((double) new_bin_width);
+ size_t i;
+
+ for (i = 0; i < HISTOGRAM_NUM_BINS; i++)
{
- int new_bin = (int)(i * width_change_ratio);
+ size_t new_bin = (size_t) (((double) i) * width_change_ratio);
if (i == new_bin)
continue;
+ assert (new_bin < i);
+
lc->histogram[new_bin] += lc->histogram[i];
lc->histogram[i] = 0;
}
- DEBUG("utils_latency: change_bin_width: fixed all bins");
}
- DEBUG("utils_latency: change_bin_width: val-[%zu], oldBinWidth-[%d], "
- "newBinWidth-[%d], required_bin_width-[%f], "
- "required_bin_width_logbase2-[%f]",
- val, old_bin_width, new_bin_width, required_bin_width,
- required_bin_width_logbase2);
-
+ DEBUG("utils_latency: change_bin_width: latency = %.3f; "
+ "old_bin_width = %.3f; new_bin_width = %.3f;",
+ CDTIME_T_TO_DOUBLE (latency),
+ CDTIME_T_TO_DOUBLE (old_bin_width),
+ CDTIME_T_TO_DOUBLE (new_bin_width));
} /* }}} void change_bin_width */
latency_counter_t *latency_counter_create () /* {{{ */
void latency_counter_add (latency_counter_t *lc, cdtime_t latency) /* {{{ */
{
- size_t latency_ms;
+ cdtime_t bin;
- if ((lc == NULL) || (latency == 0))
+ if ((lc == NULL) || (latency == 0) || (latency > ((cdtime_t) LLONG_MAX)))
return;
lc->sum += latency;
/* A latency of _exactly_ 1.0 ms should be stored in the buffer 0, so
* subtract one from the cdtime_t value so that exactly 1.0 ms get sorted
* accordingly. */
- latency_ms = (size_t) CDTIME_T_TO_MS (latency - 1);
-
- int bin = (int)(latency_ms / lc->bin_width);
+ bin = (latency - 1) / lc->bin_width;
if (bin >= HISTOGRAM_NUM_BINS)
{
- change_bin_width(lc, latency_ms);
- bin = (int)(latency_ms / lc->bin_width);
+ change_bin_width (lc, latency);
+ bin = (latency - 1) / lc->bin_width;
if (bin >= HISTOGRAM_NUM_BINS)
{
- ERROR("utils_latency: latency_counter_add: Invalid bin %d", bin);
+ ERROR ("utils_latency: latency_counter_add: Invalid bin: %"PRIu64, bin);
return;
}
}
if (lc == NULL)
return;
- int bin_width = lc->bin_width;
+ cdtime_t bin_width = lc->bin_width;
memset (lc, 0, sizeof (*lc));
/* preserve bin width */
return (DOUBLE_TO_CDTIME_T (average));
} /* }}} cdtime_t latency_counter_get_average */
-cdtime_t latency_counter_get_percentile (latency_counter_t *lc,
+cdtime_t latency_counter_get_percentile (latency_counter_t *lc, /* {{{ */
double percent)
{
double percent_upper;
double percent_lower;
- double ms_upper;
- double ms_lower;
- double ms_interpolated;
+ double p;
+ cdtime_t latency_lower;
+ cdtime_t latency_interpolated;
int sum;
size_t i;
assert (percent_upper >= percent);
assert (percent_lower < percent);
- ms_upper = (double) ( (i + 1) * lc->bin_width );
- ms_lower = (double) ( i * lc->bin_width );
if (i == 0)
- return (MS_TO_CDTIME_T (ms_upper));
+ return (lc->bin_width);
+
+ latency_lower = ((cdtime_t) i) * lc->bin_width;
+ p = (percent - percent_lower) / (percent_upper - percent_lower);
- ms_interpolated = (((percent_upper - percent) * ms_lower)
- + ((percent - percent_lower) * ms_upper))
- / (percent_upper - percent_lower);
+ latency_interpolated = latency_lower
+ + DOUBLE_TO_CDTIME_T (p * CDTIME_T_TO_DOUBLE (lc->bin_width));
- return (MS_TO_CDTIME_T (ms_interpolated));
+ DEBUG ("latency_counter_get_percentile: latency_interpolated = %.3f",
+ CDTIME_T_TO_DOUBLE (latency_interpolated));
+ return (latency_interpolated);
} /* }}} cdtime_t latency_counter_get_percentile */
/* vim: set sw=2 sts=2 et fdm=marker : */
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Florian Forster <octo at verplant.org>
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Florian Forster <octo at verplant.org>
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Niki W. Waibel <niki.waibel@gmx.net>
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Niki W. Waibel <niki.waibel@gmx.net>
stats = VSC_Main(vd);
varnish_monitor (conf, stats);
- VSM_Close (vd);
+ VSM_Delete (vd);
return (0);
} /* }}} */
value_ptr = &value[0];
status = format_values (value_ptr, value_size, ds, vl, /* store rates = */ 0);
- pthread_mutex_lock (&node->lock);
if (status != 0)
return (status);
+ pthread_mutex_lock (&node->lock);
+
if (node->conn == NULL)
{
node->conn = credis_connect (node->host, node->port, node->timeout);