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
Old Unix and Linux 12-06-2012
SkySmart SkySmart is offline
Registered User
Join Date: Dec 2006
Last Activity: 17 September 2017, 1:36 AM EDT
Posts: 881
Thanks: 722
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
Old Unix and Linux 12-06-2012
joeyg's Unix or Linux Image
joeyg joeyg is offline Forum Staff  
Join Date: Dec 2007
Last Activity: 14 September 2017, 1:57 PM EDT
Location: Within two miles of a Dunkin donuts.
Posts: 2,456
Thanks: 126
Thanked 192 Times in 173 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
Old Unix and Linux 12-06-2012
jim mcnamara jim mcnamara is offline Forum Staff  
Join Date: Feb 2004
Last Activity: 23 September 2017, 5:47 PM EDT
Location: NM
Posts: 11,182
Thanks: 560
Thanked 1,093 Times in 1,009 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.

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:36 PM.