diff --git a/icinga-cli.sh b/icinga-cli.sh index fa2340280f4e3533df46d21bba6dbfc54dc99738..5fe128b3eb536655fdc1ff1b357b13e85a1a2c1a 100755 --- a/icinga-cli.sh +++ b/icinga-cli.sh @@ -314,19 +314,19 @@ function processCheck(){ eval $myFullscript $myparams > $_outfile rc=$? if [ ! -w $_outfile ]; then - echo "ERROR: file $_outfile is not writable. Maybe the setup is inclomplete or someone created a file as root... just guessing." - ls -ld ${dir_data} $_outfile - exit 1 + _log "${_logPrefix} ERROR: output file $_outfile is not writable." + _log "${_logPrefix} $( ls -ld ${dir_data} $_outfile )" + exit 1 fi typeset -i local iTsEnd=`date +%s` - outPerfdata=`grep '|' $_outfile | cut -f 2 -d '|'` + # outPerfdata=`grep '|' $_outfile | cut -f 2 -d '|'` echo echo -------- check output: cat $_outfile echo - echo -------- extracted performance data: - echo $outPerfdata - echo + # echo -------- extracted performance data: + # echo $outPerfdata + # echo _log "${_logPrefix} check command finished with returncode $rc" _rc=$_rc+$rc @@ -359,6 +359,11 @@ function processCheck(){ echo POST actions/process-check-result?service=${myHost}!${slot} "$data" _APIcall POST actions/process-check-result?service=${myHost}!${slot} "$data" http.responseExport "$_response" + if [ ! -w "$_response" ]; then + _log "${_logPrefix} ERROR: responsefile $_response is not writable." + _log "${_logPrefix} $( ls -ld ${dir_data} $_response )" + exit 1 + fi # --- check if data were sent successfully # fgrep "HTTP/1.1 200" ${_response} >/dev/null