* scale target: This target to scale (multiply) values by an arbitrary
value has been added.
+2009-12-18, Version 4.8.2
+ * Build system, java plugin: Don't use “find -L” to search for Java
+ headers, because it's a GNU extension.
+ * Build system: Support for parallel builds has been improved. Thanks
+ Sebastian Harl and Stefan Völkel for looking into this.
+ * collectd: Print error messages to STDERR if no log plugin has been
+ loaded.
+ * genericjmx plugin: Close and re-open the connection upon I/O-errors.
+ * gmond plugin: Fix typos which caused syntax errors.
+ * memory plugin: Handling of >4 Gbyte of memory has been fixed.
+ * network plugin: The license has been changed to LGPL 2.1.
+ * oracle plugin: Reconnect to the database if the connection dies.
+ * rrdcached plugin: Work-around for a bug in RRDtool 1.4rc2 has been
+ added.
+ * snmp plugin: Handling of negative values has been fixed. Strings
+ containing control characters are now interpreted as hex-strings.
+ * unixsock plugin: A memory leak in the LISTVAL command has been
+ fixed. Thanks to Ben Knight for his patch.
+
2009-10-04, Version 4.8.1
* Build system: Issues when building the iptables plugin have been
fixed.
been added. “DERIVE” can be used for counters that are reset
occasionally. Thanks to Mariusz Gronczewski for implementing this.
* thresholds: The advanced threshold options “Percentage”, “Hits”, and
- “Hysteresis” have been added. Thanks to Andrés J. Díaz for hit
+ “Hysteresis” have been added. Thanks to Andrés J. Díaz for his
patches.
* curl_json plugin: The new cURL-JSON plugin reads JSON files using
the cURL library and parses the contents according to user
lists, where at least one data source is of type COUNTER and the
counter value of all counter data sources is zero.
+2009-12-18, Version 4.7.5
+ * Build system, java plugin: Don't use “find -L” to search for Java
+ headers, because it's a GNU extension.
+ * Build system: Support for parallel builds has been improved. Thanks
+ Sebastian Harl and Stefan Völkel for looking into this.
+ * collectd: Print error messages to STDERR if no log plugin has been
+ loaded.
+ * memory plugin: Handling of >4 Gbyte of memory has been fixed.
+ * network plugin: The license has been changed to LGPL 2.1.
+ * oracle plugin: Reconnect to the database if the connection dies.
+ * rrdcached plugin: Work-around for a bug in RRDtool 1.4rc2 has been
+ added.
+ * snmp plugin: Handling of negative values has been fixed. Strings
+ containing control characters are now interpreted as hex-strings.
+ * unixsock plugin: A memory leak in the LISTVAL command has been
+ fixed. Thanks to Ben Knight for his patch.
+
2009-10-03, Version 4.7.4
* Build system: Issues when building the iptables plugin have been
fixed.
collectd without the need to start a heavy interpreter every interval.
See collectd-python(5) for details.
+ - routeros
+ Query interface and wireless registration statistics from RouterOS.
+
- rrdcached
RRDtool caching daemon (RRDcacheD) statistics.
- match_empty_counter
Match counter values which are currently zero.
+ - match_hashed
+ Match values using a hash function of the hostname.
+
- match_regex
Match values by their identifier based on regular expressions.
- target_replace
Replace parts of an identifier using regular expressions.
+ - target_scale
+ Scale (multiply) values by an arbitrary value.
+
- target_set
Set (overwrite) entire parts of an identifier.
EXTRA_DIST = perl/Makefile.PL \
perl/lib/Collectd.pm \
perl/lib/Collectd/Unixsock.pm \
+ perl/lib/Collectd/Plugins/Monitorus.pm \
perl/lib/Collectd/Plugins/OpenVZ.pm
all-local: @PERL_BINDINGS@
FC_TARGET, "invoke"
);
+my %fc_cb_types = (
+ FC_CB_EXEC, "exec",
+ FC_CB_CREATE, "create",
+ FC_CB_DESTROY, "destroy"
+);
+
foreach my $type (keys %types) {
$plugins[$type] = &share ({});
}
}
if (TYPE_LOG != $type) {
- DEBUG ("Collectd::plugin_call: type = \"$type\", args=\"@_\"");
+ DEBUG ("Collectd::plugin_call: type = \"$type\" ("
+ . $types{$type} . "), args=\""
+ . join(', ', map { defined($_) ? $_ : '<undef>' } @_) . "\"");
}
if (! defined $plugins[$type]) {
my $data = shift;
DEBUG ("Collectd::plugin_register: "
- . "type = \"$type\", name = \"$name\", data = \"$data\"");
+ . "type = \"$type\" (" . $types{$type}
+ . "), name = \"$name\", data = \"$data\"");
if (! ((defined $type) && (defined $name) && (defined $data))) {
ERROR ("Usage: Collectd::plugin_register (type, name, data)");
my $type = shift;
my $name = shift;
- DEBUG ("Collectd::plugin_unregister: type = \"$type\", name = \"$name\"");
+ DEBUG ("Collectd::plugin_unregister: type = \"$type\" ("
+ . $types{$type} . "), name = \"$name\"");
if (! ((defined $type) && (defined $name))) {
ERROR ("Usage: Collectd::plugin_unregister (type, name)");
}
DEBUG ("Collectd::fc_call: "
- . "type = \"$type\", name = \"$name\", cb_type = \"$cb_type\"");
+ . "type = \"$type\" (" . $fc_types{$type}
+ . "), name = \"$name\", cb_type = \"$cb_type\" ("
+ . $fc_cb_types{$cb_type} . ")");
{
lock %{$fc_plugins[$type]};
my %fc : shared;
DEBUG ("Collectd::fc_register: "
- . "type = \"$type\", name = \"$name\", proc = \"$proc\"");
+ . "type = \"$type\" (" . $fc_types{$type}
+ . "), name = \"$name\", proc = \"$proc\"");
if (! ((defined $type) && (defined $name) && (defined $proc))) {
ERROR ("Usage: Collectd::fc_register(type, name, proc)");
# Jeff Green <jeff at kikisoso.org>
#
-package Collectd::Plugin::Monitorus;
+package Collectd::Plugins::Monitorus;
use strict;
use warnings;
with_libupsclient="use_libupsclient_config"
else if test -x "$withval/bin/libupsclient-config"
then
- with_libupsclient_config="$withval/bin/net-snmp-config"
+ with_libupsclient_config="$withval/bin/libupsclient-config"
with_libupsclient="use_libupsclient_config"
else
AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
distribution itself:
* Config::General
+ * Regexp::Common
* HTML::Entities
* RRDs
return (-1);
}
- if (ci->values[0].type != OCONFIG_TYPE_BOOLEAN)
+ if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN)
{
if (ci->values[0].value.boolean)
*ret_boolean = 1;
if (0 == access (battery_acpi_dir, R_OK))
walk_directory (battery_acpi_dir, battery_read_acpi,
- /* user_data = */ NULL);
+ /* user_data = */ NULL,
+ /* include hidden */ 0);
else
{
char errbuf[1024];
B<1.> collectd will try to import the B<readline> module to give you a decent
way of entering your commands. The daemonized collectd won't do that.
-=item
+=item
B<2.> collectd will block I<SIGINT>. Pressing I<Ctrl+C> will usually cause
collectd to shut down. This would be problematic in an interactive session,
To quit collectd send I<EOF> (press I<Ctrl+D> at the beginning of a new line).
+=item
+
+B<3.> collectd handles I<SIGCHLD>. This means that python won't be able to
+determine the return code of spawned processes with system(), popen() and
+subprocess. This will result in python not using external programs like less
+to display help texts. You can override this behavior with the B<PAGER>
+environment variable, e.g. I<export PAGER=less> before starting collectd.
+Depending on your version of python this might or might not result in an
+B<OSError> exception which can be ignored.
+
=back
=item E<lt>B<Module> I<Name>E<gt> block
Data descriptors defined here:
=over 4
-
+
=item parent
This represents the parent of this node. On the root node
of the config tree it will be None.
-
+
=item key
This is the keyword of this item, i.e. the first word of any given line in the
config file. It will always be a string.
-
+
=item values
This is a tuple (which might be empty) of all value, i.e. words following the
Every item in this tuple will be either a string or a float or a boolean,
depending on the contents of the configuration file.
-
+
=item children
This is a tuple of child nodes. For most nodes this will be empty. If this node
=over 4
=item B<dispatch>([type][, values][, plugin_instance][, type_instance][, plugin][, host][, time][, interval]) -> None.
-
+
Dispatch this instance to the collectd process. The object has members for each
of the possible arguments for this method. For a detailed explanation of these
parameters see the member of the same same.
source. This value has to be a positive integer, so you can't submit more than
one value per second. If this member is set to a non-positive value, the
default value as specified in the config file will be used (default: 10).
-
+
If you submit values more often than the specified interval, the average will
be used. If you submit less values, your graphs will have gaps.
=over 4
=item B<dispatch>([type][, values][, plugin_instance][, type_instance][, plugin][, host][, time][, interval]) -> None. Dispatch a value list.
-
+
Dispatch this instance to the collectd process. The object has members for each
of the possible arguments for this method. For a detailed explanation of these
parameters see the member of the same same.
-
+
If you do not submit a parameter the value saved in its member will be
submitted. If you do provide a parameter it will be used instead, without
altering the member.
The gauge-values returned by the SNMP-agent are multiplied by I<Value>. This
is useful when values are transfered as a fixed point real number. For example,
thermometers may transfer B<243> but actually mean B<24.3>, so you can specify
-a scale value of B<0.1> to correct this. The default value is of course B<1.0>.
+a scale value of B<0.1> to correct this. The default value is, of course,
+B<1.0>.
This value is not applied to counter-values.
I<Value> is added to gauge-values returned by the SNMP-agent after they have
been multiplied by any B<Scale> value. If, for example, a thermometer returns
degrees Kelvin you could specify a shift of B<273.15> here to store values in
-degrees Celsius. The default value is of course B<0.0>.
+degrees Celsius. The default value is, of course, B<0.0>.
This value is not applied to counter-values.
@BUILD_PLUGIN_MEMORY_TRUE@@BUILD_PLUGIN_MEMORY_TRUE@LoadPlugin memory
#@BUILD_PLUGIN_MULTIMETER_TRUE@LoadPlugin multimeter
#@BUILD_PLUGIN_MYSQL_TRUE@LoadPlugin mysql
+#@BUILD_PLUGIN_NETAPP_TRUE@LoadPlugin netapp
#@BUILD_PLUGIN_NETLINK_TRUE@LoadPlugin netlink
@LOAD_PLUGIN_NETWORK@LoadPlugin network
#@BUILD_PLUGIN_NFS_TRUE@LoadPlugin nfs
#@BUILD_PLUGIN_POWERDNS_TRUE@LoadPlugin powerdns
#@BUILD_PLUGIN_PROCESSES_TRUE@LoadPlugin processes
#@BUILD_PLUGIN_PROTOCOLS_TRUE@LoadPlugin protocols
+#@BUILD_PLUGIN_PYTHON_TRUE@LoadPlugin python
+#@BUILD_PLUGIN_ROUTEROS_TRUE@LoadPlugin routeros
#@BUILD_PLUGIN_RRDCACHED_TRUE@LoadPlugin rrdcached
@LOAD_PLUGIN_RRDTOOL@LoadPlugin rrdtool
#@BUILD_PLUGIN_SENSORS_TRUE@LoadPlugin sensors
# URL "http://finance.google.com/finance?q=NYSE%3AAMD"
# User "foo"
# Password "bar"
+# MeasureResponseTime false
# <Match>
# Regex "<span +class=\"pr\"[^>]*> *([0-9]*\\.[0-9]+) *</span>"
# DSType "GaugeAverage"
# FSType "ext3"
# IgnoreSelected false
# ReportByDevice false
+# ReportReserved false
+# ReportInodes false
#</Plugin>
#<Plugin disk>
# </Database>
#</Plugin>
+#<Plugin netapp>
+# <Host "netapp1.example.com">
+# Protocol "https"
+# Address "10.0.0.1"
+# Port 443
+# User "username"
+# Password "aef4Aebe"
+# Interval 30
+#
+# <WAFL>
+# Interval 30
+# GetNameCache true
+# GetDirCache true
+# GetBufferCache true
+# GetInodeCache true
+# </WAFL>
+#
+# <Disks>
+# Interval 30
+# GetBusy true
+# </Disks>
+#
+# <VolumePerf>
+# Interval 30
+# GetIO "volume0"
+# IgnoreSelectedIO false
+# GetOps "volume0"
+# IgnoreSelectedOps false
+# GetLatency "volume0"
+# IgnoreSelectedLatency false
+# </VolumePerf>
+#
+# <VolumeUsage>
+# Interval 30
+# GetCapacity "vol0"
+# GetCapacity "vol1"
+# IgnoreSelectedCapacity false
+# GetSnapshot "vol1"
+# GetSnapshot "vol3"
+# IgnoreSelectedSnapshot false
+# </VolumeUsage>
+#
+# <System>
+# Interval 30
+# GetCPULoad true
+# GetInterfaces true
+# GetDiskOps true
+# GetDiskIO true
+# </System>
+# </Host>
+#</Plugin>
+
#<Plugin netlink>
# Interface "All"
# VerboseInterface "All"
# IncludeDir "/my/include/path"
# BaseName "Collectd::Plugin"
# EnableDebugger ""
-# LoadPlugin foo
+# LoadPlugin Monitorus
+# LoadPlugin OpenVZ
#
# <Plugin foo>
# Foo "Bar"
#<Plugin ping>
# Host "host.foo.bar"
+# Interval 1.0
+# Timeout 0.9
# TTL 255
+# SourceAddress "1.2.3.4"
+# Device "eth0"
+# MaxMissed -1
#</Plugin>
#<Plugin postgresql>
# IgnoreSelected false
#</Plugin>
+#<Plugin python>
+# ModulePath "/path/to/your/python/modules"
+# LogTraces true
+# Interactive true
+# Import "spam"
+#
+# <Module spam>
+# spam "wonderful" "lovely"
+# </Module>
+#</Plugin>
+
+#<Plugin routeros>
+# <Router>
+# Host "router.example.com"
+# Port "8728"
+# User "admin"
+# Password "dozaiTh4"
+# CollectInterface true
+# CollectRegistrationTable true
+# </Router>
+#</Plugin>
+
#<Plugin rrdcached>
# DaemonAddress "unix:/tmp/rrdcached.sock"
# DataDir "@prefix@/var/lib/@PACKAGE_NAME@/rrd"
# Load required matches:
#@BUILD_PLUGIN_MATCH_EMPTY_COUNTER_TRUE@LoadPlugin match_empty_counter
+#@BUILD_PLUGIN_MATCH_HASHED_TRUE@LoadPlugin match_hashed
#@BUILD_PLUGIN_MATCH_REGEX_TRUE@LoadPlugin match_regex
#@BUILD_PLUGIN_MATCH_VALUE_TRUE@LoadPlugin match_value
#@BUILD_PLUGIN_MATCH_TIMEDIFF_TRUE@LoadPlugin match_timediff
# Load required targets:
#@BUILD_PLUGIN_TARGET_NOTIFICATION_TRUE@LoadPlugin target_notification
#@BUILD_PLUGIN_TARGET_REPLACE_TRUE@LoadPlugin target_replace
+#@BUILD_PLUGIN_TARGET_SCALE_TRUE@LoadPlugin target_scale
#@BUILD_PLUGIN_TARGET_SET_TRUE@LoadPlugin target_set
#----------------------------------------------------------------------------#
=item B<MeasureResponseTime> B<true>|B<false>
-Measure response time for the request. Disabled by default.
+Measure response time for the request. If this setting is enabled, B<Match>
+blocks (see below) are optional. Disabled by default.
=item B<E<lt>MatchE<gt>>
One or more B<Match> blocks that define how to match information in the data
returned by C<libcurl>. The C<curl> plugin uses the same infrastructure that's
used by the C<tail> plugin, so please see the documentation of the C<tail>
-plugin below on how matches are defined.
+plugin below on how matches are defined. If the B<MeasureResponseTime> option
+is set to B<true>, B<Match> blocks are optional.
=back
Controls whether or not to recurse into subdirectories. Enabled by default.
+=item B<IncludeHidden> I<true>|I<false>
+
+Controls whether or not to include "hidden" files and directories in the count.
+"Hidden" files and directories are those, whose name begins with a dot.
+Defaults to I<false>, i.e. by default hidden files and directories are ignored.
+
=back
=head2 Plugin C<GenericJMX>
interface name (e.E<nbsp>g. C<eth0>). This might not be supported by all
operating systems.
+=item B<MaxMissed> I<Packets>
+
+Trigger a DNS resolv after the host has not replied to I<Packets> packets. This
+enables the use of dynamic DNS services (like dyndns.org) with the ping plugin.
+
+Default: B<-1> (disabled)
+
=back
=head2 Plugin C<postgresql>
} /* int notification_init */
int walk_directory (const char *dir, dirwalk_callback_f callback,
- void *user_data)
+ void *user_data, int include_hidden)
{
struct dirent *ent;
DIR *dh;
while ((ent = readdir (dh)) != NULL)
{
int status;
-
- if (ent->d_name[0] == '.')
- continue;
+
+ if (include_hidden)
+ {
+ if ((strcmp (".", ent->d_name) == 0)
+ || (strcmp ("..", ent->d_name) == 0))
+ continue;
+ }
+ else /* if (!include_hidden) */
+ {
+ if (ent->d_name[0]=='.')
+ continue;
+ }
status = (*callback) (dir, ent->d_name, user_data);
if (status != 0)
typedef int (*dirwalk_callback_f)(const char *dirname, const char *filename,
void *user_data);
int walk_directory (const char *dir, dirwalk_callback_f callback,
- void *user_data);
+ void *user_data, int hidden);
int read_file_contents (const char *filename, char *buf, int bufsize);
counter_t counter_diff (counter_t old_value, counter_t new_value);
/**
* collectd - src/curl.c
* Copyright (C) 2006-2009 Florian octo Forster
+ * Copyright (C) 2009 Aman Gupta
*
* 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:
* Florian octo Forster <octo at verplant.org>
+ * Aman Gupta <aman at tmm1.net>
**/
#include "collectd.h"
/**
* collectd - src/df.c
- * Copyright (C) 2005-2007 Florian octo Forster
+ * Copyright (C) 2005-2009 Florian octo Forster
* Copyright (C) 2009 Paul Sadauskas
*
* This program is free software; you can redistribute it and/or modify it
#include <fnmatch.h>
#define FC_RECURSIVE 1
+#define FC_HIDDEN 2
struct fc_directory_conf_s
{
return (0);
} /* int fc_config_add_dir_size */
-static int fc_config_add_dir_recursive (fc_directory_conf_t *dir,
- oconfig_item_t *ci)
+static int fc_config_add_dir_option (fc_directory_conf_t *dir,
+ oconfig_item_t *ci, int bit)
{
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
}
if (ci->values[0].value.boolean)
- dir->options |= FC_RECURSIVE;
+ dir->options |= bit;
else
- dir->options &= ~FC_RECURSIVE;
+ dir->options &= ~bit;
return (0);
-} /* int fc_config_add_dir_recursive */
+} /* int fc_config_add_dir_option */
static int fc_config_add_dir (oconfig_item_t *ci)
{
else if (strcasecmp ("Size", option->key) == 0)
status = fc_config_add_dir_size (dir, option);
else if (strcasecmp ("Recursive", option->key) == 0)
- status = fc_config_add_dir_recursive (dir, option);
+ status = fc_config_add_dir_option (dir, option, FC_RECURSIVE);
+ else if (strcasecmp ("IncludeHidden", option->key) == 0)
+ status = fc_config_add_dir_option (dir, option, FC_HIDDEN);
else
{
WARNING ("filecount plugin: fc_config_add_dir: "
if (S_ISDIR (statbuf.st_mode) && (dir->options & FC_RECURSIVE))
{
- status = walk_directory (abs_path, fc_read_dir_callback, dir);
+ status = walk_directory (abs_path, fc_read_dir_callback, dir,
+ /* include hidden = */ (dir->options & FC_HIDDEN) ? 1 : 0);
return (status);
}
else if (!S_ISREG (statbuf.st_mode))
if (dir->mtime != 0)
dir->now = time (NULL);
-
- status = walk_directory (dir->path, fc_read_dir_callback, dir);
+
+ status = walk_directory (dir->path, fc_read_dir_callback, dir,
+ /* include hidden */ (dir->options & FC_HIDDEN) ? 1 : 0);
if (status != 0)
{
WARNING ("filecount plugin: walk_directory (%s) failed.", dir->path);
vm_statistics_data_t vm_data;
mach_msg_type_number_t vm_data_len;
- long long wired;
- long long active;
- long long inactive;
- long long free;
+ gauge_t wired;
+ gauge_t active;
+ gauge_t inactive;
+ gauge_t free;
if (!port_host || !pagesize)
return (-1);
* This memory is not being used.
*/
- wired = vm_data.wire_count * pagesize;
- active = vm_data.active_count * pagesize;
- inactive = vm_data.inactive_count * pagesize;
- free = vm_data.free_count * pagesize;
+ wired = (gauge_t) (((uint64_t) vm_data.wire_count) * ((uint64_t) pagesize));
+ active = (gauge_t) (((uint64_t) vm_data.active_count) * ((uint64_t) pagesize));
+ inactive = (gauge_t) (((uint64_t) vm_data.inactive_count) * ((uint64_t) pagesize));
+ free = (gauge_t) (((uint64_t) vm_data.free_count) * ((uint64_t) pagesize));
memory_submit ("wired", wired);
memory_submit ("active", active);
* Copyright (C) 2009 Aman Gupta
*
* 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
- * Free Software Foundation; only version 2 of the License is applicable.
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; only version 2.1 of the License is
+ * applicable.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * 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
+ * You should have received a copy of the GNU Lesser 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 octo Forster <octo at verplant.org>
size_t i;
int status;
+ if (db->oci_service_context != NULL)
+ {
+ OCIServer *server_handle;
+ ub4 connection_status;
+
+ server_handle = NULL;
+ status = OCIAttrGet ((void *) db->oci_service_context, OCI_HTYPE_SVCCTX,
+ (void *) &server_handle, /* size pointer = */ NULL,
+ OCI_ATTR_SERVER, oci_error);
+ if (status != OCI_SUCCESS)
+ {
+ o_report_error ("o_read_database", "OCIAttrGet", oci_error);
+ return (-1);
+ }
+ assert (server_handle != NULL);
+
+ connection_status = 0;
+ status = OCIAttrGet ((void *) server_handle, OCI_HTYPE_SERVER,
+ (void *) &connection_status, /* size pointer = */ NULL,
+ OCI_ATTR_SERVER_STATUS, oci_error);
+ if (status != OCI_SUCCESS)
+ {
+ o_report_error ("o_read_database", "OCIAttrGet", oci_error);
+ return (-1);
+ }
+
+ if (connection_status != OCI_SERVER_NORMAL)
+ {
+ INFO ("oracle plugin: Connection to %s lost. Trying to reconnect.",
+ db->name);
+ OCIHandleFree (db->oci_service_context, OCI_HTYPE_SVCCTX);
+ db->oci_service_context = NULL;
+ }
+ } /* if (db->oci_service_context != NULL) */
+
if (db->oci_service_context == NULL)
{
status = OCILogon (oci_env, oci_error,
uint32_t pkg_sent;
uint32_t pkg_recv;
+ uint32_t pkg_missed;
double latency_total;
double latency_squared;
static int ping_ttl = PING_DEF_TTL;
static double ping_interval = 1.0;
static double ping_timeout = 0.9;
+static int ping_max_missed = -1;
static int ping_thread_loop = 0;
static int ping_thread_error = 0;
#endif
"TTL",
"Interval",
- "Timeout"
+ "Timeout",
+ "MaxMissed"
};
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
hl->pkg_recv++;
hl->latency_total += latency;
hl->latency_squared += (latency * latency);
- }
+
+ /* reset missed packages counter */
+ hl->pkg_missed = 0;
+ } else
+ hl->pkg_missed++;
+
+ /* if the host did not answer our last N packages, trigger a resolv. */
+ if (ping_max_missed >= 0 && hl->pkg_missed >= ping_max_missed)
+ { /* {{{ */
+ /* we reset the missed package counter here, since we only want to
+ * trigger a resolv every N packages and not every package _AFTER_ N
+ * missed packages */
+ hl->pkg_missed = 0;
+
+ WARNING ("ping plugin: host %s has not answered %d PING requests,"
+ " triggering resolve", hl->host, ping_max_missed);
+
+ /* we trigger the resolv simply be removeing and adding the host to our
+ * ping object */
+ status = ping_host_remove (pingobj, hl->host);
+ if (status != 0)
+ {
+ WARNING ("ping plugin: ping_host_remove (%s) failed.", hl->host);
+ }
+ else
+ {
+ status = ping_host_add (pingobj, hl->host);
+ if (status != 0)
+ WARNING ("ping plugin: ping_host_add (%s) failed.", hl->host);
+ }
+ } /* }}} ping_max_missed */
} /* }}} for (iter) */
if (gettimeofday (&tv_end, NULL) < 0)
hl->host = host;
hl->pkg_sent = 0;
hl->pkg_recv = 0;
+ hl->pkg_missed = 0;
hl->latency_total = 0.0;
hl->latency_squared = 0.0;
hl->next = hostlist_head;
WARNING ("ping plugin: Ignoring invalid timeout %g (%s)",
tmp, value);
}
+ else if (strcasecmp (key, "MaxMissed") == 0)
+ {
+ ping_max_missed = atoi (value);
+ if (ping_max_missed < 0)
+ INFO ("ping plugin: MaxMissed < 0, disabled re-resolving of hosts");
+ }
else
{
return (-1);
* Copyright (C) 2006-2008 Florian octo Forster
* Copyright (C) 2008 Oleg King
* Copyright (C) 2009 Sebastian Harl
+ * Copyright (C) 2009 Andrés J. Díaz
* Copyright (C) 2009 Manuel Sanmartin
*
* This program is free software; you can redistribute it and/or modify it
* Florian octo Forster <octo at verplant.org>
* Oleg King <king2 at kaluga.ru>
* Sebastian Harl <sh at tokkee.org>
+ * Andrés J. Díaz <ajdiaz at connectical.com>
* Manuel Sanmartin
**/
};
typedef struct cr_data_s cr_data_t;
-static void cr_submit_io (const char *type, const char *type_instance, /* {{{ */
- counter_t rx, counter_t tx)
+static void cr_submit_io (cr_data_t *rd, const char *type, /* {{{ */
+ const char *type_instance, counter_t rx, counter_t tx)
{
value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.host, rd->node, sizeof (vl.host));
sstrncpy (vl.plugin, "routeros", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
} /* }}} void cr_submit_io */
-static void submit_interface (const ros_interface_t *i) /* {{{ */
+static void submit_interface (cr_data_t *rd, /* {{{ */
+ const ros_interface_t *i)
{
if (i == NULL)
return;
if (!i->running)
{
- submit_interface (i->next);
+ submit_interface (rd, i->next);
return;
}
- cr_submit_io ("if_packets", i->name,
+ cr_submit_io (rd, "if_packets", i->name,
(counter_t) i->rx_packets, (counter_t) i->tx_packets);
- cr_submit_io ("if_octets", i->name,
+ cr_submit_io (rd, "if_octets", i->name,
(counter_t) i->rx_bytes, (counter_t) i->tx_bytes);
- cr_submit_io ("if_errors", i->name,
+ cr_submit_io (rd, "if_errors", i->name,
(counter_t) i->rx_errors, (counter_t) i->tx_errors);
- cr_submit_io ("if_dropped", i->name,
+ cr_submit_io (rd, "if_dropped", i->name,
(counter_t) i->rx_drops, (counter_t) i->tx_drops);
- submit_interface (i->next);
+ submit_interface (rd, i->next);
} /* }}} void submit_interface */
static int handle_interface (__attribute__((unused)) ros_connection_t *c, /* {{{ */
- const ros_interface_t *i, __attribute__((unused)) void *user_data)
+ const ros_interface_t *i, void *user_data)
{
- submit_interface (i);
+ if ((i == NULL) || (user_data == NULL))
+ return (EINVAL);
+
+ submit_interface (user_data, i);
return (0);
} /* }}} int handle_interface */
-static void cr_submit_gauge (const char *type, /* {{{ */
+static void cr_submit_gauge (cr_data_t *rd, const char *type, /* {{{ */
const char *type_instance, gauge_t value)
{
value_t values[1];
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.host, rd->node, sizeof (vl.host));
sstrncpy (vl.plugin, "routeros", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
} /* }}} void cr_submit_gauge */
-static void submit_regtable (const ros_registration_table_t *r) /* {{{ */
+static void submit_regtable (cr_data_t *rd, /* {{{ */
+ const ros_registration_table_t *r)
{
char type_instance[DATA_MAX_NAME_LEN];
/*** RX ***/
ssnprintf (type_instance, sizeof (type_instance), "%s-%s-rx",
r->interface, r->radio_name);
- cr_submit_gauge ("bitrate", type_instance,
+ cr_submit_gauge (rd, "bitrate", type_instance,
(gauge_t) (1000000.0 * r->rx_rate));
- cr_submit_gauge ("signal_power", type_instance,
+ cr_submit_gauge (rd, "signal_power", type_instance,
(gauge_t) r->rx_signal_strength);
- cr_submit_gauge ("signal_quality", type_instance,
+ cr_submit_gauge (rd, "signal_quality", type_instance,
(gauge_t) r->rx_ccq);
/*** TX ***/
ssnprintf (type_instance, sizeof (type_instance), "%s-%s-tx",
r->interface, r->radio_name);
- cr_submit_gauge ("bitrate", type_instance,
+ cr_submit_gauge (rd, "bitrate", type_instance,
(gauge_t) (1000000.0 * r->tx_rate));
- cr_submit_gauge ("signal_power", type_instance,
+ cr_submit_gauge (rd, "signal_power", type_instance,
(gauge_t) r->tx_signal_strength);
- cr_submit_gauge ("signal_quality", type_instance,
+ cr_submit_gauge (rd, "signal_quality", type_instance,
(gauge_t) r->tx_ccq);
/*** RX / TX ***/
ssnprintf (type_instance, sizeof (type_instance), "%s-%s",
r->interface, r->radio_name);
- cr_submit_io ("if_octets", type_instance,
+ cr_submit_io (rd, "if_octets", type_instance,
(counter_t) r->rx_bytes, (counter_t) r->tx_bytes);
- cr_submit_gauge ("snr", type_instance, (gauge_t) r->signal_to_noise);
+ cr_submit_gauge (rd, "snr", type_instance, (gauge_t) r->signal_to_noise);
- submit_regtable (r->next);
+ submit_regtable (rd, r->next);
} /* }}} void submit_regtable */
static int handle_regtable (__attribute__((unused)) ros_connection_t *c, /* {{{ */
- const ros_registration_table_t *r,
- __attribute__((unused)) void *user_data)
+ const ros_registration_table_t *r, void *user_data)
{
- submit_regtable (r);
+ if ((r == NULL) || (user_data == NULL))
+ return (EINVAL);
+
+ submit_regtable (user_data, r);
return (0);
} /* }}} int handle_regtable */
if (rd->collect_interface)
{
status = ros_interface (rd->connection, handle_interface,
- /* user data = */ NULL);
+ /* user data = */ rd);
if (status != 0)
{
char errbuf[128];
if (rd->collect_regtable)
{
status = ros_registration_table (rd->connection, handle_regtable,
- /* user data = */ NULL);
+ /* user data = */ rd);
if (status != 0)
{
char errbuf[128];
rc->values = NULL;
rc->first_value = 0;
rc->last_value = 0;
+ rc->random_variation = 0;
rc->flags = FLAG_NONE;
new_rc = 1;
}
static int thermal_sysfs_read (void)
{
return walk_directory (dirname_sysfs, thermal_sysfs_device_read,
- /* user_data = */ NULL);
+ /* user_data = */ NULL, /* include hidden */ 0);
}
static int thermal_procfs_read (void)
{
return walk_directory (dirname_procfs, thermal_procfs_device_read,
- /* user_data = */ NULL);
+ /* user_data = */ NULL, /* include hidden */ 0);
}
static int thermal_init (void)
#!/bin/sh
-DEFAULT_VERSION="4.8.1.git"
+DEFAULT_VERSION="4.8.2.git"
VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"