I am looking for a command that I can run in a batch mode and report back to a monitoring server. I'd like a CPU usage across all CPUs (the equivalent of running top in interactive mode and then hitting the '1' key). It should work on Mac, Ubuntu and Centos.
I've tried a few commands such as from this post (How do I get an output from Linux Top in Batch Mode on every iteration?)
top -p 310-b -n2 -d 1 | grep -w 310
But it doesn't work on a mac:
invalid option or syntax: -p
Thanks for any help, Kevin