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
Old 12-06-2012
SkySmart SkySmart is offline
Registered User
Join Date: Dec 2006
Last Activity: 11 December 2014, 6:13 PM EST
Posts: 655
Thanks: 418
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
Old 12-06-2012
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
Join Date: Dec 2007
Last Activity: 18 December 2014, 10:22 AM EST
Location: Out running a Marathon.
Posts: 2,342
Thanks: 74
Thanked 158 Times in 145 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-08-2012)
Sponsored Links
Old 12-06-2012
jim mcnamara jim mcnamara is offline Forum Staff  
Join Date: Feb 2004
Last Activity: 19 December 2014, 2:09 PM EST
Location: NM
Posts: 10,310
Thanks: 295
Thanked 822 Times in 764 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 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-08-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 10:10 PM
running commands to remote host from centralized host anjum.suri Shell Programming and Scripting 6 08-18-2009 11:55 AM
scp - copy between two remote machines? kungpow Solaris 6 02-04-2007 11:16 PM
How do I check file dates on remote machines decci_7 UNIX for Advanced & Expert Users 3 11-07-2006 07:58 AM
Running a script on multiple machines nattynatty UNIX for Advanced & Expert Users 8 07-07-2003 05:43 PM

All times are GMT -4. The time now is 04:11 PM.