NagiosEnterprises / nrpe

NRPE Agent
GNU General Public License v2.0
259 stars 133 forks source link

Feature Request :nrpe agent do some action before run check command #194

Open purplegrape opened 6 years ago

purplegrape commented 6 years ago

1、check if command is already defined,if not ,read from remote http confg file, meanwhile, download it from server as local cache,place it at /etc/nrpe.d/ eg: wget http://IP/repo/commands/${hostname}.check_redis.cfg -O /etc/nrpe.d/check_redis.cfg if got http 404,then try wget http://IP/repo/commands/check_redis.cfg -O /etc/nrpe.d/check_redis.cfg

2、check if target script exist,if not ,download it from server, eg: wget http://IP/repo/plugins/check_redis.py -O /usr/lib64/nagios/plugins/check_redis.py chmod 755 /usr/lib64/nagios/plugins/check_redis.py

3、run local check command as normal

Many thanks !

ericloyd commented 6 years ago

Our suggestion would be to remove this from NRPE and just do it as an NRPE check. You may not want automatic downloads for an invalid command. Here's what we do:

We have an NRPE check called NRPE_CONFIG_UPDATE that executes a script local to the NRPE client that uses wget to download the NRPE config file from the Nagios server (in a special location). It is called as a Nagios service check every X hours (typically, 24). It can be forced to run as needed to force updates of the NRPE config file(s). The script also issues an rsync command from a central repository (also on the Nagios server) that contains all of the appropriate executables and scripts. It also contains /etc/sudoers.d files appropriate for the permissions required for the service checks.

All without modifying NRPE, and all very much more configurable than putting this into the NRPE code.