NCPA 2.1.6 gives errors running shell scripts
Posted: Mon Mar 18, 2019 12:31 pm
After upgrading to NCPA 2.1.6 my .sh plugins started getting an error like this:
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H sclppekbb003.tvlport.net -t wspwebfarm -M api/plugins/check_status_cassandra.sh -q "args=/apps02/tpworkdir/status.log,args= Cassandra_Cluster_Status"
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
OK: RTDP Cassandra_Cluster_Status is Up
Here is the execution of the test scrip and the script itself:
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H shlgnwsad011.tvlport.net -t wspwebfarm -M api/plugins/check_test.sh
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
nagios
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
OK: Mounts are working
You have mail in /var/spool/mail/nagios
-bash-4.1$
test.sh
---------
#!/bin/bash
whoami
pwd
echo "OK: Mounts are working"
rc=0
exit $rc
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H sclppekbb003.tvlport.net -t wspwebfarm -M api/plugins/check_status_cassandra.sh -q "args=/apps02/tpworkdir/status.log,args= Cassandra_Cluster_Status"
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
OK: RTDP Cassandra_Cluster_Status is Up
Here is the execution of the test scrip and the script itself:
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H shlgnwsad011.tvlport.net -t wspwebfarm -M api/plugins/check_test.sh
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
nagios
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
OK: Mounts are working
You have mail in /var/spool/mail/nagios
-bash-4.1$
test.sh
---------
#!/bin/bash
whoami
pwd
echo "OK: Mounts are working"
rc=0
exit $rc