how to connect to server with ssh to check process size

Hello

i have to connect to 11 servers to check the process size on every server.
how to that with shell scripting using ssh

regards

What do you mean by process size ? However, you can do that easily with "expect" scripting language, have a look at the global net or local forum resources.

what OS, what process?

for instance on linux (>2.6.9 kernel) you cat look in /proc/<pid>/status for the VmSize line i.e.

$ grep VmSize /proc/1508/status
VmSize: 4404 kB

and via ssh it would be

ssh -l <username> <host> grep VmSize /proc/1508/status

I guess one can just issue

top

command on SSH to check all info.

hello

here is the command i am using to get the process size
top | grep SS |awk '{print $6}'| cut -c 1-4

i need to run this command on 11 different servers to grep the process size from these servers

and show it to me
regards

Let's exclude grep and cut:

top | awk '/SS/{print int($6)}'

for a start, the top command will fail unless you tell it you want to run it in batch mode, as sshd will not provide a valid $TERM variable.

apart form that something along the lines of :

for serv in host1 host2 host3
do
echo 
echo $serv
ssh $serv top -n 1 -b |grep SS |awk '{print $6}'| cut -c 1-4
done

should suffice, once you've ensured that the user running the script has passwordless keys setup.

the parameters to top are
-n 1 run 1 iteration and quit
-b run in batch mode, don't look for a terminal

hello

for serv in s11s s15r s25n
do
echo
echo $serv
ssh $serv top -n 1 -b |grep SS |awk '{print $6}'| cut -c 1-4
done

it works but here is the output

s11s
This system is for the use of authorized users only.
Individuals using this computer system without authority, or in excess of their
authority, are subject to having all of their activities on this system
monitored and recorded by system personnel.

In the course of monitoring individuals improperly using this system, or in the
course of system maintenance, the activities of authorized users may also be
monitored.

Anyone using this system expressly consents to such monitoring and is advised
that if such monitoring reveals possible evidence of criminal activity, system
personnel may provide the evidence of such monitoring to law enforcement
officials.
3844

s15r
This system is for the use of authorized users only.
Individuals using this computer system without authority, or in excess of their
authority, are subject to having all of their activities on this system
monitored and recorded by system personnel.

In the course of monitoring individuals improperly using this system, or in the
course of system maintenance, the activities of authorized users may also be
monitored.

Anyone using this system expressly consents to such monitoring and is advised
that if such monitoring reveals possible evidence of criminal activity, system
personnel may provide the evidence of such monitoring to law enforcement
officials.
3298

how to get only the server name and the value
to be like this
s11s 3844
s15r 3298

regards