Merge branch 'pull/master'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Fri, 25 May 2007 17:51:59 +0000 (19:51 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Fri, 25 May 2007 17:51:59 +0000 (19:51 +0200)
contrib/migrate-3-4.px
src/exec.c
src/network.c

index cbbc179..31abae4 100755 (executable)
@@ -125,7 +125,7 @@ our %TypeRename =
 
 GetOptions ("indir|i=s" => \$InDir,
        "outdir|o=s" => \$OutDir,
-       "hostname=s" => \$Hostname) or exit (1);
+       "hostname=s" => \$Hostname) or exit_usage ();
 
 die "No such directory: $InDir" if (!-d $InDir);
 
@@ -374,3 +374,11 @@ sub special_disk
        $dest_filename = get_filename ($dest);
        print "./extractDS.px -i '$InDir/$orig_filename' -s 'rtime' -s 'wtime' -o '$OutDir/$dest_filename' -d 'read' -d 'write'\n";
 }
+
+sub exit_usage
+{
+       print <<EOF;
+Usage: $0 [-i indir] [-o outdir] [--hostname myhostname]
+EOF
+       exit (1);
+}
index 518efc8..bd96e07 100644 (file)
@@ -273,9 +273,15 @@ static void *exec_read_one (void *arg)
     char *type_instance;
     char *value;
 
-    DEBUG ("buffer = %s", buffer);
-
     len = strlen (buffer);
+
+    /* Remove newline from end. */
+    while ((len > 0) && ((buffer[len - 1] == '\n')
+         || (buffer[len - 1] == '\r')))
+      buffer[--len] = '\0';
+
+    DEBUG ("exec plugin: exec_read_one: buffer = %s", buffer);
+
     if (len < 5)
       continue;
 
@@ -299,11 +305,15 @@ static void *exec_read_one (void *arg)
 
     value = strchr (type_instance, ',');
     if (value == NULL)
+    {
+      WARNING ("exec plugin: type-instance is missing.");
       continue;
+    }
     *value = '\0';
     value++;
 
-    DEBUG ("value = %s", value);
+    DEBUG ("exec plugin: exec_read_one: type = %s; type_instance = %s; "
+       "value = %s;", type, type_instance, value);
 
     if (strcasecmp ("counter", type) == 0)
       submit_counter (type_instance, atoll (value));
index a426c13..34385bf 100644 (file)
@@ -385,7 +385,8 @@ static int parse_part_values (void **ret_buffer, int *ret_buffer_len,
 
        if (buffer_len < (15))
        {
-               DEBUG ("packet is too short: buffer_len = %i", buffer_len);
+               DEBUG ("network plugin: packet is too short: buffer_len = %i",
+                               buffer_len);
                return (-1);
        }
 
@@ -1047,7 +1048,7 @@ static void network_send_buffer (const char *buffer, int buffer_len)
        sockent_t *se;
        int status;
 
-       DEBUG ("buffer_len = %i", buffer_len);
+       DEBUG ("network plugin: network_send_buffer: buffer_len = %i", buffer_len);
 
        for (se = sending_sockets; se != NULL; se = se->next)
        {