nginx+nagios,执行命令就报错:upstream prematurely closed FastCGI stdout while reading resp
精选 转载1. nagios 执行 commit的一些操作就报如下的错误:
(1) nginx, error.log :
2013/08/16 18:22:40 [error] 20050#0: *173 upstream prematurely closed FastCGI stdout while reading response header from upstream, client: 192.168.1.2, server: 192.168.1.3, request: "POST /nagios/cgi-bin/cmd.cgi HTTP/1.1", upstream: "fastcgi://unix:/usr/local/nginx/logs/perl-fcgi.sock:", host: "10.10.125.125", referrer: "http:// 192.168.1.3/nagios/cgi-bin/cmd.cgi?cmd_typ=7&host=localhost&service=Total+Processes&force_check"
(2) nginx, access.log 信息:
192.168.1.2- admin [16/Aug/2013:18:56:12 +0800] "POST /nagios/cgi-bin/cmd.cgi?cmd_typ=7&cmd_mod=2&host=localhost&service=Total+Processes&start_time=08-16-2013+18:56:11&force_check=on&btnSubmit=Commit HTTP/1.1" 200 1325 "http:// 192.168.1.3/nagios/cgi-bin/cmd.cgi?cmd_typ=7&host=localhost&service=Total+Processes&force_check" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0"
2. 但是如果从firebug中把url拿出来,通过浏览器直接访问,居然可以,不报错。
如果查看 nginx 的access.log
192.168.1.2- admin [16/Aug/2013:18:56:12 +0800] "GET /nagios/cgi-bin/cmd.cgi?cmd_typ=7&cmd_mod=2&host=localhost&service=Total+Processes&start_time=08-16-2013+18:56:11&force_check=on&btnSubmit=Commit HTTP/1.1" 200 1325 "http://192.168.1.3/nagios/cgi-bin/cmd.cgi?cmd_typ=7&host=localhost&service=Total+Processes&force_check" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0"
如果仔细看 上下 access.log的信息,一个是 POST, 一个是GET
如果通过firebug看请求,错误的是 POST, 正确的是 GET
可以大胆推测出, nginx 处理 cgi的请求貌似不能用POST,只能用GET
所以,一种方法可以修改nagios的源代码:
# cd nagios-3.2.3/cgi
# vi cmd.c
找到这行 printf(" \n", COMMAND_CGI);
把post 改为 get
然后重启 安装nagioss
# ./configure --with-command-user=nagios --with-command-group=nagios
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
重启就好了。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Linux下nginx+nagios 监控平台搭建
随着linux服务器可用性、稳定性逐步增强,企业对线上服务也要求越来越严格,需要有专门的监控系统监控服务的正常运转,并有问题及时发邮件、报警给linux SA。我们大多数nagios、cacti监控都基于apache搭建,今天我们讲一种新平台搭建nginx平台的nagios监控!一、系统运行环境服务器系统版本:Centos 5.3 &nbs
nagios cacti nginx nagios nagios nginx nagios监控nagios -
修复Nginx 502错误:upstream sent too big header while reading response header from upstream
cookies的值
java经验集锦 通用实践 Nginx nginx php