[ZBX-9456] system.cpu.util returns 0 all the time Created: 2015 Apr 06  Updated: 2017 May 30  Resolved: 2015 May 27

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.4.4
Fix Version/s: 2.0.15rc1, 2.2.10rc1, 2.4.6rc1, 2.5.0

Type: Incident report Priority: Minor
Reporter: Mark Patruck Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: cpu, items, openbsd
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OpenBSD 5.7-current (amd64,i386)



 Description   

Since Zabbix 2.4.x (tried 2.4.3 and 2.4.4) on OpenBSD 5.7-current, system.cpu.util returns 0 all the time. Wrt to ZBX-9067, system.cpu.util returns 0 directly after zabbix agent has been restarted and minutes/hours/days later...doesn't matter.

system.cpu.util = ERROR

zabbix_agentd[6422]: listener #3 [processing request]
zabbix_agentd[6422]: Requested [system.cpu.util[,user]]
zabbix_agentd[6422]: Sending back [0.000000]

Other system.cpu.x requests work

system.cpu.load = OK

zabbix_agentd[6422]: listener #3 [processing request]
zabbix_agentd[6422]: Requested [system.cpu.load[percpu,avg15]]
zabbix_agentd[6422]: Sending back [0.362305]

zabbix_agentd[6422]: listener #3 [processing request]
zabbix_agentd[6422]: Requested [system.cpu.load[percpu,avg1]]
zabbix_agentd[6422]: Sending back [0.395508]

I've tried on differnt machines with Intel Core2 Duo (amd64), Intel Atom (amd64), AMD Geode (i386), Intel Xeon (amd64) without success. A request from the server returns 0.



 Comments   
Comment by richlv [ 2015 Apr 07 ]

it was also mentioned that 2.2 agent on the same system work as expected - could you please add some detail on that ? thanks

Comment by Alexander Vladishev [ 2015 Apr 07 ]

Works fine on OpenBSD 3.9 (amd64, i386), 4.3 (amd64, i386), 4.7 (amd64, i386) and 5.4 (amd64, i386). Should be checked on OpenBSD 5.7.

Comment by Mark Patruck [ 2015 Apr 07 ]

OpenBSD 5.7 (amd64, i386) + zabbix 2.2.5 returns 0 as well
OpenBSD 5.5 (amd64, i386) + zabbix 2.2.5 returns correct values != 0

Comment by Alexander Vladishev [ 2015 Apr 09 ]

Seems the final version of OpenBSD 5.7 is not released yet. Let us wait the release!

Comment by Mark Patruck [ 2015 Apr 09 ]

Waiting for 5.7 won't help. I've tested with OpenBSD 5.7 (release, dated a mid March 2015).

Meanwhile, i've installed a fresh OpenBSD 5.6 + zabbix-agent 2.2.5 (package), see below.

Test with "openssl speed" running on that OpenBSD 5.6 machine

while true; do { zabbix_get -s CLIENT -I SERVER -k system.cpu.util; sleep 4; } done
0.297030
8.630363
15.297030
21.963696
28.630363
35.297030
43.630363
45.396040 (openssl speed stopped)
45.396040
45.396040
45.396040
45.396040
45.396040
45.396040
45.396040
40.099010
33.432343
26.765677
18.432343
^C
Comment by Aleksandrs Saveljevs [ 2015 Apr 13 ]

Mark, did you encounter ZBX-9467 when building the agent for OpenBSD 5.7?

Comment by Mark Patruck [ 2015 Apr 13 ]

@Aleksandrs: No, i'm using OpenBSD packages only.

Comment by Igors Homjakovs (Inactive) [ 2015 May 13 ]

Fixed in svn://svn.zabbix.com/branches/dev/ZBX-9456

Comment by Igors Homjakovs (Inactive) [ 2015 May 13 ]

In OpenBSD 5.7 the header file sys/dkstat.h is not used anymore. The configure script disabled system.cpu.util check because this file was missing. In the proposed fix the missing header file was substituted with sys/sched.h file which has all the necessary definitions.

Comment by Aleksandrs Saveljevs [ 2015 May 14 ]

http://archives.neohapsis.com/archives/openbsd/2014-09/0367.html (or http://permalink.gmane.org/gmane.os.openbsd.tech/38389 with a better formatting) looks like an (semi-)official OpenBSD discussion regarding removing sys/dkstat.h.

Comment by Aleksandrs Saveljevs [ 2015 May 14 ]

(1) File sys/sched.h is present in many operating systems, see http://fxr.watson.org/fxr/source/sys/sched.h?v=NETBSD5 , and there it contains definitions that we do not need. Since we only need it on OpenBSD, why don't we include it only in cpustat.c for OpenBSD?

igorsh RESOLVED in r53644.

asaveljevs CLOSED

Comment by Aleksandrs Saveljevs [ 2015 May 14 ]

(2) configure.in is missing a space after "sys/sched.h".

igorsh RESOLVED in r53644.

asaveljevs CLOSED

Comment by Aleksandrs Saveljevs [ 2015 May 14 ]

(3) This is not necessarily a problem, but something to think about. Based on changes in development branch, we will now include both sys/dkstat.h and sys/sched.h, where present. On older systems, both of these files contain CP_USER and other definitions that we need for CPU collection. Due to https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html , there is no warning, because macro values are effectively the same. Still, is it good?

igorsh RESOLVED in r53644.

In this fix sys/sched.h file is added only on OpenBSD platforms if sys/dkstat.h is not present.

asaveljevs Please take a look at r53692. It attempts to improve style a bit and adds an explanatory comment. Still RESOLVED.

igorsh Thank you. Looks good. CLOSED.

Comment by Mark Patruck [ 2015 May 15 ]

I've made the changes according to svn://svn.zabbix.com/branches/dev/ZBX-9456 but a freshly built zabbix package still shows 0.000000 when queried by the server (several hours after restarting zabbix_agentd)

Comment by Aleksandrs Saveljevs [ 2015 May 15 ]

The changes in development branch modify "configure.in". Have you run "bootstrap.sh" to regenerate "configure" script?

Comment by Mark Patruck [ 2015 May 15 ]

yes

Comment by Mark Patruck [ 2015 May 19 ]

Built a new package and with dropping sys/dkstat.h and including sys/sched.h in src/zabbix_agent/cpustat.c it works now on OpenBSD 5.7-current i386/amd64.Updated a few test machines and not a single 0.00000 the last 24 hours.

Comment by Igors Homjakovs (Inactive) [ 2015 May 25 ]

Available in 2.0.15rc1 r53765, 2.2.10rc1 r53766, 2.4.6rc1 r53768 and 2.5.0 (trunk) r53769.

Generated at Fri Apr 19 08:59:33 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.