Skip to content
Snippets Groups Projects
Commit 5db78f94 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

check writable response file; output with _log instead of echo

parent 48141cfb
No related branches found
No related tags found
No related merge requests found
...@@ -314,19 +314,19 @@ function processCheck(){ ...@@ -314,19 +314,19 @@ function processCheck(){
eval $myFullscript $myparams > $_outfile eval $myFullscript $myparams > $_outfile
rc=$? rc=$?
if [ ! -w $_outfile ]; then 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." _log "${_logPrefix} ERROR: output file $_outfile is not writable."
ls -ld ${dir_data} $_outfile _log "${_logPrefix} $( ls -ld ${dir_data} $_outfile )"
exit 1 exit 1
fi fi
typeset -i local iTsEnd=`date +%s` typeset -i local iTsEnd=`date +%s`
outPerfdata=`grep '|' $_outfile | cut -f 2 -d '|'` # outPerfdata=`grep '|' $_outfile | cut -f 2 -d '|'`
echo echo
echo -------- check output: echo -------- check output:
cat $_outfile cat $_outfile
echo echo
echo -------- extracted performance data: # echo -------- extracted performance data:
echo $outPerfdata # echo $outPerfdata
echo # echo
_log "${_logPrefix} check command finished with returncode $rc" _log "${_logPrefix} check command finished with returncode $rc"
_rc=$_rc+$rc _rc=$_rc+$rc
...@@ -359,6 +359,11 @@ function processCheck(){ ...@@ -359,6 +359,11 @@ function processCheck(){
echo POST actions/process-check-result?service=${myHost}!${slot} "$data" echo POST actions/process-check-result?service=${myHost}!${slot} "$data"
_APIcall POST actions/process-check-result?service=${myHost}!${slot} "$data" _APIcall POST actions/process-check-result?service=${myHost}!${slot} "$data"
http.responseExport "$_response" 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 # --- check if data were sent successfully
# fgrep "HTTP/1.1 200" ${_response} >/dev/null # fgrep "HTTP/1.1 200" ${_response} >/dev/null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment