[Nagiosplug-help] deploy plugins to remote server(farm)
Olivier 'Babar' Raginel
nagios at babar.us
Thu Apr 17 17:05:29 CEST 2008
On Thu, Apr 17, 2008 at 10:45:07AM -0400, Jeff C. Benger wrote:
> Sorry, hari was correct, ya can't add the pwd as an arg... I was
> still on my first cup of coffee and not thinking. I'd just copy the
> keys over.
There are scp/ssh implementation which takes the parameter as an
argument, but I wouldn't advise anybody to use them (I'm thinking of
ones such as jsch, the java implementation).
As for your problem, creating a key and copying it once is easy, and
then you may loop with rsync or whatever you like.
First:
ssh-keygen -t dsa
for host in $(cat host_list); do
ssh $host "mkdir -p .ssh&&cat>.ssh/authorized_keys2" < ~/.ssh/id_dsa.pub
done
You could also use a transfert key if you don't want the default key to
do this.
Then:
for host in $(cat host_list); do
(cd /usr/local/nagios/libexec&&tar cf -.) | ssh $host "rm -rf plugins&&mkdir plugins&&cd plugins&&tar xf -"
done
If you want your plugins to be in the home directory of nagios on the
remote host, in a directory called plugins, and they are in
/usr/local/nagios/libexec on the server.
You may tune as needed. Personnally, I use something similar.
You could also use rsync, scp, or whatever you like, but I do think
tar+ssh is more prone to work anywhere, especially in an heterogenous
environment.
Cheers,
--
Babar.
More information about the Help
mailing list