This is what I get:
[root@dbs01-ple03 tmp]# whoami
root
[root@dbs01-ple03 tmp]# /usr/lib/nagios/plugins/check_arcconf.sh -w 50 -c 70
RAID WARNING, 0 numParityErrors, 0 hwErrors, 68 mediumErrors
[root@dbs01-ple03 tmp]# su nagios -s /bin/bash -c "/usr/lib/nagios/plugins/check_arcconf.sh -w 50 -c 70"
(standard_in) 1: parse error
/usr/lib/nagios/plugins/check_arcconf.sh: line 55: [: : integer expression expected
/usr/lib/nagios/plugins/check_arcconf.sh: line 59: [: : integer expression expected
RAID OK, numParityErrors, hwErrors, mediumErrors
Nagios Server- Remote Plugin "Incorrect Values"
-
Shivaramakrishnan
- Posts: 71
- Joined: Tue May 15, 2012 10:11 pm
-
Shivaramakrishnan
- Posts: 71
- Joined: Tue May 15, 2012 10:11 pm
Re: Nagios Server- Remote Plugin "Incorrect Values"
Just figured out that this might be causing the problem:
if [ -n $library ]
then
TMP=`mktemp -t numerrors.XXXXXX` # Create a tmpfile to store the full test result
HTMP=`mktemp -t hwerrors.XXXXXX` # Create a tmpfile to store the full test result
MTMP=`mktemp -t mediumerrors.XXXXXX` # Create a tmpfile to store the full test result
$ARCONFLISTSTATE | grep Err | grep -v smart | grep -v drive | grep numParityErrors| awk '{print $3}' > $TMP
$ARCONFLISTSTATE | grep Err | grep -v smart | grep -v drive | grep hwErrors | awk '{print $3}' > $HTMP
$ARCONFLISTSTATE | grep Err | grep -v smart | grep -v drive | grep mediumErrors | awk '{print $3}' > $MTMP
numParityErrors=`a=$(cat $TMP) ; echo $a | tr ' ' '+'| bc`
hwErrors=`a=$(cat $HTMP) ; echo $a | tr ' ' '+'| bc`
mediumErrors=`a=$(cat $MTMP) ; echo $a | tr ' ' '+'| bc`
allerrors=`echo "$numParityErrors + $hwErrors + $mediumErrors" | bc`
check_error_count
rm -rf $TMP
rm -rf $HTMP
rm -rf $MTMP
Since I am creating a temp file to store the result ,May be the file permissions of the temp file is causing the causing the problem.Can u please let me know if there is any other bug or modifications that needs to be made?
Also wanted to know if there is a possibility of running the script from the nagios server on the remote client as root itself,If so,what are the changes that needs to be made?
In that case the problem would be solved.
if [ -n $library ]
then
TMP=`mktemp -t numerrors.XXXXXX` # Create a tmpfile to store the full test result
HTMP=`mktemp -t hwerrors.XXXXXX` # Create a tmpfile to store the full test result
MTMP=`mktemp -t mediumerrors.XXXXXX` # Create a tmpfile to store the full test result
$ARCONFLISTSTATE | grep Err | grep -v smart | grep -v drive | grep numParityErrors| awk '{print $3}' > $TMP
$ARCONFLISTSTATE | grep Err | grep -v smart | grep -v drive | grep hwErrors | awk '{print $3}' > $HTMP
$ARCONFLISTSTATE | grep Err | grep -v smart | grep -v drive | grep mediumErrors | awk '{print $3}' > $MTMP
numParityErrors=`a=$(cat $TMP) ; echo $a | tr ' ' '+'| bc`
hwErrors=`a=$(cat $HTMP) ; echo $a | tr ' ' '+'| bc`
mediumErrors=`a=$(cat $MTMP) ; echo $a | tr ' ' '+'| bc`
allerrors=`echo "$numParityErrors + $hwErrors + $mediumErrors" | bc`
check_error_count
rm -rf $TMP
rm -rf $HTMP
rm -rf $MTMP
Since I am creating a temp file to store the result ,May be the file permissions of the temp file is causing the causing the problem.Can u please let me know if there is any other bug or modifications that needs to be made?
Also wanted to know if there is a possibility of running the script from the nagios server on the remote client as root itself,If so,what are the changes that needs to be made?
In that case the problem would be solved.
Re: Nagios Server- Remote Plugin "Incorrect Values"
What are the permissions on your /tmp directory?
Also, you could run the script as root by using sudo. In this case, you would prepend /usr/bin/sudo to the command definition and add something like this to your sudoers file:
Code: Select all
ls -ld /tmpCode: Select all
nagios ALL = NOPASSWD:/usr/lib/nagios/plugins/check_arcconf.sh *