Code

Merge branch 'collectd-4.2'
authorFlorian Forster <octo@huhu.verplant.org>
Mon, 18 Feb 2008 19:53:54 +0000 (20:53 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Mon, 18 Feb 2008 19:53:54 +0000 (20:53 +0100)
contrib/migrate-3-4.px
src/rrdtool.c

index 31abae4b38f52c41c62f918972768a4e30a884c4..e50c0cdffff0845161c88dc374b7ce957b671227 100755 (executable)
@@ -95,6 +95,7 @@ our %Subdirs =
 our %TypeTranslate =
 (
        cpu => sub { $_ = shift; $_->{'plugin_instance'} = $_->{'type_instance'}; $_->{'type_instance'} = undef; $_; },
+       hddtemp => sub { $_ = shift; $_->{'plugin'} = 'hddtemp'; $_->{'type'} = 'temperature'; $_->{'type_instance'} = _special_disk_instance ($_->{'type_instance'}); $_; },
        if_errors => sub { $_ = shift; $_->{'type_instance'} = $_->{'plugin_instance'}; $_->{'plugin_instance'} = undef; $_; },
        if_packets => sub { $_ = shift; $_->{'type_instance'} = $_->{'plugin_instance'}; $_->{'plugin_instance'} = undef; $_; },
        nfs2_procedures => sub { $_ = shift; @$_{qw(plugin plugin_instance type type_instance)} = ('nfs', 'v2' . $_->{'type_instance'}, 'nfs_procedure', undef); $_; },
index dc06d68a100eac4013b6080d9027df154345135a..024b04e5e928a11daaeb6edb31d0a985a8c1af4d 100644 (file)
@@ -893,6 +893,19 @@ static int rrd_cache_insert (const char *filename,
        return (0);
 } /* int rrd_cache_insert */
 
+static int rrd_compare_numeric (const void *a_ptr, const void *b_ptr)
+{
+       int a = *((int *) a_ptr);
+       int b = *((int *) b_ptr);
+
+       if (a < b)
+               return (-1);
+       else if (a > b)
+               return (1);
+       else
+               return (0);
+} /* int rrd_compare_numeric */
+
 static int rrd_write (const data_set_t *ds, const value_list_t *vl)
 {
        struct stat  statbuf;
@@ -1031,6 +1044,12 @@ static int rrd_config (const char *key, const char *value)
                        if (rra_timespans_custom[rra_timespans_custom_num] != 0)
                                rra_timespans_custom_num++;
                } /* while (strtok_r) */
+
+               qsort (/* base = */ rra_timespans_custom,
+                               /* nmemb  = */ rra_timespans_custom_num,
+                               /* size   = */ sizeof (rra_timespans_custom[0]),
+                               /* compar = */ rrd_compare_numeric);
+
                free (value_copy);
        }
        else if (strcasecmp ("XFF", key) == 0)