LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to get the running program information of remote computers? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-get-the-running-program-information-of-remote-computers-4175543420/)

Mike_Brown 05-23-2015 01:11 PM

How to get the running program information of remote computers?
 
1 Attachment(s)
I am a R user. I want to know whether remote computers are running R or not.
PROBLEM: How to know whether R program is running, and redirect the host which is running R to a file? I want to check the COMMAND column contains R. What should I do?
Here is the picture of "top" when running R programs(parallel).

Ser Olmy 05-24-2015 06:41 AM

Have you considered using SNMP?

The names of all running processes are exposed as leaves under the hrSWRunName node (numeric OID 1.3.6.1.2.1.25.4.2.1.2). Something as simple as:
Code:

snmpwalk -v 1 -c <community_name> <ip_address> .1.3.6.1.2.1.25.4.2.1.2 | grep STRING:\ \"R\"
...ought to do the trick. When you say:
Quote:

Originally Posted by Mike_Brown (Post 5366473)
PROBLEM: How to know whether R program is running, and redirect the host which is running R to a file?

...do you mean you want to generate a file containing the hostnames or IP addresses of all hosts running R?

Mike_Brown 05-24-2015 12:34 PM

Quote:

Originally Posted by Ser Olmy (Post 5366713)
Have you considered using SNMP?

The names of all running processes are exposed as leaves under the hrSWRunName node (numeric OID 1.3.6.1.2.1.25.4.2.1.2). Something as simple as:
Code:

snmpwalk -v 1 -c <community_name> <ip_address> .1.3.6.1.2.1.25.4.2.1.2 | grep STRING:\ \"R\"
...ought to do the trick. When you say:

...do you mean you want to generate a file containing the hostnames or IP addresses of all hosts running R?

Thanks. But I am using the computers on campus. They are not allowed to install other software. I wrote a shell script to scan hosts.
Code:

host_list="/home/campus27/zwang10/Desktop/cluster/program/hostlist"
HOSTS=`cat $host_list`
for line in $HOSTS
do
ssh -f $line "ps -C R | awk '{if(NR>1) print$4}'" > home/campus27/zwang10/Desktop/USED
done

Sometimes, the remote computer is offline or Someone is using Windows (dual system). Then, ssh can will stuck there. So the loop will stuck there. Here is what I want to do, if ssh takes too long time, then stop ssh to that computer and output the hostname of that desktop. Also if there is an R running, output the hostname of that desktop.
I am using tcsh.


All times are GMT -5. The time now is 02:14 AM.