there are various ways to do this. The simplest is probably to put the shell script on SERVERNAME and then run it over ssh. For example:
scp myscript.sh SERVERNAME:
ssh -t SERVERNAME ./myscript.sh
Where in your case mysript.sh would contain something like
ps -ef |grep smon > output.txt
This would leave output.txt on the machine SERVERNAME. If you want it on the localhost, you could do something like
ssh SERVERNAME 'ps -ed | grep smon' > output.txt
There are many variations, depending on what it is you actually want to do.