Remote nodes - login and find number of processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remote nodes - login and find number of processes
# 1  
Old 07-23-2013
Remote nodes - login and find number of processes

Hello all,

This is my requirement:

1. I have 6 VMs running Apache (for Oracle EBS) as Linux user oracle.

2. From a central server (VM), I need to login to all the 6 VMs as oracle user (I have already set up ssh equivalence, so it is password less authentication).

3. Find the number of processes running as oracle user on each VM and if less than 20, something is wrong and the same information is written to a log file on the central server.

4. If it is more than 20 processes, then everything is fine.

5. My question or trouble is: How do I know that collectively, Apache is running fine for this application (Oracle EBS)?


TIA,

Regards,

Praveen
# 2  
Old 07-24-2013
You could try something like this:

Code:
ERR=0
for HOST in server1 server2 server3 server4 server5 server6
do
    NUMPS=$(ssh oracle@$HOST ps -fu oracle | wc -l)
    if [ $NUMPS -lt 20 ]
    then
        echo "Error with oracle on $HOST ($NUMPS vs 20)"
        ERR=1
    fi
done

if [ $ERR -eq 0 ]
then
    echo "Collectively, Apache is running fine"
fi

# 3  
Old 07-24-2013
Code:
ps -u oracle | wc -l

is less overhead than
Code:
ps -fu oracle | wc -l

When running as oracle, it eventually might count itself.
# 4  
Old 07-24-2013
Thanks for the replies.

My understanding is that any variable that is instantiated inside a while loop can not be used outside the loop.

So, the workaround would be to redirect the variable value to a file. Read the file outside the while loop, assign the value stored in the file to a variable and then compare it with the reference.

I feel this is a bit of a crude way to do it but it should work.

Is there any other way that it can be done?


Regards,

Praveen
# 5  
Old 07-24-2013
True for a while loop. It runs in a sub shell, i.e. works with a copy of the variable. A for loop does not run in a sub shell.
I recommend to install xymon, and use the xymon agents for Oracle (run as user xymon).
Xymon has got a web interface: global status, drill-down by a simple click. Also: alarm history, availability reports, trend analysis.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Check processes running on remote server

Hello Guys, I need some help to find out if processes are running on remote server or not. I could do 'ssh' to do that but due to some security reasons, I need to avoid the ssh & get result from remote server. Could you please suggest some that can be done without ssh or similar sort of... (8 Replies)
Discussion started by: UnknownGuy
8 Replies

2. UNIX for Dummies Questions & Answers

How do I find the number of processes running on root?

Is there a certain man command I'm missing here? I searched in ps but I couldn't find something that would give me the number of processes running on root. I only want to see the number of processes, not the processes itself. (2 Replies)
Discussion started by: l3monz
2 Replies

3. Shell Programming and Scripting

Pause processes in remote host and resume execution in another remote host

Hi, Given addresses of 2 remote machines, using a shell script is it possible to get the state of running processes in "src" stop all the processes in "src" exit out of "src" ssh into "dest" resume the state of executing processes captured in step 1 in "dest" Assumption: "src" is... (3 Replies)
Discussion started by: Saeya Darsan
3 Replies

4. Infrastructure Monitoring

Using SNMP to monitor remote processes and disk space

snmpget -v 1 -c COMMUNITYSTR hostname OID what OIDs would I use to get information on all the processes and disk space information that are on a particular host. where can i find out information on all of this? thanks (3 Replies)
Discussion started by: SkySmart
3 Replies

5. Solaris

how to login with ssh to remote system with out applying the remote root/usr password

how to login with ssh to remote system with out applying the remote root/user password with rlogin we can ujse .rhosts file but with ssh howits possible plz guide (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

6. Linux

How to find remote Linux box login account without login in to that box?

Hi, How to find remote Linux box login account without login in to that box? I don't have login account at my remote Linux box. But I need who are all having login account. How do I findout? Thanks, --Muthu. (3 Replies)
Discussion started by: Muthuselvan
3 Replies

7. Shell Programming and Scripting

Count number of Nodes created and write it to a Log file

Dear Experts, I have to count the number of AddressRecords formed in bbc.xml file using unix script file. For example: for below pasted file, I need to write an output to a log file as "No. of Address Records Created=4". Snippet of bbc.xml:- <?xml version="1.0" encoding="UTF-8" ?> -... (1 Reply)
Discussion started by: phani333
1 Replies

8. Programming

Need C program for monitoring a processes that are running in different nodes

Hey, I am doing a high availability project. I need coding(socket programming using C) to monitor processes that are running in different nodes with in a network cluster.At last if u could give me a program in C to monitor the process(whether it is running or failed),it would be very... (2 Replies)
Discussion started by: vigneshinbox
2 Replies

9. Shell Programming and Scripting

check processes on remote system?

I have a script that counts the number of oracle processes running on the system: if then and it continues based on whether or not it finds running processes. Now we would like to move oracle to a separate server, but keep the application (and this script) on the old machine. Is there a... (9 Replies)
Discussion started by: Wotan31
9 Replies

10. Solaris

How to find number of processes ?

Hi , I need to count all processes contains the pattren "FND" For Example: I was reteriving the details of all processes related to "FND" by this command $ ps -ef | grep FND but now I just wanna count them . Regards Adel (2 Replies)
Discussion started by: ArabOracle.com
2 Replies
Login or Register to Ask a Question