Fixes syntax and compile errors in src/apache.c
[collectd.git] / src / disk.c
index e3638f2..ea49717 100644 (file)
@@ -65,6 +65,9 @@ typedef struct diskstats
 {
        char *name;
 
+       /* This overflows in roughly 1361 year */
+       unsigned int poll_count;
+
        unsigned int read_sectors;
        unsigned int write_sectors;
 
@@ -138,6 +141,7 @@ static void partition_write (char *host, char *inst, char *val)
        rrd_update_file (host, file, val, part_ds_def, part_ds_num);
 }
 
+#if DISK_HAVE_READ
 #define BUFSIZE 512
 static void disk_submit (char *disk_name,
                unsigned long long read_count,
@@ -161,7 +165,6 @@ static void disk_submit (char *disk_name,
        plugin_submit (MODULE_NAME, disk_name, buf);
 }
 
-#if DISK_HAVE_READ
 static void partition_submit (char *part_name,
                unsigned long long read_count,
                unsigned long long read_bytes,
@@ -300,6 +303,10 @@ static void disk_read (void)
                read_bytes  = ds->read_bytes;
                write_bytes = ds->write_bytes;
 
+               /* Don't write to the RRDs if we've just started.. */
+               ds->poll_count++;
+               if (ds->poll_count <= 6)
+                       continue;
 
                if ((read_count == 0) && (write_count == 0))
                        continue;