NagiosEnterprises / nrpe

NRPE Agent
GNU General Public License v2.0
263 stars 134 forks source link

NRPE's action when an unreadable cfg file is found #184

Closed techwolf359 closed 4 years ago

techwolf359 commented 6 years ago

We use include_dir to define a directory that has config files for various services. When this directory is read, and nrpe (on startup) encounters an error (in our case, permission denied), the logger receives an error:

Unable to open config file '/path/to/file.cfg' Continuing with errors...

It seems any single file read error prevents the remainder of the files from being loaded.

Suggestion: If unable to open any files, skip just the error and continue loading the remainder of the files.

Steps to Reproduce 1) Configure include_dir for NRPE 2) Place 2 files in the directory. I suggest each one have a different check command. For description sake, let's call file 1 check_disk.cfg and file 2, check_uptime.cfg, each with a working check command for its respective file.

At this point, starting NRPE should allow you execute both commands in the files.

3) chown root:root check_disk.cfg ; chmod 600 check_disk.cfg 4) Reload NRPE

At this point, you should get the error that check_disk.cfg is unable to be loaded. Attempt to execute both commands. Neither should work.

box293 commented 6 years ago

Thanks for reporting