Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

Running commands on remote machines

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 12-06-2012
SkySmart SkySmart is offline
Registered User
 
Join Date: Dec 2006
Last Activity: 29 September 2016, 7:48 PM EDT
Posts: 781
Thanks: 582
Thanked 3 Times in 3 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 Unix and Linux 12-06-2012
joeyg's Unix or Linux Image
joeyg joeyg is offline Forum Staff  
modérateur
 
Join Date: Dec 2007
Last Activity: 26 September 2016, 11:28 AM EDT
Location: Within two miles of a Dunkin donuts.
Posts: 2,409
Thanks: 99
Thanked 177 Times in 163 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 Unix and Linux 12-06-2012
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 29 September 2016, 9:13 AM EDT
Location: NM
Posts: 10,825
Thanks: 446
Thanked 968 Times in 899 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
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 09:31 PM.