From: Alessandro Iurlano Date: Sat, 7 Jun 2008 13:16:18 +0000 (+0200) Subject: disk plugin: Use correct name under Linux 2.4 X-Git-Tag: collectd-4.4.2~11^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8c086dac4095529e02530b28fd92e50ad296acce;p=collectd.git disk plugin: Use correct name under Linux 2.4 Hello everybody. I have noticed that disk graphs are displayed by collection.cgi as disk (71687000) instead of the correct disk name on 2.4.x linux kernels. The problem seems caused by the fact that the position of disk name of /proc/partitions (used in 2.4 kernels) differs from /proc/diskstats (used in 2.6 kernels). I include as attachment a patch that seems to fix this problem. I have tested it on 2.4.20 (REDHAT 9) and 2.6.24.4 (Debian Sid) systems. Thanks a lot for Collectd. It is a _very_ useful program. Alessandro Signed-off-by: Florian Forster --- diff --git a/src/disk.c b/src/disk.c index 8feaa8df..e7372ab7 100644 --- a/src/disk.c +++ b/src/disk.c @@ -403,7 +403,7 @@ static int disk_read (void) major = atoll (fields[0]); minor = atoll (fields[1]); - disk_name = fields[2]; + disk_name = fields[2 + fieldshift]; for (ds = disklist, pre_ds = disklist; ds != NULL; pre_ds = ds, ds = ds->next) if (strcmp (disk_name, ds->name) == 0)