Re: [Nagios-devel] Distributing plugins

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Distributing plugins

Post by Guest »

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 [] []\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. and use
the script to either push to a list of servers on the command line or
push them all.

--
Thomas





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked