Cannot find CPU frequency of Google Compute Engine VM

Viewed 116

I want to monitor system and application metrics with Prometheus of a VM instance (Debian) on Google Compute Engine. Among them is the CPU frequency, which Prometheus scrapes from /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq. However this does not exist.

I also checked watch -n 0.1 "cat /proc/cpuinfo | grep -i mhz", which is constant. Furthermore, I can see results with GCP's Monitoring tab, but I need a more fine-grained interval than 1 minute.

Does anyone know how I can expose the CPU frequency to Prometheus?

Cheers, Matthias

1 Answers

Compute Engine runs in virtualized environment, that's why /cpufreq is unavailable and why tools like hwinfo, dmidecode and lscpu will give static reads regardless of load.

The workaround is to use Monitoring API to pull CPU utilization data at the interval you want.

Related