Distributing plugins
Thomas Guyot-Sionnest
thomas at zango.com
Wed Aug 29 18:24:39 CEST 2007
Andreas Ericsson wrote:
> francois basquin wrote:
>> I often write new plugins, and I face a distribution problem: how to
>> distribute them without having to scp and editing nrpe.cfg on each server?
>>
>
> With keys and a script, this becomes a very trivial problem.
> for srv in $(cat server-list); do
> scp plugin root@$srv/path/to/plugins
> scp nrpe.cfg root@$srv/etc/nrpe.cfg
> ssh root@$srv /etc/init.d/nrpe restart
> done
Agreed. To go further I made a /etc/nrpe directory on my servers where I
can put various "role-based" and private config files (There's no
command definitions in the main nrpe.cfg file).
I.e. on the same server I can have one config file for all Linux server,
one for all web server, one for a certain type of web server, and a
server-specific config file.
I have not yet written any script to push the general configs (takes
seconds to get the server list and write my own for loop) but here's
what I use fro the private config:
#!/bin/bash
if [ "x$1" = "x-h" -o "x$1" = "x--help" ]; then
echo -e "$0\n\tPush all private configs"
echo -e "$0 <host1> [<host2>] [<host3>]\n\tPush private configs only
to specified hosts"
echo -e "\nIn all cases the remote NRPE client is HUP'ed to reload the
config.\n"
exit
fi
if [ -z "$*" ]; then
SERVLIST=`ls _private.cfg.*|cut -d. -f3-`
else
SERVLIST=$*
fi
for server in $SERVLIST; do
scp _private.cfg.$server $server:/etc/nrpe/_private.cfg
ssh $server killall -HUP nrpe
echo $server: Done.
done
Basically you have files in the form _private.cfg.<servername> and use
the script to either push to a list of servers on the command line or
push them all.
--
Thomas
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
More information about the Developers
mailing list