Running commands on remote machines | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Running commands on remote machines

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-06-2012
SkySmart SkySmart is offline
Registered User
 
Join Date: Dec 2006
Last Activity: 21 October 2014, 9:35 PM EDT
Posts: 630
Thanks: 393
Thanked 2 Times in 2 Posts
Running commands on remote machines

so i want to monitor a variety of things on hundreds of servers. the old process was to have an agent running on each one of these servers.

but now i'm looking to see if its possible to have agentless monitoring. the only other straight forward option other than having an agent on the hosts, is to use ssh. but i dont know how to go about this.

I have 2 hosts that will serve as the monitoring servers. One will be Primary, the second will be Backup. the secondary will have the same exact setup as the primary.

what do i need to do on these two hosts to be able to log into all my servers and run the commands i need to run? vmstat, uptime, mpstat etc.

The number of servers i need to monitor is 600.
The OS running on these servers is a mixture of Sun Solaris and Linux Red Hat.
Sponsored Links
    #2  
Old 12-06-2012
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
 
Join Date: Dec 2007
Last Activity: 21 October 2014, 10:08 AM EDT
Location: Out running a Marathon.
Posts: 2,332
Thanks: 73
Thanked 155 Times in 144 Posts
You may want to reconsider

Since you did not specify what you are trying to monitor, I wanted to think of this differently...
There are 600 computers you want to analyze. So, if it take 60 seconds to connect, execute remote commands, transmit results file back, do something (on master computer), and then go to next remote computer.
That would mean ten hours, start to finish, if done sequentially. I suppose you could write something to do some in parallel?

Which brings me back to my initial premise...that this may not be possible based on the number of remote computers to analyze.

In human terms...
(a) you call 600 people to find out if they are coming for dinner
(b) receive emails of those who cannot attend

Probably easier to process the (b) list. Likewise, easier to process error files from remote computers.
The Following User Says Thank You to joeyg For This Useful Post:
SkySmart (12-07-2012)
Sponsored Links
    #3  
Old 12-06-2012
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 25 October 2014, 4:18 AM EDT
Location: NM
Posts: 10,251
Thanks: 283
Thanked 803 Times in 747 Posts
It all works the same. You have to have the SAME username on all 602 boxes, two monitoring boxes, 600 monitor-ees. Likewise everybody needs 602 home directories with an .ssh subdirectory, that has protections 600. The home directory for each has to be 755 or 751 or even 700. The perms cannot be 77[n].

You can also have a mishmash of usernames if you want, but keeping track and matching everything up is a nightmare.

The account on each remote box has to have perms to run your commands.

1. create ssh-keys on both servers, place the keys from each server on the remotes.
This is 1200 cp operations, assuming you have accounts and home directories and .ssh directories set up.

You likely already have infrastructure existing to do this - like an ftp server for everybody.

2. Run your monitoring script using ssh from one of the two monitor boxes.

Code:
ssh remotenodename 'mpstat; iostat -n'  >> /logs/remoteserver.log

Failover is up to you, if the two monitoring boxes are clustered that works.

Here is how to create your keys. The rsa.pub is the public key you send out everywhere
and place it in /home/user/.ssh/authorized_keys

ssh-keygen: password-less SSH login
The Following User Says Thank You to jim mcnamara For This Useful Post:
SkySmart (12-07-2012)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to ssh to remote unix machines using private/public key wydadi Shell Programming and Scripting 6 10-19-2010 09:10 PM
running commands to remote host from centralized host anjum.suri Shell Programming and Scripting 6 08-18-2009 10:55 AM
scp - copy between two remote machines? kungpow Solaris 6 02-04-2007 10:16 PM
How do I check file dates on remote machines decci_7 UNIX for Advanced & Expert Users 3 11-07-2006 06:58 AM
Running a script on multiple machines nattynatty UNIX for Advanced & Expert Users 8 07-07-2003 04:43 PM



All times are GMT -4. The time now is 11:17 AM.