I need to extract process details from top command on a few *nix systems I monitor. The details needed are username, command executed, PID, PPID, username and resident memory consumption.
If memory usage is greater than a threshold or command is illegal, I need to send a warning to the user at username@company.com
I am writing a script to do this in python and get the required data by executing 'top -bc -n 1' and grepping for command keyword. However, I also need to extract username for the illegal processes to send the mail warning. 
However, top automatically truncates usernames greater than 8 characters. How do I retrieve the full user names?
Consider using ps instead of top as I don't know any reasons why top would be better for this task. You can configure ps output much more flexibly than top one.
How to get full user name in the output of 'top' command in *nix?