Help with a script?
I have a monitoring script like snippet below:
Code:
sudo sh customer@IP "perl ./monitoring-script bust_page | /home/john/mailhim.pl All I used to open different putty and run this command 20-times on the monitoring Server.This script which I run on Local Monitoring server, run on remote server, fetches the data and bring it back to local monitoring server and execute with local script called /home/john/mailhim.pl As of now I do need to provide couple of 20 times and thats cumbersome when connectivity goes down.I follow up like this: Code:
Putty Session-1 |
there are a slew of tools that let you run a command on sets of servers at once via ssh.
http://freshmeat.net/projects/pssh/ http://tentakel.biskalar.de/ if you don't need them to run strictly in parallel, why not just use a for loop: for octet in 91 92 93; do ssh foo@10.14.236.$octet:"remote command"; done If you need to run these from the machine with putty, I would install Cygwin and just script it via bash with openssh instead of putty. |
What about the password?Will it ask for single time for password?
|
Do you have ssh keys set-up?
http://www.debian-administration.org/articles/152 I like this python app for simultaneously controlling multiple ssh connections. http://www.noah.org/wiki/Pexpect |
shadow: once you've followed donnied's advice and set up key auth for ssh, then you want to load the key you create into an ssh-agent. Any ssh connections you make once the agent is running won't require you to type any passwords- the decrypted key sits in the agent, and ssh communicates with the agent at login time to get the key.
|
I don't have root credentials with the production server.
Can I use my user credentials for the same? I have root access with the local Monitoring Server but not for production servers. Can it be possible without copying anything to be monitored servers. |
Yes, the only thing that needs to be adjusted on the servers you are connecting to is to create an .ssh/authorized_keys file in the home directory of the user you connect as. As long as sshd is configured to do key auth (it almost always is), no other changes are necessary.
|
All times are GMT -5. The time now is 11:05 AM. |