9 #include <sys/statvfs.h>
14 #include "appconfig.h"
17 #include "plugin_proc.h"
19 #include "proc_self_mountinfo.h"
21 #define RRD_TYPE_DISK "disk"
26 int partition_id; // -1 = this is not a partition
32 struct disk *get_disk(unsigned long major, unsigned long minor) {
33 static char path_find_block_device_partition[FILENAME_MAX + 1] = "";
34 static struct mountinfo *mountinfo_root = NULL;
37 // search for it in our RAM list.
38 // this is sequential, but since we just walk through
39 // and the number of disks / partitions in a system
40 // should not be that many, it should be acceptable
41 for(d = disk_root; d ; d = d->next)
42 if(unlikely(d->major == major && d->minor == minor))
45 // if we found it, return it
49 if(unlikely(!path_find_block_device_partition[0])) {
50 char filename[FILENAME_MAX + 1];
51 snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, "/sys/dev/block/%lu:%lu/partition");
52 snprintfz(path_find_block_device_partition, FILENAME_MAX, "%s", config_get("plugin:proc:/proc/diskstats", "path to get block device partition", filename));
56 // create a new disk structure
57 d = (struct disk *)malloc(sizeof(struct disk));
58 if(!d) fatal("Cannot allocate memory for struct disk in proc_diskstats.");
65 // append it to the list
70 for(last = disk_root; last->next ;last = last->next);
74 // find if it is a partition
75 // by reading /sys/dev/block/MAJOR:MINOR/partition
76 char buffer[FILENAME_MAX + 1];
77 snprintfz(buffer, FILENAME_MAX, path_find_block_device_partition, major, minor);
79 int fd = open(buffer, O_RDONLY, 0666);
80 if(likely(fd != -1)) {
82 int bytes = read(fd, buffer, FILENAME_MAX);
86 d->partition_id = strtoul(buffer, NULL, 10);
88 // if the /partition file does not exist, it is a disk, not a partition
90 // ------------------------------------------------------------------------
91 // check if we can find its mount point
93 // mountinfo_find() can be called with NULL mountinfo_root
94 struct mountinfo *mi = mountinfo_find(mountinfo_root, d->major, d->minor);
96 // mountinfo_free() can be called with NULL mountinfo_root
97 mountinfo_free(mountinfo_root);
99 // re-read mountinfo in case something changed
100 mountinfo_root = mountinfo_read();
102 // search again for this disk
103 mi = mountinfo_find(mountinfo_root, d->major, d->minor);
107 d->mount_point = strdup(mi->mount_point);
108 // no need to check for NULL
110 d->mount_point = NULL;
115 int do_proc_diskstats(int update_every, unsigned long long dt) {
116 static procfile *ff = NULL;
117 static char path_to_get_hw_sector_size[FILENAME_MAX + 1] = "";
118 static int enable_new_disks = -1;
119 static int do_io = -1, do_ops = -1, do_mops = -1, do_iotime = -1, do_qops = -1, do_util = -1, do_backlog = -1, do_space = -1;
121 if(enable_new_disks == -1) enable_new_disks = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "enable new disks detected at runtime", CONFIG_ONDEMAND_ONDEMAND);
123 if(do_io == -1) do_io = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "bandwidth for all disks", CONFIG_ONDEMAND_ONDEMAND);
124 if(do_ops == -1) do_ops = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "operations for all disks", CONFIG_ONDEMAND_ONDEMAND);
125 if(do_mops == -1) do_mops = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "merged operations for all disks", CONFIG_ONDEMAND_ONDEMAND);
126 if(do_iotime == -1) do_iotime = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "i/o time for all disks", CONFIG_ONDEMAND_ONDEMAND);
127 if(do_qops == -1) do_qops = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "queued operations for all disks", CONFIG_ONDEMAND_ONDEMAND);
128 if(do_util == -1) do_util = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "utilization percentage for all disks", CONFIG_ONDEMAND_ONDEMAND);
129 if(do_backlog == -1)do_backlog = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "backlog for all disks", CONFIG_ONDEMAND_ONDEMAND);
130 if(do_space == -1) do_space = config_get_boolean_ondemand("plugin:proc:/proc/diskstats", "space usage for all disks", CONFIG_ONDEMAND_ONDEMAND);
133 char filename[FILENAME_MAX + 1];
134 snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, "/proc/diskstats");
135 ff = procfile_open(config_get("plugin:proc:/proc/diskstats", "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
139 if(!path_to_get_hw_sector_size[0]) {
140 char filename[FILENAME_MAX + 1];
141 snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, "/sys/block/%s/queue/hw_sector_size");
142 snprintfz(path_to_get_hw_sector_size, FILENAME_MAX, "%s", config_get("plugin:proc:/proc/diskstats", "path to get h/w sector size", filename));
145 ff = procfile_readall(ff);
146 if(!ff) return 0; // we return 0, so that we will retry to open it next time
148 struct statvfs * buff_statvfs;
149 if ( !(buff_statvfs = (struct statvfs *)
150 malloc(sizeof(struct statvfs)))) {
151 error("Failed to allocate memory to buffer.");
154 uint32_t lines = procfile_lines(ff), l;
157 for(l = 0; l < lines ;l++) {
159 unsigned long long major = 0, minor = 0,
160 reads = 0, mreads = 0, readsectors = 0, readms = 0,
161 writes = 0, mwrites = 0, writesectors = 0, writems = 0,
162 queued_ios = 0, busy_ms = 0, backlog_ms = 0,
163 space_avail = 0, space_avail_root = 0, space_used = 0;
165 unsigned long long last_reads = 0, last_readsectors = 0, last_readms = 0,
166 last_writes = 0, last_writesectors = 0, last_writems = 0,
169 words = procfile_linewords(ff, l);
170 if(words < 14) continue;
172 major = strtoull(procfile_lineword(ff, l, 0), NULL, 10);
173 minor = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
174 disk = procfile_lineword(ff, l, 2);
176 // # of reads completed # of writes completed
177 // This is the total number of reads or writes completed successfully.
178 reads = strtoull(procfile_lineword(ff, l, 3), NULL, 10); // rd_ios
179 writes = strtoull(procfile_lineword(ff, l, 7), NULL, 10); // wr_ios
181 // # of reads merged # of writes merged
182 // Reads and writes which are adjacent to each other may be merged for
183 // efficiency. Thus two 4K reads may become one 8K read before it is
184 // ultimately handed to the disk, and so it will be counted (and queued)
185 mreads = strtoull(procfile_lineword(ff, l, 4), NULL, 10); // rd_merges_or_rd_sec
186 mwrites = strtoull(procfile_lineword(ff, l, 8), NULL, 10); // wr_merges
188 // # of sectors read # of sectors written
189 // This is the total number of sectors read or written successfully.
190 readsectors = strtoull(procfile_lineword(ff, l, 5), NULL, 10); // rd_sec_or_wr_ios
191 writesectors = strtoull(procfile_lineword(ff, l, 9), NULL, 10); // wr_sec
193 // # of milliseconds spent reading # of milliseconds spent writing
194 // This is the total number of milliseconds spent by all reads or writes (as
195 // measured from __make_request() to end_that_request_last()).
196 readms = strtoull(procfile_lineword(ff, l, 6), NULL, 10); // rd_ticks_or_wr_sec
197 writems = strtoull(procfile_lineword(ff, l, 10), NULL, 10); // wr_ticks
199 // # of I/Os currently in progress
200 // The only field that should go to zero. Incremented as requests are
201 // given to appropriate struct request_queue and decremented as they finish.
202 queued_ios = strtoull(procfile_lineword(ff, l, 11), NULL, 10); // ios_pgr
204 // # of milliseconds spent doing I/Os
205 // This field increases so long as field queued_ios is nonzero.
206 busy_ms = strtoull(procfile_lineword(ff, l, 12), NULL, 10); // tot_ticks
208 // weighted # of milliseconds spent doing I/Os
209 // This field is incremented at each I/O start, I/O completion, I/O
210 // merge, or read of these stats by the number of I/Os in progress
211 // (field queued_ios) times the number of milliseconds spent doing I/O since the
212 // last update of this field. This can provide an easy measure of both
213 // I/O completion time and the backlog that may be accumulating.
214 backlog_ms = strtoull(procfile_lineword(ff, l, 13), NULL, 10); // rq_ticks
218 // remove slashes from disk names
220 for(s = disk; *s ;s++) if(*s == '/') *s = '_';
222 struct disk *d = get_disk(major, minor);
225 if(d->partition_id == -1)
226 def_enabled = enable_new_disks;
231 // Enable real disks by default.
232 // To fine out if it is a harddrive we use
233 // Linux Assigned Names and Numbers Authority (http://www.lanana.org/)
235 case 8: // SCSI disk devices (0-15)
237 def_enabled = enable_new_disks;
240 case 21: // Acorn MFM hard drive interface
242 def_enabled = enable_new_disks;
245 case 28: // ACSI disk (68k/Atari)
247 def_enabled = enable_new_disks;
250 case 36: // MCA ESDI hard disk
252 def_enabled = enable_new_disks;
255 case 48: // Mylex DAC960 PCI RAID controller; first controller
257 def_enabled = enable_new_disks;
260 case 49: // Mylex DAC960 PCI RAID controller; second controller
262 def_enabled = enable_new_disks;
265 case 50: // Mylex DAC960 PCI RAID controller; third controller
267 def_enabled = enable_new_disks;
270 case 51: // Mylex DAC960 PCI RAID controller; fourth controller
272 def_enabled = enable_new_disks;
275 case 52: // Mylex DAC960 PCI RAID controller; fifth controller
277 def_enabled = enable_new_disks;
280 case 53: // Mylex DAC960 PCI RAID controller; sixth controller
282 def_enabled = enable_new_disks;
285 case 54: // Mylex DAC960 PCI RAID controller; seventh controller
287 def_enabled = enable_new_disks;
290 case 55: // Mylex DAC960 PCI RAID controller; eigth controller
292 def_enabled = enable_new_disks;
295 case 65: // SCSI disk devices (16-31)
297 def_enabled = enable_new_disks;
300 case 66: // SCSI disk devices (32-47)
302 def_enabled = enable_new_disks;
305 case 67: // SCSI disk devices (48-63)
307 def_enabled = enable_new_disks;
310 case 68: // SCSI disk devices (64-79)
312 def_enabled = enable_new_disks;
315 case 69: // SCSI disk devices (80-95)
317 def_enabled = enable_new_disks;
320 case 70: // SCSI disk devices (96-111)
322 def_enabled = enable_new_disks;
325 case 71: // SCSI disk devices (112-127)
327 def_enabled = enable_new_disks;
330 case 80: // I2O hard disk
332 def_enabled = enable_new_disks;
335 case 81: // I2O hard disk
337 def_enabled = enable_new_disks;
340 case 82: // I2O hard disk
342 def_enabled = enable_new_disks;
345 case 83: // I2O hard disk
347 def_enabled = enable_new_disks;
350 case 84: // I2O hard disk
352 def_enabled = enable_new_disks;
355 case 85: // I2O hard disk
357 def_enabled = enable_new_disks;
360 case 86: // I2O hard disk
362 def_enabled = enable_new_disks;
365 case 87: // I2O hard disk
367 def_enabled = enable_new_disks;
370 case 128: // SCSI disk devices (128-143)
372 def_enabled = enable_new_disks;
375 case 129: // SCSI disk devices (144-159)
377 def_enabled = enable_new_disks;
380 case 130: // SCSI disk devices (160-175)
382 def_enabled = enable_new_disks;
385 case 131: // SCSI disk devices (176-191)
387 def_enabled = enable_new_disks;
390 case 132: // SCSI disk devices (192-207)
392 def_enabled = enable_new_disks;
395 case 133: // SCSI disk devices (208-223)
397 def_enabled = enable_new_disks;
400 case 134: // SCSI disk devices (224-239)
402 def_enabled = enable_new_disks;
405 case 135: // SCSI disk devices (240-255)
407 def_enabled = enable_new_disks;
410 case 136: // Mylex DAC960 PCI RAID controller; nineth controller
412 def_enabled = enable_new_disks;
415 case 137: // Mylex DAC960 PCI RAID controller; tenth controller
417 def_enabled = enable_new_disks;
420 case 138: // Mylex DAC960 PCI RAID controller; eleventh controller
422 def_enabled = enable_new_disks;
425 case 139: // Mylex DAC960 PCI RAID controller; twelfth controller
427 def_enabled = enable_new_disks;
430 case 140: // Mylex DAC960 PCI RAID controller; thirteenth controller
432 def_enabled = enable_new_disks;
435 case 141: // Mylex DAC960 PCI RAID controller; fourteenth controller
437 def_enabled = enable_new_disks;
440 case 142: // Mylex DAC960 PCI RAID controller; fifteenth controller
442 def_enabled = enable_new_disks;
445 case 143: // Mylex DAC960 PCI RAID controller; sixteenth controller
447 def_enabled = enable_new_disks;
450 case 160: // Carmel 8-port SATA Disks on First Controller
452 def_enabled = enable_new_disks;
455 case 161: // Carmel 8-port SATA Disks on Second Controller
457 def_enabled = enable_new_disks;
465 char *mount_point = d->mount_point;
466 char *family = d->mount_point;
467 if(!family) family = disk;
469 int ddo_io = do_io, ddo_ops = do_ops, ddo_mops = do_mops, ddo_iotime = do_iotime, ddo_qops = do_qops, ddo_util = do_util, ddo_backlog = do_backlog, ddo_space = do_space;
471 // check which charts are enabled for this disk
473 char var_name[4096 + 1];
474 snprintfz(var_name, 4096, "plugin:proc:/proc/diskstats:%s", disk);
475 def_enabled = config_get_boolean_ondemand(var_name, "enabled", def_enabled);
476 if(def_enabled == CONFIG_ONDEMAND_NO) continue;
477 if(def_enabled == CONFIG_ONDEMAND_ONDEMAND && !reads && !writes) continue;
480 ddo_io = config_get_boolean_ondemand(var_name, "bandwidth", ddo_io);
481 ddo_ops = config_get_boolean_ondemand(var_name, "operations", ddo_ops);
482 ddo_mops = config_get_boolean_ondemand(var_name, "merged operations", ddo_mops);
483 ddo_iotime = config_get_boolean_ondemand(var_name, "i/o time", ddo_iotime);
484 ddo_qops = config_get_boolean_ondemand(var_name, "queued operations", ddo_qops);
485 ddo_util = config_get_boolean_ondemand(var_name, "utilization percentage", ddo_util);
486 ddo_backlog = config_get_boolean_ondemand(var_name, "backlog", ddo_backlog);
487 ddo_space = config_get_boolean_ondemand(var_name, "space", ddo_space);
489 // by default, do not add charts that do not have values
490 if(ddo_io == CONFIG_ONDEMAND_ONDEMAND && !reads && !writes) ddo_io = 0;
491 if(ddo_mops == CONFIG_ONDEMAND_ONDEMAND && mreads == 0 && mwrites == 0) ddo_mops = 0;
492 if(ddo_iotime == CONFIG_ONDEMAND_ONDEMAND && readms == 0 && writems == 0) ddo_iotime = 0;
493 if(ddo_util == CONFIG_ONDEMAND_ONDEMAND && busy_ms == 0) ddo_util = 0;
494 if(ddo_backlog == CONFIG_ONDEMAND_ONDEMAND && backlog_ms == 0) ddo_backlog = 0;
495 if(ddo_qops == CONFIG_ONDEMAND_ONDEMAND && backlog_ms == 0) ddo_qops = 0;
497 // for absolute values, we need to switch the setting to 'yes'
498 // to allow it refresh from now on
499 if(ddo_qops == CONFIG_ONDEMAND_ONDEMAND) config_set(var_name, "queued operations", "yes");
504 // --------------------------------------------------------------------
506 int sector_size = 512;
508 st = rrdset_find_bytype(RRD_TYPE_DISK, disk);
510 char tf[FILENAME_MAX + 1], *t;
511 char ssfilename[FILENAME_MAX + 1];
513 strncpyz(tf, disk, FILENAME_MAX);
515 // replace all / with !
516 while((t = strchr(tf, '/'))) *t = '!';
518 snprintfz(ssfilename, FILENAME_MAX, path_to_get_hw_sector_size, tf);
519 FILE *fpss = fopen(ssfilename, "r");
522 char *tmp = fgets(ssbuffer, 1024, fpss);
525 sector_size = atoi(tmp);
526 if(sector_size <= 0) {
527 error("Invalid sector size %d for device %s in %s. Assuming 512.", sector_size, disk, ssfilename);
531 else error("Cannot read data for sector size for device %s from %s. Assuming 512.", disk, ssfilename);
535 else error("Cannot read sector size for device %s from %s. Assuming 512.", disk, ssfilename);
537 st = rrdset_create(RRD_TYPE_DISK, disk, NULL, family, "disk.io", "Disk I/O Bandwidth", "kilobytes/s", 2000, update_every, RRDSET_TYPE_AREA);
539 rrddim_add(st, "reads", NULL, sector_size, 1024, RRDDIM_INCREMENTAL);
540 rrddim_add(st, "writes", NULL, sector_size * -1, 1024, RRDDIM_INCREMENTAL);
542 else rrdset_next_usec(st, dt);
544 last_readsectors = rrddim_set(st, "reads", readsectors);
545 last_writesectors = rrddim_set(st, "writes", writesectors);
549 // --------------------------------------------------------------------
552 st = rrdset_find_bytype("disk_ops", disk);
554 st = rrdset_create("disk_ops", disk, NULL, family, "disk.ops", "Disk Completed I/O Operations", "operations/s", 2001, update_every, RRDSET_TYPE_LINE);
557 rrddim_add(st, "reads", NULL, 1, 1, RRDDIM_INCREMENTAL);
558 rrddim_add(st, "writes", NULL, -1, 1, RRDDIM_INCREMENTAL);
560 else rrdset_next_usec(st, dt);
562 last_reads = rrddim_set(st, "reads", reads);
563 last_writes = rrddim_set(st, "writes", writes);
567 // --------------------------------------------------------------------
570 st = rrdset_find_bytype("disk_qops", disk);
572 st = rrdset_create("disk_qops", disk, NULL, family, "disk.qops", "Disk Current I/O Operations", "operations", 2002, update_every, RRDSET_TYPE_LINE);
575 rrddim_add(st, "operations", NULL, 1, 1, RRDDIM_ABSOLUTE);
577 else rrdset_next_usec(st, dt);
579 rrddim_set(st, "operations", queued_ios);
583 // --------------------------------------------------------------------
586 st = rrdset_find_bytype("disk_backlog", disk);
588 st = rrdset_create("disk_backlog", disk, NULL, family, "disk.backlog", "Disk Backlog", "backlog (ms)", 2003, update_every, RRDSET_TYPE_AREA);
591 rrddim_add(st, "backlog", NULL, 1, 10, RRDDIM_INCREMENTAL);
593 else rrdset_next_usec(st, dt);
595 rrddim_set(st, "backlog", backlog_ms);
599 // --------------------------------------------------------------------
602 st = rrdset_find_bytype("disk_util", disk);
604 st = rrdset_create("disk_util", disk, NULL, family, "disk.util", "Disk Utilization Time", "% of time working", 2004, update_every, RRDSET_TYPE_AREA);
607 rrddim_add(st, "utilization", NULL, 1, 10, RRDDIM_INCREMENTAL);
609 else rrdset_next_usec(st, dt);
611 last_busy_ms = rrddim_set(st, "utilization", busy_ms);
615 // --------------------------------------------------------------------
618 st = rrdset_find_bytype("disk_mops", disk);
620 st = rrdset_create("disk_mops", disk, NULL, family, "disk.mops", "Disk Merged Operations", "merged operations/s", 2021, update_every, RRDSET_TYPE_LINE);
623 rrddim_add(st, "reads", NULL, 1, 1, RRDDIM_INCREMENTAL);
624 rrddim_add(st, "writes", NULL, -1, 1, RRDDIM_INCREMENTAL);
626 else rrdset_next_usec(st, dt);
628 rrddim_set(st, "reads", mreads);
629 rrddim_set(st, "writes", mwrites);
633 // --------------------------------------------------------------------
636 st = rrdset_find_bytype("disk_iotime", disk);
638 st = rrdset_create("disk_iotime", disk, NULL, family, "disk.iotime", "Disk Total I/O Time", "milliseconds/s", 2022, update_every, RRDSET_TYPE_LINE);
641 rrddim_add(st, "reads", NULL, 1, 1, RRDDIM_INCREMENTAL);
642 rrddim_add(st, "writes", NULL, -1, 1, RRDDIM_INCREMENTAL);
644 else rrdset_next_usec(st, dt);
646 last_readms = rrddim_set(st, "reads", readms);
647 last_writems = rrddim_set(st, "writes", writems);
651 // --------------------------------------------------------------------
655 st = rrdset_find_bytype("disk_space", disk);
657 st = rrdset_create("disk_space", disk, NULL, family, "disk.space", "Disk Space Usage", "Megabyte", 2023, update_every, RRDSET_TYPE_AREA);
660 rrddim_add(st, "avail", NULL, 1, 1048576, RRDDIM_ABSOLUTE);
661 rrddim_add(st, "reserved for root", NULL, 1, 1048576, RRDDIM_ABSOLUTE);
662 rrddim_add(st, "used" , NULL, 1, 1045576, RRDDIM_ABSOLUTE);
664 else rrdset_next_usec(st, dt);
668 if (statvfs(family, buff_statvfs) < 0) {
669 error("Faild checking disk space usage of %s", family);
671 space_avail = buff_statvfs->f_bavail * buff_statvfs->f_bsize;
672 space_avail_root = (buff_statvfs->f_bfree - buff_statvfs->f_bavail) * buff_statvfs->f_bsize;
673 space_used = (buff_statvfs->f_blocks - buff_statvfs->f_bfree) * buff_statvfs->f_bsize;
676 rrddim_set(st, "avail", space_avail);
677 rrddim_set(st, "reserved for root", space_avail_root);
678 rrddim_set(st, "used", space_used);
681 if(ddo_space != CONFIG_ONDEMAND_ONDEMAND) {
682 error("Cannot find space usage for disk %s. It does not have a mount point.", family);
687 // --------------------------------------------------------------------
688 // calculate differential charts
689 // only if this is not the first time we run
692 if(ddo_iotime && ddo_ops) {
693 st = rrdset_find_bytype("disk_await", disk);
695 st = rrdset_create("disk_await", disk, NULL, family, "disk.await", "Average Completed I/O Operation Time", "ms per operation", 2005, update_every, RRDSET_TYPE_LINE);
698 rrddim_add(st, "reads", NULL, 1, 1, RRDDIM_ABSOLUTE);
699 rrddim_add(st, "writes", NULL, -1, 1, RRDDIM_ABSOLUTE);
701 else rrdset_next_usec(st, dt);
703 rrddim_set(st, "reads", (reads - last_reads) ? (readms - last_readms) / (reads - last_reads) : 0);
704 rrddim_set(st, "writes", (writes - last_writes) ? (writems - last_writems) / (writes - last_writes) : 0);
708 if(ddo_io && ddo_ops) {
709 st = rrdset_find_bytype("disk_avgsz", disk);
711 st = rrdset_create("disk_avgsz", disk, NULL, family, "disk.avgsz", "Average Completed I/O Operation Bandwidth", "kilobytes per operation", 2006, update_every, RRDSET_TYPE_AREA);
714 rrddim_add(st, "reads", NULL, sector_size, 1024, RRDDIM_ABSOLUTE);
715 rrddim_add(st, "writes", NULL, -sector_size, 1024, RRDDIM_ABSOLUTE);
717 else rrdset_next_usec(st, dt);
719 rrddim_set(st, "reads", (reads - last_reads) ? (readsectors - last_readsectors) / (reads - last_reads) : 0);
720 rrddim_set(st, "writes", (writes - last_writes) ? (writesectors - last_writesectors) / (writes - last_writes) : 0);
724 if(ddo_util && ddo_ops) {
725 st = rrdset_find_bytype("disk_svctm", disk);
727 st = rrdset_create("disk_svctm", disk, NULL, family, "disk.svctm", "Average Service Time", "ms per operation", 2007, update_every, RRDSET_TYPE_LINE);
730 rrddim_add(st, "svctm", NULL, 1, 1, RRDDIM_ABSOLUTE);
732 else rrdset_next_usec(st, dt);
734 rrddim_set(st, "svctm", ((reads - last_reads) + (writes - last_writes)) ? (busy_ms - last_busy_ms) / ((reads - last_reads) + (writes - last_writes)) : 0);