Show warning when upload was not succesful

This commit is contained in:
mboelen 2015-11-22 19:05:25 +01:00
parent 756c09cb4a
commit ce0955d05c

View File

@ -136,13 +136,12 @@ output "Settings file: ${SETTINGS_FILE}"
UPLOAD=`${CURLBINARY} ${CURL_OPTIONS} -s -S --data-urlencode "data@${REPORTFILE}" --data-urlencode "licensekey=${LICENSE_KEY}" --data-urlencode "hostid=${HOSTID}" ${UPLOAD_URL} 2> /dev/null` UPLOAD=`${CURLBINARY} ${CURL_OPTIONS} -s -S --data-urlencode "data@${REPORTFILE}" --data-urlencode "licensekey=${LICENSE_KEY}" --data-urlencode "hostid=${HOSTID}" ${UPLOAD_URL} 2> /dev/null`
EXITCODE=$? EXITCODE=$?
if [ ${EXITCODE} -gt 0 ]; then if [ ${EXITCODE} -gt 0 ]; then
#UPLOAD_CODE=`echo ${UPLOAD} | head -n 1 | awk '{ print $2 }'`
#output "Output code from upload: ${UPLOAD_CODE}"
echo "${RED}Error: ${NORMAL}Error occurred, cURL ended during the upload of the report data." echo "${RED}Error: ${NORMAL}Error occurred, cURL ended during the upload of the report data."
echo "Related exit code: ${EXITCODE}" echo "Related exit code: ${EXITCODE}"
echo "Check the last section of the log file for the exact command used, for further troubleshooting" echo "Check the last section of the log file for the exact command used, for further troubleshooting"
echo "Debug:" echo "Debug:"
echo ${UPLOAD} echo ${UPLOAD}
echo "${RED}Warning${NORMAL}: cURL could not upload data. See ${LOGFILE} for details."
# Quit # Quit
ExitClean ExitClean
fi fi