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;;;
Might be good to detect the location of the files:
Using CentOS 6.x, the first time I tried to run it I got:
I installed lsof and changed the script to:
Then when I tried to run it I got the errors:
Once I updated these:
It ran just fine: