From: Florian Forster
Date: Sun, 13 Jun 2010 19:44:09 +0000 (+0200)
Subject: Merge branch 'collectd-4.9' into collectd-4.10
X-Git-Tag: collectd-4.10.1~6
X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=2bdaa472d6955a8c93c6aa77f11748d4c611558e;hp=4faea334095e49d68825b0eb042a9a286d0e91e7;p=collectd.git
Merge branch 'collectd-4.9' into collectd-4.10
---
diff --git a/contrib/GenericJMX.conf b/contrib/GenericJMX.conf
index f4dd8f0e..1d3fe564 100644
--- a/contrib/GenericJMX.conf
+++ b/contrib/GenericJMX.conf
@@ -91,6 +91,12 @@
#
+ ######################################
+ # Define the "jmx_memory" type as: #
+ # jmx_memory value:GAUGE:0:U #
+ # See types.db(5) for details. #
+ ######################################
+
# Generic heap/nonheap memory usage.
ObjectName "java.lang:type=Memory"
@@ -99,7 +105,7 @@
# Creates four values: committed, init, max, used
- Type "memory"
+ Type "jmx_memory"
#InstancePrefix ""
#InstanceFrom ""
Table true
@@ -109,11 +115,12 @@
# Creates four values: committed, init, max, used
- Type "memory"
+ Type "jmx_memory"
#InstancePrefix ""
#InstanceFrom ""
Table true
Attribute "NonHeapMemoryUsage"
+ InstancePrefix "nonheap-"
@@ -124,7 +131,7 @@
InstanceFrom "name"
- Type "memory"
+ Type "jmx_memory"
#InstancePrefix ""
#InstanceFrom ""
Table true
diff --git a/contrib/collectd2html.pl b/contrib/collectd2html.pl
index 7953d67c..fe4e2bdb 100644
--- a/contrib/collectd2html.pl
+++ b/contrib/collectd2html.pl
@@ -44,7 +44,7 @@ use Getopt::Long qw(:config no_ignore_case bundling pass_through);
my $DIR = "/var/lib/collectd";
my $HOST = undef;
my $IMG_FMT = "PNG";
-my $RECURSIVE = 0;
+my $RECURSIVE = 1;
GetOptions (
"host=s" => \$HOST,
@@ -63,12 +63,12 @@ if (defined($HOST) && ($DIR !~ m/\/$HOST\/?$/) && (-d "$DIR/$HOST")) {
my @COLORS = (0xff7777, 0x7777ff, 0x55ff55, 0xffcc77, 0xff77ff, 0x77ffff,
0xffff77, 0x55aaff);
-my @tmp = `/bin/hostname`; chomp(@tmp);
+my @tmp = `/bin/hostname -f`; chomp(@tmp);
$HOST = $tmp[0] if (! defined $HOST);
my $svg_p = ($IMG_FMT eq "SVG");
my $IMG_SFX = $svg_p ? ".svg" : ".png";
my $IMG_DIR = "${HOST}.dir";
-my $HTML = "${HOST}.html";
+my $HTML = "${HOST}.xhtml";
################################################################################
#
@@ -118,14 +118,20 @@ open(OUT, ">$HTML");
my $title="Rrd plot for $HOST";
print OUT <
-
+
+
+
$title
+
-
END
# list interesting rrd
@@ -140,27 +146,28 @@ else {
}
chomp(@list);
-foreach my $rrd (sort @list){
+@list = sort @list;
+foreach my $rrd (@list){
$rrd =~ m/^$DIR\/(.*)\.rrd$/;
push(@rrds, $1);
}
# table of contents
print OUT <$title
-
+
+
END
foreach my $bn (@rrds){
my $cleaned_bn = $bn;
$cleaned_bn =~ tr/%\//__/;
print OUT <$bn
+$bn
END
}
print OUT <
+
END
# graph interesting rrd
@@ -205,7 +212,7 @@ for (my $i = 0; $i < scalar(@rrds); ++$i) {
my $cleaned_bn = $bn;
$cleaned_bn =~ tr/%\//__/;
print OUT <$bn
+
END
# graph various ranges
@@ -222,24 +229,28 @@ END
my $cleaned_img = $img; $cleaned_img =~ s/%/%25/g;
if (! $svg_p) {
print OUT <
+
END
} else {
print OUT <
+
END
}
}
print OUT <[top]
+[top]
END
}
print OUT <
+
+
+
+
END
diff --git a/src/bind.c b/src/bind.c
index 63887747..6e0b907f 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -21,7 +21,11 @@
* Florian Forster
**/
-#define _XOPEN_SOURCE 600 /* glibc2 needs this for strptime */
+#include "config.h"
+
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 600 /* glibc2 needs this for strptime */
+#endif
#include "collectd.h"
#include "common.h"
diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c
index 63d4e9d7..0c748ba7 100644
--- a/src/libcollectdclient/client.c
+++ b/src/libcollectdclient/client.c
@@ -777,9 +777,9 @@ int lcc_putval (lcc_connection_t *c, const lcc_value_list_t *vl) /* {{{ */
SSTRCATF (command, " interval=%i", vl->interval);
if (vl->time > 0)
- SSTRCATF (command, "%u", (unsigned int) vl->time);
+ SSTRCATF (command, " %u", (unsigned int) vl->time);
else
- SSTRCAT (command, "N");
+ SSTRCAT (command, " N");
for (i = 0; i < vl->values_len; i++)
{
diff --git a/src/powerdns.c b/src/powerdns.c
index 3e7ebb33..29f6bca5 100644
--- a/src/powerdns.c
+++ b/src/powerdns.c
@@ -46,12 +46,12 @@
#define FUNC_ERROR(func) do { char errbuf[1024]; ERROR ("powerdns plugin: %s failed: %s", func, sstrerror (errno, errbuf, sizeof (errbuf))); } while (0)
#define SERVER_SOCKET LOCALSTATEDIR"/run/pdns.controlsocket"
-#define SERVER_COMMAND "SHOW *"
+#define SERVER_COMMAND "SHOW * \n"
#define RECURSOR_SOCKET LOCALSTATEDIR"/run/pdns_recursor.controlsocket"
#define RECURSOR_COMMAND "get noerror-answers nxdomain-answers " \
"servfail-answers sys-msec user-msec qa-latency cache-entries cache-hits " \
- "cache-misses questions"
+ "cache-misses questions\n"
struct list_item_s;
typedef struct list_item_s list_item_t;
@@ -439,6 +439,11 @@ static int powerdns_get_data_stream (list_item_t *item, /* {{{ */
return (-1);
}
+ struct timeval timeout;
+ timeout.tv_sec=5;
+ timeout.tv_usec=0;
+ status = setsockopt (sd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof (timeout));
+
status = connect (sd, (struct sockaddr *) &item->sockaddr,
sizeof (item->sockaddr));
if (status != 0)
@@ -531,7 +536,7 @@ static int powerdns_read_server (list_item_t *item) /* {{{ */
int fields_num;
if (item->command == NULL)
- item->command = strdup ("SHOW *");
+ item->command = strdup (SERVER_COMMAND);
if (item->command == NULL)
{
ERROR ("powerdns plugin: strdup failed.");
@@ -612,7 +617,7 @@ static int powerdns_update_recursor_command (list_item_t *li) /* {{{ */
else
{
sstrncpy (buffer, "get ", sizeof (buffer));
- status = strjoin (&buffer[4], sizeof (buffer) - strlen ("get "),
+ status = strjoin (&buffer[strlen("get ")], sizeof (buffer) - strlen ("get "),
li->fields, li->fields_num,
/* seperator = */ " ");
if (status < 0)
@@ -620,6 +625,14 @@ static int powerdns_update_recursor_command (list_item_t *li) /* {{{ */
ERROR ("powerdns plugin: strjoin failed.");
return (-1);
}
+ buffer[sizeof (buffer) - 1] = 0;
+ int i = strlen (buffer);
+ if (i < sizeof (buffer) - 2)
+ {
+ buffer[i++] = ' ';
+ buffer[i++] = '\n';
+ buffer[i++] = '\0';
+ }
}
buffer[sizeof (buffer) - 1] = 0;
diff --git a/src/processes.c b/src/processes.c
index c642e58a..8a3df644 100644
--- a/src/processes.c
+++ b/src/processes.c
@@ -1797,6 +1797,11 @@ static int ps_read (void)
pse.vmem_code = 0;
pse.stack_size = 0;
+ pse.io_rchar = -1;
+ pse.io_wchar = -1;
+ pse.io_syscr = -1;
+ pse.io_syscw = -1;
+
ps_list_add (cmdline, cargs, &pse);
} /* for (i = 0 .. nprocs) */
diff --git a/src/snmp.c b/src/snmp.c
index fdb7c658..1c2828c1 100644
--- a/src/snmp.c
+++ b/src/snmp.c
@@ -755,7 +755,21 @@ static value_t csnmp_value_list_to_value (struct variable_list *vl, int type,
}
else
{
- WARNING ("snmp plugin: I don't know the ASN type `%i'", (int) vl->type);
+ char oid_buffer[1024];
+
+ memset (oid_buffer, 0, sizeof (oid_buffer));
+ snprint_objid (oid_buffer, sizeof (oid_buffer) - 1,
+ vl->name, vl->name_length);
+
+#ifdef ASN_NULL
+ if (vl->type == ASN_NULL)
+ INFO ("snmp plugin: OID \"%s\" is undefined (type ASN_NULL)",
+ oid_buffer);
+ else
+#endif
+ WARNING ("snmp plugin: I don't know the ASN type \"%i\" (OID: %s)",
+ (int) vl->type, oid_buffer);
+
defined = 0;
}
@@ -952,7 +966,7 @@ static int csnmp_strvbcopy (char *dst, /* {{{ */
for (i = 0; i < num_chars; i++)
{
/* Check for control characters. */
- if ((src[i] >= 0) && (src[i] < 32))
+ if ((unsigned char)src[i] < 32)
return (csnmp_strvbcopy_hexstring (dst, vb, dst_size));
dst[i] = src[i];
}