Accurate Netdata CPU frequency monitoring for Radeon.bapm machines using turbostat (AMD 2014+)

arglebargle

H̸̖̅ȩ̸̐l̷̦͋l̴̰̈ỏ̶̱ ̸̢͋W̵͖̌ò̴͚r̴͇̀l̵̼͗d̷͕̈
Jul 15, 2018
657
238
43
Cpufreq is no longer accurate for recent AMD machines with boost clock rates. Here's a Netdata plugin and setup instructions to allow querying turbostat for CPU frequency, this accurately reports boost clocks on a machine with radeon.bapm active.

This includes the HP T730, the DFI DT122-BE and pretty much any AMD chip post 2012-2013 (or thereabouts, someone correct me here) that relies on radeon.bapm for power management and frequency scaling.

Edit: We don't need to git clone and then patch, installing just the turbostat plugin is enough. See next post.
 
Last edited:

arglebargle

H̸̖̅ȩ̸̐l̷̦͋l̴̰̈ỏ̶̱ ̸̢͋W̵͖̌ò̴͚r̴͇̀l̵̼͗d̷͕̈
Jul 15, 2018
657
238
43
I've revised my setup scripting for this to grab only the turbostat plugin from github after installing netdata normally. You may want to fork the plugin repo to prevent unexpected/breaking future changes, I did anyway.

Code:
# install netdata with turbostat plugin ==========================
# you shouldn't be curling into bash you goon

bash <(curl -Ss https://my-netdata.io/kickstart.sh)

## taken from:
##    https://github.com/netdata/netdata/issues/3710
##
## branch/patch implementing plugin here:
##    https://github.com/tycho/netdata/commit/3167c02012973e9176c71bcd75c2b44641aaa295#diff-1e44bdc1fbe2fad255cf0b1a48175c55

wget https://raw.githubusercontent.com/tycho/netdata/implement-turbostat-module/collectors/python.d.plugin/turbostat/turbostat.chart.py -O /usr/libexec/netdata/python.d/turbostat.chart.py
chown root:netdata /usr/libexec/netdata/python.d/turbostat.chart.py

#   setup msr ACLs so turbostat plugin can function
apt install acl linux-cpupower -y
modprobe msr
setcap cap_sys_rawio=ep /usr/sbin/turbostat
groupadd --system msr
usermod -a -G msr netdata
echo 'SUBSYSTEM=="msr", GROUP="msr", MODE="0640"' > /etc/udev/rules.d/99-netdata-msr.rules
udevadm control -R
udevadm trigger
echo "msr" >> /etc/modules
systemctl restart netdata
 
Last edited: