此shell脚本做什么?

问题描述 投票:-3回答:1

请帮助我了解此Shell脚本的作用:

# main
for HOST in ${HOSTS}
do
URI=http://${HOST}:80
count=99
result=`/opt/splunk/bin/splunk search "index=${INDEX} sourcetype=${SOURCETYPE} SPLUNK_HEALTH_CHECK |stats count" -earliest_time ${EARLIEST} -latest_time ${LATEST} -uri ${URI} -auth ${USER}:${PASS} -preview F -output csv -timeout ${TIMEOUT} 2>&1 |grep -v count |tr -d '\n' |sed 's/"//g'`
if expr $result : '[0-9]*' > /dev/null 2>&1; then

count=$result
result="OK"
fi
date +"%Y-%m-%d %T sh=${HOST} status=\"${result}\" delay_status=$count"
done

从splunk调用此脚本时,出现以下错误:

status =“无法查询HOME变量。不能使用Auth令牌已缓存。10“ delay_status = 99

linux shell sh splunk
1个回答
0
投票

Could not look up HOME variable. Auth tokens cannot be cached

[root用户或权限设置不正确,尝试运行Splunk时通常会发生此错误。在您的情况下,您正在将USER和PASS传递到脚本中,但是bash不能正确扩展这些值(请参见https://answers.splunk.com/answers/446944/getting-error-could-not-look-up-home-variable-auth.html)。

© www.soinside.com 2019 - 2024. All rights reserved.