获取NRPE:从服务器运行时无法读取输出

我正在获取NRPE:尝试使用nagios连接到Docker容器时无法读取输出。
当我直接在客户端机器上运行这个脚本时,它成功地返回了mongo db中的行数。 但是,当我从服务器远程运行它时,我无法读取输出。

executing from nagios server /usr/lib64/nagios/plugins/check_nrpe -H hostipaddress -c check_mongocount NRPE: Unable to read output 

check_mongocount脚本基本上连接到docker集装箱,并计算某个date的特定客户的行数。

 count=`sudo /bin/docker exec -it container mongo dbname --quiet -u "test" -p "test" --authenticationDatabase "test" --eval '(db.test.count( { $and: [{create_at: {$gte: NumberLong("1499227200"), $lt: NumberLong("1499313599")}},{customerid:1}]}))' 

/etc/nagios/nrpe.cfg添加了以下行。

 command[check_mongocount]=sudo /usr/lib64/nagios/plugins/test.sh 

我在我的/ etc / sudoers文件中有nrpe ALL=(ALL) NOPASSWD:ALL 。 尽pipenrpe拥有执行docker命令的所有权限,但是无法返回计数值。