[ZBXNEXT-1664] Inaccurate timekeeping in disk metrics Created: 2013 Mar 13  Updated: 2017 May 31

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent (G)
Affects Version/s: 2.0.5
Fix Version/s: None

Type: Change Request Priority: Minor
Reporter: Nathan Scott Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: diskio, patch
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux, FreeBSD (at least) affected.


Attachments: File disk-metric-timestamps.patch    

 Description   

As discussed elsewhere, the code in zabbix_agent that extracts kernel disk statistics on Linux makes some assumptions about time that are not correct. This jira request discusses one such issue, and the attached patch strives to fix it.

The rate conversion calculations being performed in apply_diskstat are using a timer resolution in seconds, as a result of the time(2) use in process_diskstat. While this may appear harmless, it is possible that different calls to time() as we pass over the device list will produce different values (near the second boundary) and this would result in incorrect rate conversion calculations by apply_diskstat.

There is also no need to request the time inside the loop which iterates over all monitored devices, this can be moved to a single time request outside the loop. If the CPU or other metrics also need accurate timestamping someday (it is somewhat surpising that no timestamps at all are inserted into the CPU metric shmem segment, for example, to reflect when the sample was actually taken), this timestamp would also be available to those.


Generated at Sun Apr 06 09:15:28 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.