Plugins Nagios自定义插件(https身份验证)未按预期工作

Plugins Nagios自定义插件(https身份验证)未按预期工作,plugins,nagios,Plugins,Nagios,我正在编写一个插件来检查https站点的身份验证,然后在响应html中搜索文本,确认成功登录。我已经创建了以下插件 #!/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

我正在编写一个插件来检查https站点的身份验证,然后在响应html中搜索文本,确认成功登录。我已经创建了以下插件

#!/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>'
/检查\u nhttps“”
插件按预期工作(对于+&-测试用例),似乎没有问题。 但是当插件从Nagios运行时

check_command                   check_nhttps! <url here>  '<very long post data with    credential information>'
check\u命令check\u nhttps!'
它总是显示严重错误(也打印其他条件文本“某些问题”)。 附言:也尝试用双引号发送帖子数据


请帮忙

我认为您的post数据很可能包含一些让nagios感到困惑的字符,可能是空格,甚至是
。最好将post数据放入某个文件中并使用--post文件。此外,您还可以在脚本中插入
echo“$2”>/tmp/这是我的帖子数据,由nagios执行时,检查帖子数据是否正常。

终于让它工作了