get process information remotely

Hello,
We have a domain where instances attached to it are in multiple machines. Is there any way that I can get the process information of the domain of a secondary server from the primary.
ssh authentication is enabled on the functional ID and if I scsu to that ID and do the ssh: [machine1]$ssh machine2
I want to incorporate in a script in primary machine, which will ssh and get the `ps -ef | grep $DOMAIN` information.
But I am not able to get the right command....Please help

Thanks
Chiru