We are using a Wyse device, Z50S. It runs a version of Linux. The tool "top" can obtain the CPU output; however, when run normally and piping the output to a file, the file has a bunch of control characters.
Using the "-b" option to top tells it to go into "batch" mode, which is exactly what we want; however, doing this gives the error:
'dumb': unknown terminal type.
I saw a fix for this at this answer (https://serverfault.com/questions/304470/problems-with-cron-script-and-term-definition-using-top-command), which (in a comment that needs to be expanded) said doing an "ln" to fake out that terminal type fixed it for them.
Apparently this version of Linux doesn't have the same terminal types in the same locations, and I don't see them elsewhere in the filesystem either. Creating the destination directory and then running the ln command ("ln -s /lib/terminfo/d/dumb /usr/share/terminfo/d/dumb") succeeds, but doesn't change the behavior of top.
Another search found this page (https://bugzilla.redhat.com/show_bug.cgi?id=130517) which indicates that on "-b" mode it should never look at the TERM, and they fixed it in 2008, in version 3.2.3. We're running 3.2.7 of top, but this device uses a version of SUSE (according to "cat /proc/version"), which appears to still have that particular bug.
Initially, we had looked at using "ps auxf" and then summing the third column, but that ended up being more than 200% at times (which appears to be because ps's CPU usage is calculated from the beginning of the process, not a "spot" check). So we needed a different way to get this info.
Is there another method of getting CPU usage? Note that we're in a restricted environment.