[ZBXNEXT-1300] Make CPU utilization discoverable Created: 2012 Jul 03  Updated: 2015 Jan 14  Resolved: 2014 Jul 17

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

Type: New Feature Request Priority: Major
Reporter: Simon Balz Assignee: Unassigned
Resolution: Fixed Votes: 6
Labels: discovery, items, lld, trivial
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File cpulist.vbs    

 Description   

We use Zabbix on servers with a different number of CPUs or cores.
Further it's exhausting to create items for each CPU when you have a high number of cores (which is today often the case).

Please add the CPU utilization to the low-level discovery, e.g.
system.cpu.util.discovery



 Comments   
Comment by Pavel Timofeev [ 2012 Dec 20 ]

I have two 160-core windows server and I have to monitor it!
CPU utilization discovery would be very useful.

Comment by Simon Balz [ 2012 Dec 20 ]

@Pavel:
I built my own discovery script, just put it somewhere in ZABBIX_HOME/etc/zabbix_agentd.conf/cpu.conf or so:

UserParameter=system.cpu.discovery,for cpu in $(grep processor /proc/cpuinfo  | awk '{print $3}'); do cpulist="$cpulist,"'{"{#CPU}":"'$cpu'"}'; done; echo '{"data":['${cpulist#,}']}'

This should work on any Linux-like operating system.
Note: This list only returns the single cores on a box, use the pre-existing CPU items to monitor the average CPU usage of the system.

Comment by Pavel Timofeev [ 2012 Dec 27 ]

@Simon
I don't know VBS, but google helped me and I made this script:

Set oShell = WScript.CreateObject("WScript.Shell")
Set oEnv = oShell.Environment("SYSTEM")
num = oEnv("NUMBER_OF_PROCESSORS")-1

Dim arrCpu()
ReDim arrCpu(num)
Dim i

For i=0 to num
	arrCpu\(i) = "{""{#CPU}"":""" & i & """}"
Next

WScript.Echo "{""data"":["
WScript.Echo (Join(arrCpu,","))
WScript.Echo "]}"

zabbix_agentd.conf:

UserParameter=system.cpu.discovery, cscript //NoLogo C:\zabbix\bin\cpulist.vbs
Comment by David [ 2013 Feb 22 ]

@Pavel
Thanks! That worked great!

Comment by Pavel Timofeev [ 2013 Mar 15 ]

FreeBSD variant:

#!/bin/sh

total=`sysctl -n hw.ncpu`
cpu=0

while [ $cpu -lt $total ]; do
        cpulist="$cpulist,"'{"{#CPU}":"'$cpu'"}'
        cpu=$(($cpu+1))
done

echo '{"data":['${cpulist#,}']}'
Comment by Aleksej Ivanov (Inactive) [ 2013 Apr 16 ]

Available in the development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1300

Comment by richlv [ 2013 Apr 16 ]

Aleksej, for which operating systems was this implemented ?

Comment by Aleksej Ivanov (Inactive) [ 2013 Apr 17 ]

Full support on Linux and FreeBSD, support for online processors only on OpenBSD, NetBSD and Windows. OSx support will be added later.

Comment by Andris Zeila [ 2013 Apr 19 ]

(1) about freebsd CPU discovery. We should not rely on external utilities (grep) to parse file. I think it should be done manually.

wiper CLOSED as not relevant anymore

Comment by Andris Zeila [ 2013 Apr 19 ]

Please review my changes in r35134.(which was successfully tested).

Comment by Raymond Kuiper [ 2013 Dec 06 ]

Did this improvement make it into 2.2?
I don't see it documented anywhere, nor is it included in the default Linux template.

Comment by richlv [ 2013 Dec 06 ]

was not finished/merged; no specific plans as far as i know

Comment by Raymond Kuiper [ 2014 Apr 15 ]

Uhm, shouldn't this be re-opened then?

Comment by Jamshid Damanpour [ 2014 May 23 ]

If this isn't merged, it's not resolved. We're trying to stop using SNMP, but with the agent missing functionality like this, it's taking longer than it should.

Comment by Raymond Kuiper [ 2014 Jul 02 ]

Please reopen!

Comment by Juris Miščenko (Inactive) [ 2014 Jul 07 ]

Feature implemented at svn://svn.zabbix.com/branches/dev/ZBXNEXT-1300_2

Comment by Juris Miščenko (Inactive) [ 2014 Jul 14 ]

Suggested changes implemented in development branch. Please review r47305.

Comment by Andris Zeila [ 2014 Jul 15 ]

Successfully tested, please review changes in r47308

jurism Changes reviewed. Looks good. RESOLVED.

Comment by Juris Miščenko (Inactive) [ 2014 Jul 15 ]

Feature implemented in 2.3.3 (trunk) r47314.

Comment by Juris Miščenko (Inactive) [ 2014 Jul 15 ]

(2) The new feature has been documented in What's New for 2.4 at https://www.zabbix.com/documentation/2.4/manual/introduction/whatsnew240#daemon_improvements
Reference regarding platform support for the item can be found at https://www.zabbix.com/documentation/2.4/manual/appendix/items/supported_by_platform
Item description is located at https://www.zabbix.com/documentation/2.4/manual/config/items/itemtypes/zabbix_agent
Notes regarding low-level discovery use can be found here: https://www.zabbix.com/documentation/2.4/manual/discovery/low_level_discovery

<richlv>

jurism RESOLVED.

wiper CLOSED

Generated at Fri Apr 19 04:49:53 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.