-
Incident report
-
Resolution: Fixed
-
Minor
-
1.6.9, 1.8.2, 1.9.0 (alpha)
-
None
-
Linux 2.6.18
Zabbix cannot get vfs.dev.read and vfs.dev.write about partition in Linux 2.6.0 to 2.6.25.
In src/libs/zbxsysinfo/linux/diskio.c, "PARSE(line)" has an assumption that /proc/diskstats has 11 fields per disks or partitions.
But in Linux 2.6.0 to 2.6.25, it has only 4 fields in partitions line.
Exceptionally, RHEL 5.4(2.6.18 kernel based) has also 11 fields. Becouse they backported the change.
You can find the document about /proc/diskstats in Linux kernel.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/iostats.txt;h=59a69ec67c408a54ee724df4d4a64a69a8317f68;hb=HEAD
Actually, I got following result with trunk version r12727.
$ cat /proc/diskstats |grep sda
8 0 sda 3602239 1003643 127069419 21792985 4495043 18642336 185105024 638232417 0 48096806 660036990
8 1 sda1 4616463 127067002 23138050 185104400
8 2 sda2 1497 2025 78 624
$ /usr/sbin/zabbix_get -s192.168.0.16 -kvfs.dev.read[sda1,operations]
ZBX_NOTSUPPORTED
$ /usr/sbin/zabbix_get -s192.168.0.16 -kvfs.dev.read[sda1,sectors]
ZBX_NOTSUPPORTED
I suggest to fix "PARSE(line)" for Linux 2.6 kernel like following?
It trys two times.
First try is for after Linux 2.6.25 kernel and backported kernel like RHEL5.4(2.6.18 based).
Second one is for before Linux 2.6.25 kernel.
//////////////////////////////////////////////////////////////////////////////////////////
- define PARSE(line) if(sscanf(line, "%*d %*d %s " \
ZBX_FS_UI64 " %*d " ZBX_FS_UI64 " %*d " \
ZBX_FS_UI64 " %*d " ZBX_FS_UI64 " %*d %*d %*d %*d", \
name, \
&ds[ZBX_DSTAT_R_OPER], \
&ds[ZBX_DSTAT_R_SECT], \
&ds[ZBX_DSTAT_W_OPER], \
&ds[ZBX_DSTAT_W_SECT] \
) != 5 \
&& \
sscanf(line, "%*d %*d %s " \
ZBX_FS_UI64 ZBX_FS_UI64 \
ZBX_FS_UI64 ZBX_FS_UI64, \
name, \
&ds[ZBX_DSTAT_R_OPER], \
&ds[ZBX_DSTAT_R_SECT], \
&ds[ZBX_DSTAT_W_OPER], \
&ds[ZBX_DSTAT_W_SECT] \
) != 5) continue
//////////////////////////////////////////////////////////////////////////////////////////
After applying the fix, I got following result.
$ /usr/sbin/zabbix_get -s192.168.0.16 -kvfs.dev.read[sda1,operations]
4617996
$ /usr/sbin/zabbix_get -s192.168.0.16 -kvfs.dev.read[sda1,sectors]
127116522
$ cat /proc/diskstats |grep sda
8 0 sda 3603665 1003750 127118939 21803863 4498171 18649254 185185528 638826113 1 48134852 660641568
8 1 sda1 4617996 127116522 23148114 185184912
8 2 sda2 1497 2025 78 624