wefixit-AT / nagios_check_open_files

Nagios: Check for to many open files
GNU Lesser General Public License v3.0
1 stars 1 forks source link

Detect location of [ sudo lsof awk wc ] #1

Open box293 opened 8 years ago

box293 commented 8 years ago

Might be good to detect the location of the files:

sudo
lsof
awk
wc

Using CentOS 6.x, the first time I tried to run it I got:

!!! command failure !!! Username wrong

I installed lsof and changed the script to:

LSOF=/usr/sbin/lsof

Then when I tried to run it I got the errors:

./nagios_check_open_files.sh: line 36: /bin/sudo: No such file or directory
./nagios_check_open_files.sh: line 38: /bin/wc: No such file or directory
./nagios_check_open_files.sh: line 38: /bin/sudo: No such file or directory
(standard_in) 1: syntax error
./nagios_check_open_files.sh: line 42: [: -lt: unary operator expected
./nagios_check_open_files.sh: line 46: [: -ge: unary operator expected
./nagios_check_open_files.sh: line 49: [: -ge: unary operator expected

Once I updated these:

SUDO=/usr/bin/sudo
WC=/usr/bin/wc

It ran just fine:

./nagios_check_open_files.sh nagios

FILES OK - 18 % with 762 files open|files=762;;;
wefixit-AT commented 8 years ago

Thanks for reporting, this is a good idea. I will build this into the check.