Munin动态图缩放(dynazoom)不工作(CentOS6,nginx,php-fpm)

时间:2013-09-05 20:56:01

标签: linux nginx php centos6 munin

  • CentOS 6.3
  • munin 2.0.17-1
  • php54(php-fpm)
  • nginx 1.2.6-1

通过'epel'回购设置munin,经过修补,我得到了多个节点。但是图形缩放在任何图形上都不起作用。根据我在网上找到的建议,我最终将* _strategy模式从HTML切换到cgi - 这使得所有图表都没有更新(因为cgi不起作用)并且缩放仍然被打破。

我可以在网上找到的所有指南(包括官方:http://munin-monitoring.org/wiki/CgiHowto2)都指的是使用spawnfcgi(我曾经在较旧的CentOS5服务器上使用它)并为此产生特定的实例。但是,我在这台服务器上使用php-fpm而不是spawnfcgi,我很难适应这种情况。

如果不工作,我的意思是图表不会在“缩放”屏幕上加载,而是显示损坏的图像链接。 nginx错误日志显示:

2013/09/05 16:31:59 [error] 29384#0: *2 open() "/usr/share/nginx/vhosts/munin.mydomain.com/public_html/munin-cgi/munin-cgi-graph/mydomain.com/host.mydomain.com/postfix_mailvolume-pinpoint=1378299671,1378407671.png" failed (2: No such file or directory), client: 10.30.2.1, server: munin.mydomain.com, request: "GET /munin-cgi/munin-cgi-graph/mydomain.com/host.mydomain.com/postfix_mailvolume-pinpoint=1378299671,1378407671.png?&lower_limit=&upper_limit=&size_x=800&size_y=400 HTTP/1.1", host: "munin.mydomain.com", referrer: "http://munin.mydomain.com/static/dynazoom.html?cgiurl_graph=/munin-cgi/munin-cgi-graph&plugin_name=mydomain.com/host.mydomain.com/postfix_mailvolume&size_x=800&size_y=400&start_epoch=1378299671&stop_epoch=1378407671"

这是munin.conf:

[16:42:21]$ cat /etc/munin/munin.conf | sed -e '/^#/d' -e '/^$/d'
htmldir /usr/share/nginx/vhosts/munin.mydomain.com/public_html/
includedir /etc/munin/conf.d
graph_strategy cgi
cgiurl_graph /munin-cgi/munin-cgi-graph
html_strategy cgi
[host.mydomain.com]
    address 127.0.0.1
    use_node_name yes
[otherhost.mydomain.com]
    address 1.2.3.4
    use_node_name yes

这是nginx的vhost:

[16:44:16]$ cat /etc/nginx/conf.d/vhosts/munin.thegnomedev.com.conf | sed -e '/^$/d' -e '/^#/d'
server {
    listen      80;
    server_name munin.mydomain.com;
    access_log /var/log/nginx/munin.mydomain.com combined;
    error_log /var/log/nginx/error.log warn;
    rewrite_log on;
    root    /usr/share/nginx/vhosts/munin.mydomain.com/public_html/;
    index   index.php index.html index.htm;
    location  /  {
        auth_basic            "Restricted";
        auth_basic_user_file  /usr/share/nginx/vhosts/munin.mydomain.com/.htpasswd;
    }   
    location ^~ /cgi-bin/munin-cgi-graph/ {
        fastcgi_split_path_info ^(/cgi-bin/munin-cgi-graph)(.*);
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        include fastcgi_params;
    }
    location /munin/static/ {
        alias /etc/munin/static/;
    }
    location /munin/ {
        fastcgi_split_path_info ^(/munin)(.*);
        fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        include fastcgi_params;
    }
    # Deny hidden file types
    location ~ /(\.ht|\.git|\.svn) {
    deny  all;
    }
}

此时,我感到非常沮丧,以至于我认为我正在锁定大脑。我承认,我可能不会完全理解nginx的语法以及它与php-fpm的交互方式,这可能是罪魁祸首 - 特别是如果我可以通过简单的语法更改来实现这一点。

任何有关使用现有堆栈解决此问题的帮助都将非常受欢迎。一直在谷歌搜索和尝试各种各样的事情。

由于

2 个答案:

答案 0 :(得分:2)

根据https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=1000736,这是与RHEL中的SELinx相关的错误。

Description of problem:
zooming doesn't work when selinux is in enforcing mode

Version-Release number of selected component (if applicable):
munin-2.0.17-1.el6.noarch
selinux-policy-3.7.19-195.el6_4.12.noarch
selinux-policy-targeted-3.7.19-195.el6_4.12.noarch

Steps to Reproduce:
1. click on munin graph to zoom in

Actual results:
no graph image

Expected results:
graph image

Additional info:
it works with selinux in permissive mode

如果您禁用SELinux,它可以正常工作:

sudo setenforce 0

根据错误报告中的最后一条评论,这应该在RHEL 6.5中修复(Centos应该选择它)。

答案 1 :(得分:0)

您已将location / cgi-bin / munin-cgi-graph /通过FastCGI passthrough映射到PHP-FPM,但这适用于PHP脚本,而不适用于任意CGI脚本,如Munin的CGI grapher ,实际上是Perl。要使该CGI脚本使用FastCGI协议,您需要使用的包装器将是通用的spawn-fcgi