1

Our go app uses Telegraf to collect CPU measurement. Neither user nor system mode are closed to the value, which is visible via cli

cf app app_name

Sybil
  • 2,503
  • 3
  • 25
  • 36
Oleg A.
  • 136
  • 4
  • 1
    Have a look at the official docs: https://docs.cloudfoundry.org/concepts/container-security.html#cpu – Lafunamor Nov 06 '18 at 13:38
  • @Lafunamor, thanks, but it doesn't help for it is just the explanation how cpu is shared. I;d like to know how CF calculates to show the value per container. – Oleg A. Nov 07 '18 at 17:17

1 Answers1

3

Do the values in /sys/fs/cgroup/cpuacct/cpuacct.usage* come close to what you expect?

CloudFoundry's runtime Diego uses runC stats command to gather container stats (source). runC appears to leverage the kernel's CPU accounting subsystem on the cgroup (source).

However, I'm not sure this interface is the proper way for you as a user to gather the metrics. Running telegraf in an app container seems strange to me (would it run as a sidecar next to the app? Sidecars are not ready yet in CF).

What's your use case, what would you like to achieve? If you'd like to grab the container metrics for monitoring, grabbing the metrics from the firehose is probably the right interface for you: the firehose is a websocket stream to grab an apps' metrics. Sample app: https://github.com/pivotalservices/app-metrics-nozzle