[ZBX-5609] change default disk check in freebsd from hda to da0 Created: 2012 Sep 24  Updated: 2017 May 30  Resolved: 2012 Oct 09

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.1.0
Fix Version/s: 2.0.4rc1, 2.1.0

Type: Incident report Priority: Minor
Reporter: Sean Chittenden Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: agent, freebsd
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

FreeBSD


Attachments: Text File freebsd-agentd-crash.patch    

 Description   

`zabbix_agent -p` crashes on FreeBSD. The attached patch at least prevents the crash, though it doesn't prevent zabbix_agentd from returning prematurely. This patch also includes a small fix for vfs.dev.*. FreeBSD doesn't have hda, it uses da0 (most likely).



 Comments   
Comment by richlv [ 2012 Sep 25 ]

crash is probably a duplicate of ZBX-5473 (already fixed for 2.0.3)

let's leave this issue for changing default disk device

Comment by Alexander Vladishev [ 2012 Sep 26 ]

Yes, crash has been already fixed in ZBX-5473.

Comment by Alexander Vladishev [ 2012 Sep 26 ]

FreeBSD disk organization: http://www.freebsd.org/doc/handbook/disk-organization.html

Disk Device Codes
Code Meaning
ad ATAPI (IDE) disk
da SCSI direct access disk
acd ATAPI (IDE) CDROM
cd SCSI CDROM
fd Floppy disk
Sample Disk, Slice, and Partition Names
Name Meaning
ad0s1a The first partition (a) on the first slice (s1) on the first IDE disk (ad0).
da1s2e The fifth partition (e) on the second slice (s2) on the second SCSI disk (da1).

Use of "da0" will be more logical. It should be corrected.

Comment by Sean Chittenden [ 2012 Sep 26 ]

Correct. Given that almost all disks these days are SAS/SATA and show up as da(4) devices, use of da(4) is correct (vs ada(4)).

Comment by Alexander Vladishev [ 2012 Sep 26 ]

The same problem with OpenBSD.

Related link: http://www.openbsd.org/faq/faq14.html#intro

Code Meaning
wd IDE disks (and devices that look like IDE disks, for example, SATA, MFM or ESDI disks, or a flash device with an appropriate adapter) attached to a wdc(4) or pciide(4) interface.
sd Devices that utilize SCSI commands, such as SCSI disks attached to a SCSI adapter, USB disks, SATA disks attached to an ahci(4) interface, and disk arrays attached to a RAID controller.

"sd0" should be used as example.

Comment by Alexander Vladishev [ 2012 Sep 26 ]

Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-5609 r30371.

Comment by Andris Mednis [ 2012 Sep 28 ]

Successfully tested.

Comment by Alexander Vladishev [ 2012 Oct 03 ]

Fixed in pre-2.0.4 r30504 and pre-2.1.0 (trunk) r30505.

Comment by Sean Chittenden [ 2012 Oct 05 ]

Actually, this doens't crash any more, but the vfs.dev.read and vfs.dev.write are returning not supported, incorrectly.

zabbix_agentd -p | grep vfs.dev
vfs.dev.read [m|ZBX_NOTSUPPORTED]
vfs.dev.write [m|ZBX_NOTSUPPORTED]

But when I run manually:

zabbix_agentd -t 'vfs.dev.read[da0,operations]'
vfs.dev.read[da0,operations] [u|2105562]

It returns the right count. Omitting the second argument, things error out because ops isn't implemented correctly?

zabbix_agentd -t 'vfs.dev.read[da0]'
vfs.dev.read[da0] [m|ZBX_NOTSUPPORTED]

zabbix_agentd -t 'vfs.dev.read[da0,ops]'
vfs.dev.read[da0,ops] [m|ZBX_NOTSUPPORTED]
zabbix_agentd -t 'vfs.dev.read[da0,operations]'
vfs.dev.read[da0,operations] [u|2105641]
zabbix_agentd -t 'vfs.dev.read[da0,bytes]'
vfs.dev.read[da0,bytes] [u|110616835392]
zabbix_agentd -t 'vfs.dev.read[da0,bps]'
vfs.dev.read[da0,bps] [m|ZBX_NOTSUPPORTED]

Could we maybe change the default to be operations and not bps? operations per second is a much more useful metric than the bandwidth transferred, tbh. -sc

Index: src/libs/zbxsysinfo/freebsd/diskio.c
===================================================================
— src/libs/zbxsysinfo/freebsd/diskio.c (revision 30681)
+++ src/libs/zbxsysinfo/freebsd/diskio.c (working copy)
@@ -124,7 +124,7 @@
if (0 != get_param(param, 2, tmp, sizeof(tmp)))
*tmp = '\0';

  • if ('\0' == *tmp || 0 == strcmp(tmp, "bps")) /* default parameter */
    + if ('\0' == *tmp || 0 == strcmp(tmp, "operations")) /* default parameter */
    type = ZBX_DSTAT_TYPE_BPS;
    else if (0 == strcmp(tmp, "ops"))
    type = ZBX_DSTAT_TYPE_OPS;
Comment by Sean Chittenden [ 2012 Oct 05 ]

The second argument needs to be changed in order to be useful to people.

Comment by Alexander Vladishev [ 2012 Oct 08 ]

What version you used?

The crash was fixed under ZBX-5473 in version 2.0.3.
The default arguments for vfs.dev.read/write was fixed in version pre-2.0.4 (not released).

Comment by Sean Chittenden [ 2012 Oct 08 ]

2.0.3, and yes, in 2.0.3 the agent didn't crash, but its default values returned no information.

I haven't tried anything from svn/branches/2.0 yet, but it looks like r30710 of branches/2.0/src/libs/zbxsysinfo/freebsd/diskio.c is still showing "bps" and not operations. Wouldn't it make more sense to have the default operations always be counters and not rates? Requiring state in either the kernel or the agent to yield a rate seems like it should be optional and derived value, but shouldn't replace "truth" in the form of a raw counter.

Comment by Andris Mednis [ 2012 Oct 09 ]

For "zabbix_agentd -p" keys "vfs.dev.read" and "vfs.dev.write" the default parameter was changed to "operations" while fixing this ZBX-5609 (in files src/libs/zbxsysinfo/freebsd/freebsd.c, src/libs/zbxsysinfo/linux/linux.c, src/libs/zbxsysinfo/openbsd/openbsd.c, src/libs/zbxsysinfo/solaris/solaris.c).
For other cases we cannot change current default parameter (e.g. "bps") to "operations" amidst current version, but can discuss it for the next version.

Generated at Tue Apr 23 17:06:28 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.