author | Florian Forster <octo@collectd.org> | |
Thu, 30 May 2013 07:00:09 +0000 (09:00 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 30 May 2013 07:00:09 +0000 (09:00 +0200) |
22 files changed:
diff --git a/src/collectd-email.pod b/src/collectd-email.pod
index e19d13ec21e8ddc7c087835a3aa05ee7105de711..6f58542784d51a206c685eedee1eed488cd3b101 100644 (file)
--- a/src/collectd-email.pod
+++ b/src/collectd-email.pod
+=encoding UTF-8
+
=head1 NAME
collectd-email - Documentation of collectd's C<email plugin>
diff --git a/src/collectd-exec.pod b/src/collectd-exec.pod
index 10f68290e9bbc8ae8c7479364068f0b3ccae5b30..2c5963025a4269687307cf9e5c1f3d43cae70e47 100644 (file)
--- a/src/collectd-exec.pod
+++ b/src/collectd-exec.pod
+=encoding UTF-8
+
=head1 NAME
collectd-exec - Documentation of collectd's C<exec plugin>
Since examples usually let one understand a lot better, here are some:
- leeloo/cpu-0/cpu-idle N:2299366
- alice/interface/if_octets-eth0 interval=10 1180647081:421465:479194
-
-Since this action was the only one supported with older versions of the C<exec
-plugin> all lines were treated as if they were prefixed with B<PUTVAL>. This is
-still the case to maintain backwards compatibility but deprecated.
+ PUTVAL leeloo/cpu-0/cpu-idle N:2299366
+ PUTVAL alice/interface/if_octets-eth0 interval=10 1180647081:421465:479194
=item B<PUTNOTIF> [I<OptionList>] B<message=>I<Message>
diff --git a/src/collectd-java.pod b/src/collectd-java.pod
index 9e2f81aa9b9f0056d3aefa215605688b47f8ae81..00f209a56b7d69e3f35757f86876e194321dbab0 100644 (file)
--- a/src/collectd-java.pod
+++ b/src/collectd-java.pod
+=encoding UTF-8
+
=head1 NAME
collectd-java - Documentation of collectd's "java plugin"
index d7c749cd3391aefc86369c208193063111655fe6..aab753c56539d8c2a9bcb5b2196a9b8ae6c5dfd7 100644 (file)
--- a/src/collectd-nagios.pod
+++ b/src/collectd-nagios.pod
+=encoding UTF-8
+
=head1 NAME
collectd-nagios - Nagios plugin for querying collectd
diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod
index ee05e002d4fea57996ed5cf6543c38d166a35c13..669e3f415ef26ef6b196d4e2a15d22127fdf8c78 100644 (file)
--- a/src/collectd-perl.pod
+++ b/src/collectd-perl.pod
+=encoding UTF-8
+
=head1 NAME
collectd-perl - Documentation of collectd's C<perl plugin>
index 39503ad0ba15dfb89ceaf66606ab3afeca442328..426a7118c99b8346d38e1d659ff2f4142090c594 100644 (file)
--- a/src/collectd-python.pod
+++ b/src/collectd-python.pod
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
+=encoding UTF-8
+
=head1 NAME
collectd-python - Documentation of collectd's C<python plugin>
diff --git a/src/collectd-snmp.pod b/src/collectd-snmp.pod
index 3c6e79970dacff29c556c423899b480ca1d85bf8..fd7a50896486211c3fac9b0ef6d10304738dcb4c 100644 (file)
--- a/src/collectd-snmp.pod
+++ b/src/collectd-snmp.pod
+=encoding UTF-8
+
=head1 NAME
collectd-snmp - Documentation of collectd's C<snmp plugin>
diff --git a/src/collectd-tg.pod b/src/collectd-tg.pod
index 5f1b630d53704993486ea25ffbe547bac6cbcb35..97112e7b6bae1e7b15475f803228ed69004632b3 100644 (file)
--- a/src/collectd-tg.pod
+++ b/src/collectd-tg.pod
+=encoding UTF-8
+
=head1 NAME
collectd-tg - Traffic generator for collectd.
index 02e41b8b83e90cc34d60faa263f558f7a54dbc89..e340f1ac6bbc22157301d7df909d9670bc82699d 100644 (file)
+=encoding UTF-8
+
=head1 NAME
collectd-threshold - Documentation of collectd's I<Threshold plugin>
index 83802a14f7a0ba2576c94f0b223b1ddc07b54f67..40626d3739db266d3f10043485cbf45fd1e7b27f 100644 (file)
+=encoding UTF-8
+
=head1 NAME
collectd-unixsock - Documentation of collectd's C<unixsock plugin>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index af068604f45ff7bacd3d0b411ab5e1f2755370b3..0a2a5f7790de1ca30e5b93aa714d97af5073b3d0 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
+=encoding UTF-8
+
=head1 NAME
collectd.conf - Configuration for the system statistics collection daemon B<collectd>
=head2 Plugin C<varnish>
-The Varnish plugin collects information about Varnish, an HTTP accelerator.
+The I<varnish plugin> collects information about Varnish, an HTTP accelerator.
+
+Synopsis:
+
+ <Plugin "varnish">
+ <Instance "example">
+ CollectCache true
+ CollectConnections true
+ CollectBackend true
+ CollectSHM true
+ CollectESI false
+ CollectFetch false
+ CollectHCB false
+ CollectSMA false
+ CollectSMS false
+ CollectSM false
+ CollectTotals false
+ CollectWorkers false
+ </Instance>
+ </Plugin>
+
+The configuration consists of one or more E<lt>B<Instance>E<nbsp>I<Name>E<gt>
+blocks. I<Name> is the parameter passed to "varnishd -n". If left empty, it
+will collectd statistics from the default "varnishd" instance (this should work
+fine in most cases).
+
+Inside each E<lt>B<Instance>E<gt> blocks, the following options are recognized:
=over 4
diff --git a/src/collectd.pod b/src/collectd.pod
index e36dcdf3eb0c9ebe031970da77cf86d777a36059..2f7b9f707439c795fcf85acfaede29ec39821a2e 100644 (file)
--- a/src/collectd.pod
+++ b/src/collectd.pod
+=encoding UTF-8
+
=head1 NAME
collectd - System statistics collection daemon
diff --git a/src/collectdctl.pod b/src/collectdctl.pod
index 21c0b500c37d36c55b7d90a97674206a8065f876..52b8ef23d625a956bc11ce7dd7e256a9ac1a6a91 100644 (file)
--- a/src/collectdctl.pod
+++ b/src/collectdctl.pod
+=encoding UTF-8
+
=head1 NAME
collectdctl - Control interface for collectd
diff --git a/src/collectdmon.pod b/src/collectdmon.pod
index 73ba6b8c166b98b22c4b2204739dd1d4167d1f3d..3151e1104c9e73b6f251de329a93cb258480cd4c 100644 (file)
--- a/src/collectdmon.pod
+++ b/src/collectdmon.pod
+=encoding UTF-8
+
=head1 NAME
collectdmon - Monitoring daemon for collectd
diff --git a/src/configfile.c b/src/configfile.c
index ac5e8edcb94f2bfda66c5eefab67dfab3c66e6db..154c041cee2d8b6d01ff4021c723810993c91dac 100644 (file)
--- a/src/configfile.c
+++ b/src/configfile.c
sfree (pattern);
if (new == NULL)
- continue;
+ return (-1);
/* Now replace the i'th child in `root' with `new'. */
cf_ci_replace_child (root, new, i);
const char *pattern, int depth)
{
oconfig_item_t *root;
+ int status;
assert (depth < CF_MAX_DEPTH);
return (NULL);
}
- cf_include_all (root, depth);
+ status = cf_include_all (root, depth);
+ if (status != 0)
+ {
+ oconfig_free (root);
+ return (NULL);
+ }
return (root);
} /* oconfig_item_t *cf_read_file */
wordfree (&we);
- if (root->children == NULL)
- {
- oconfig_free (root);
- return (NULL);
- }
-
return (root);
} /* oconfig_item_t *cf_read_generic */
/* #endif HAVE_WORDEXP_H */
ERROR ("Unable to read config file %s.", filename);
return (-1);
}
+ else if (conf->children_num == 0)
+ {
+ ERROR ("Configuration file %s is empty.", filename);
+ oconfig_free (conf);
+ return (-1);
+ }
for (i = 0; i < conf->children_num; i++)
{
diff --git a/src/dns.c b/src/dns.c
index fe3b672a21d844b2190c80e7b2f7bffd9adb9b50..00fcff191e0ccf0177ec7bea309eb2964b331228 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
pthread_mutex_unlock (&opcode_mutex);
}
-static void *dns_child_loop (__attribute__((unused)) void *dummy)
+static int dns_run_pcap_loop (void)
{
pcap_t *pcap_obj;
char pcap_error[PCAP_ERRBUF_SIZE];
"failed: %s",
(pcap_device != NULL) ? pcap_device : "any",
pcap_error);
- return (NULL);
+ return (PCAP_ERROR);
}
memset (&fp, 0, sizeof (fp));
- if (pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0) < 0)
+ status = pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0);
+ if (status < 0)
{
- ERROR ("dns plugin: pcap_compile failed");
- return (NULL);
+ ERROR ("dns plugin: pcap_compile failed: %s",
+ pcap_statustostr (status));
+ return (status);
}
- if (pcap_setfilter (pcap_obj, &fp) < 0)
+
+ status = pcap_setfilter (pcap_obj, &fp);
+ if (status < 0)
{
- ERROR ("dns plugin: pcap_setfilter failed");
- return (NULL);
+ ERROR ("dns plugin: pcap_setfilter failed: %s",
+ pcap_statustostr (status));
+ return (status);
}
DEBUG ("dns plugin: PCAP object created.");
status = pcap_loop (pcap_obj,
-1 /* loop forever */,
handle_pcap /* callback */,
- NULL /* Whatever this means.. */);
- if (status < 0)
- ERROR ("dns plugin: Listener thread is exiting "
- "abnormally: %s", pcap_geterr (pcap_obj));
-
- DEBUG ("dns plugin: Child is exiting.");
+ NULL /* user data */);
+ INFO ("dns plugin: pcap_loop exited with status %i.", status);
+ /* We need to handle "PCAP_ERROR" specially because libpcap currently
+ * doesn't return PCAP_ERROR_IFACE_NOT_UP for compatibility reasons. */
+ if (status == PCAP_ERROR)
+ status = PCAP_ERROR_IFACE_NOT_UP;
pcap_close (pcap_obj);
- listen_thread_init = 0;
- pthread_exit (NULL);
+ return (status);
+} /* int dns_run_pcap_loop */
+
+static int dns_sleep_one_interval (void) /* {{{ */
+{
+ cdtime_t interval;
+ struct timespec ts = { 0, 0 };
+ int status = 0;
+
+ interval = plugin_get_interval ();
+ CDTIME_T_TO_TIMESPEC (interval, &ts);
+
+ while (42)
+ {
+ struct timespec rem = { 0, 0 };
+
+ status = nanosleep (&ts, &rem);
+ if (status == 0)
+ break;
+ else if ((errno == EINTR) || (errno == EAGAIN))
+ {
+ ts = rem;
+ continue;
+ }
+ else
+ break;
+ }
+
+ return (status);
+} /* }}} int dns_sleep_one_interval */
+
+static void *dns_child_loop (__attribute__((unused)) void *dummy) /* {{{ */
+{
+ int status;
+
+ while (42)
+ {
+ status = dns_run_pcap_loop ();
+ if (status != PCAP_ERROR_IFACE_NOT_UP)
+ break;
+ dns_sleep_one_interval ();
+ }
+
+ if (status != PCAP_ERROR_BREAK)
+ ERROR ("dns plugin: PCAP returned error %s.",
+ pcap_statustostr (status));
+
+ listen_thread_init = 0;
return (NULL);
-} /* static void dns_child_loop (void) */
+} /* }}} void *dns_child_loop */
static int dns_init (void)
{
diff --git a/src/modbus.c b/src/modbus.c
index 8a9fe93fd83eaf3b6a32221ea9c92598c225802a..887c63c03235922c2f7c62eff1d7e4409eee4f80 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
modbus_t *connection;
#endif
_Bool is_connected;
- _Bool have_reconnected;
}; /* }}} */
typedef struct mb_host_s mb_host_t;
union
{
uint8_t b[4];
+ uint16_t s[2];
float f;
} conv;
if (host == NULL)
return (EINVAL);
- if (host->is_connected)
- return (0);
-
- /* Only reconnect once per interval. */
- if (host->have_reconnected)
- return (-1);
-
modbus_set_debug (&host->connection, 1);
/* We'll do the error handling ourselves. */
}
host->is_connected = 1;
- host->have_reconnected = 1;
return (0);
} /* }}} int mb_init_connection */
/* #endif LEGACY_LIBMODBUS */
if (host->connection != NULL)
return (0);
- /* Only reconnect once per interval. */
- if (host->have_reconnected)
- return (-1);
-
if ((host->port < 1) || (host->port > 65535))
host->port = MODBUS_TCP_DEFAULT_PORT;
host->connection = modbus_new_tcp (host->node, host->port);
if (host->connection == NULL)
{
- host->have_reconnected = 1;
ERROR ("Modbus plugin: Creating new Modbus/TCP object failed.");
return (-1);
}
return (status);
}
- host->have_reconnected = 1;
return (0);
} /* }}} int mb_init_connection */
#endif /* !LEGACY_LIBMODBUS */
int values_num;
const data_set_t *ds;
int status;
- int i;
if ((host == NULL) || (slave == NULL) || (data == NULL))
return (EINVAL);
else
values_num = 1;
+ status = 0;
+ if (host->connection == NULL)
+ {
+ status = EBADF;
+ }
+ else
+ {
+ struct sockaddr sockaddr;
+ socklen_t saddrlen = sizeof (sockaddr);
+
+ status = getpeername (modbus_get_socket (host->connection),
+ &sockaddr, &saddrlen);
+ if (status != 0)
+ status = errno;
+ }
+
+ if ((status == EBADF) || (status == ENOTSOCK) || (status == ENOTCONN))
+ {
+ status = mb_init_connection (host);
+ if (status != 0)
+ {
+ ERROR ("Modbus plugin: mb_init_connection (%s/%s) failed. ",
+ host->host, host->node);
+ host->is_connected = 0;
+ host->connection = NULL;
+ return (-1);
+ }
+ }
+ else if (status != 0)
+ {
+#if LEGACY_LIBMODBUS
+ modbus_close (&host->connection);
+#else
+ modbus_close (host->connection);
+ modbus_free (host->connection);
+#endif
+ }
+
#if LEGACY_LIBMODBUS
/* Version 2.0.3: Pass the connection struct as a pointer and pass the slave
* id to each call of "read_holding_registers". */
}
#endif
- for (i = 0; i < 2; i++)
- {
- status = modbus_read_registers (host->connection,
+ status = modbus_read_registers (host->connection,
/* start_addr = */ data->register_base,
/* num_registers = */ values_num, /* buffer = */ values);
- if (status > 0)
- break;
-
- if (host->is_connected)
- {
+ if (status != values_num)
+ {
+ ERROR ("Modbus plugin: modbus_read_registers (%s/%s) failed. status = %i, values_num = %i "
+ "Giving up.", host->host, host->node, status, values_num);
#if LEGACY_LIBMODBUS
- modbus_close (&host->connection);
- host->is_connected = 0;
+ modbus_close (&host->connection);
#else
- modbus_close (host->connection);
- modbus_free (host->connection);
- host->connection = NULL;
+ modbus_close (host->connection);
+ modbus_free (host->connection);
#endif
- }
-
- /* If we already tried reconnecting this round, give up. */
- if (host->have_reconnected)
- {
- ERROR ("Modbus plugin: modbus_read_registers (%s) failed. "
- "Reconnecting has already been tried. Giving up.", host->host);
- return (-1);
- }
-
- /* Maybe the device closed the connection during the waiting interval.
- * Try re-establishing the connection. */
- status = mb_init_connection (host);
- if (status != 0)
- {
- ERROR ("Modbus plugin: modbus_read_registers (%s) failed. "
- "While trying to reconnect, connecting to \"%s\" failed. "
- "Giving up.",
- host->host, host->node);
- return (-1);
- }
-
- DEBUG ("Modbus plugin: Re-established connection to %s", host->host);
-
- /* try again */
- continue;
- } /* for (i = 0, 1) */
+ host->connection = NULL;
+ return (-1);
+ }
DEBUG ("Modbus plugin: mb_read_data: Success! "
"modbus_read_registers returned with status %i.", status);
host = user_data->data;
- /* Clear the reconnect flag. */
- host->have_reconnected = 0;
-
success = 0;
for (i = 0; i < host->slaves_num; i++)
{
diff --git a/src/mysql.c b/src/mysql.c
index d2d0b4bfc57a9ad695b592835cadd4707935fac0..d15a055fe3296f70835e8e6daed68a46b37965bc 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
ssnprintf (n.message, sizeof (n.message),
"slave SQL thread started");
plugin_dispatch_notification (&n);
- db->slave_sql_running = 0;
+ db->slave_sql_running = 1;
}
}
diff --git a/src/types.db b/src/types.db
index 3358f5df59e82c4b1b3a55b7c74239159f804edf..fb443d9e99023e59bc367e2579c6adafe7ce7bb3 100644 (file)
--- a/src/types.db
+++ b/src/types.db
irq value:DERIVE:0:U
latency value:GAUGE:0:65535
links value:GAUGE:0:U
-load shortterm:GAUGE:0:100, midterm:GAUGE:0:100, longterm:GAUGE:0:100
+load shortterm:GAUGE:0:5000, midterm:GAUGE:0:5000, longterm:GAUGE:0:5000
md_disks value:GAUGE:0:U
memcached_command value:DERIVE:0:U
memcached_connections value:GAUGE:0:U
diff --git a/src/types.db.pod b/src/types.db.pod
index 67f988195af55580ea6ab47a6d578afded6c546d..111742ba0dc5c5ae9c3a866dc9920fd4cb566bd1 100644 (file)
--- a/src/types.db.pod
+++ b/src/types.db.pod
+=encoding UTF-8
+
=head1 NAME
types.db - Data-set specifications for the system statistics collection daemon
diff --git a/src/utils_mount.h b/src/utils_mount.h
index 1f2403c3aa26412acd36046c790db290b0610ff0..83f789be9cd3acdf7f5535cb2e41ed035e3cbc2b 100644 (file)
--- a/src/utils_mount.h
+++ b/src/utils_mount.h
#ifndef COLLECTD_UTILS_MOUNT_H
#define COLLECTD_UTILS_MOUNT_H 1
+#include <stdio.h>
#if HAVE_FS_INFO_H
# include <fs_info.h>
#endif
diff --git a/src/varnish.c b/src/varnish.c
index 602f47af6231f59d40b51ccbd86800d1ca31bf3d..5de3389d862eb41828b5fb73a55f1d5fe2197104 100644 (file)
--- a/src/varnish.c
+++ b/src/varnish.c
else
{
WARNING ("Varnish plugin: Ignoring unknown "
- "configuration option: \"%s\"",
+ "configuration option: \"%s\". Did "
+ "you forget to add an <Instance /> "
+ "block around the configuration?",
child->key);
}
}