Assume you're using Linux as you're grepping stuff? Why not create a simlink for _proapsrv to the name of your AppServer, then modify the lauch procedure to be the name of your AppServer. That way all your AppServer agents will be running against a process that is called the name of your AppServer. Then you can grep in ps -ef for your PID, and pull out the process name, bingo - there's your AppServer name.
Hope that makes sense.