【发布时间】:2014-01-23 13:51:17
【问题描述】:
我正在编写一个插件来检查对 https 站点的身份验证,然后在响应 html,body 中搜索文本以确认成功登录。我创建了以下插件
#!/bin/bash
add_uri='--no-check-certificate https://'
end_uri='/'
result=$(wget -O- $add_uri$1$end_uri --post-data=$2)
flag=`echo $result|awk '{print match($0,"QC Domain")}'`;
echo $flag
echo "Nagios refreshes properly1"
if [[ $flag -gt 0 ]] ; then
echo 'ALL SEEMS FINE!!'
exit 0
else
echo 'Some Problem'
exit 2
fi;
当我直接从命令行执行这个插件时
./check_nhttps <url here> '<very long post data with credential information>'
插件按预期工作(对于 + & - 测试用例),似乎没有问题。 但是当插件从 Nagios 运行时,
check_command check_nhttps! <url here> '<very long post data with credential information>'
它总是显示严重错误(也打印其他条件文本“Some Problem”)。 P.S:尝试用双引号发送帖子数据。
请帮忙!!!
【问题讨论】: