Munindynamicgraphics缩放(dynazoom)不起作用(Nginx,PHP-FPM)

Debian 7.5 Nginx / 1.6.0 PHP 5.6.0RC2(fpm-fcgi)(built:Jul 11​​ 2014 08:17:52)Munin v2.0.21-2

我在网上search了几天来解决我的问题,但似乎没有人知道该怎么做。 我得到了穆宁和运行,但穆宁dynamicgraphics变焦(dynazoom)不工作,它似乎是一个CGI问题我已经用lighttpd和Apache使用spawnfcgitesting穆宁和一切工作正常,但不是与php5-fpm。 在缩放屏幕上显示的graphics,但不是与php5-fpm它只是显示一个破碎的图像链接就像这张图片http://serversupportforum.de/forum/attachments/monitoring/4901d1373968950-munin-dynazoom-funktioniert-nicht-1592281191 .png “Munindynamicgraphics缩放(dynazoom)”

现在很多人都在用php-fpm来使用Nginx,所以我认为这对很多人来说都是很有帮助的。 例如: https : //stackoverflow.com/questions/18645812/munin-dynamic-graph-zoom-dynazoom-not-working-centos6-nginx-php-fpm

这是我的nginxconfiguration文件:

user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # nginx-passenger config ## # Uncomment it if you installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } #mail { # # See sample authentication script at: # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript # # # auth_http localhost/auth.php; # # pop3_capabilities "TOP" "USER"; # # imap_capabilities "IMAP4rev1" "UIDPLUS"; # # server { # listen localhost:110; # protocol pop3; # proxy on; # } # # server { # listen localhost:143; # protocol imap; # proxy on; # } #} 

这是我的Vhost文件:

 server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php index.html index.htm; # Make site accessible from http://localhost/ server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location /munin/ { alias /var/cache/munin/www/; index index.html index.htm index.php; } location /munin/static/ { alias /etc/munin/static/; index index.html index.htm index.php; } location ^~ munin-cgi/munin-cgi-graph/ { fastcgi_pass unix:/tmp/php-fpm.sock; fastcgi_index index.php; fastcgi_intercept_errors on; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; allow 192.168.56.1; deny all; } # redirect server error pages to the static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root /usr/share/nginx/html; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { try_files $uri =404; # fastcgi_split_path_info ^(.+\.php)(/.+)$; # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # # # With php5-cgi alone: # fastcgi_pass 127.0.0.1:9000; # # With php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # root html; # index index.html index.htm; # # location / { # try_files $uri $uri/ =404; # } #} 

Muninconfiguration文件:

 # Example configuration file for Munin, generated by 'make build' # The next three variables specifies where the location of the RRD # databases, the HTML output, logs and the lock/pid files. They all # must be writable by the user running munin-cron. They are all # defaulted to the values you see here. # dbdir /var/lib/munin htmldir /var/cache/munin/www logdir /var/log/munin rundir /var/run/munin # Where to look for the HTML templates # tmpldir /etc/munin/templates # Where to look for the static www files # staticdir /etc/munin/static # temporary cgi files are here. note that it has to be writable by # the cgi user (usually nobody or httpd). # cgitmpdir /var/lib/munin/cgi-tmp # (Exactly one) directory to include all files from. includedir /etc/munin/munin-conf.d # You can choose the time reference for "DERIVE" like graphs, and show # "per minute", "per hour" values instead of the default "per second" # graph_period second # Graphics files are generated either via cron or by a CGI process. # See http://munin-monitoring.org/wiki/CgiHowto2 for more # documentation. # Since 2.0, munin-graph has been rewritten to use the cgi code. # It is single threaded *by design* now. # graph_strategy cron # munin-cgi-graph is invoked by the web server up to very many times at the # same time. This is not optimal since it results in high CPU and memory # consumption to the degree that the system can thrash. Again the default is # 6. Most likely the optimal number for max_cgi_graph_jobs is the same as # max_graph_jobs. # #munin_cgi_graph_jobs 6 # If the automatic CGI url is wrong for your system override it here: # #cgiurl_graph /munin-cgi/munin-cgi-graph # max_size_x and max_size_y are the max size of images in pixel. # Default is 4000. Do not make it too large otherwise RRD might use all # RAM to generate the images. # max_size_x 4000 max_size_y 4000 # HTML files are normally generated by munin-html, no matter if the # files are used or not. You can change this to on-demand generation # by following the instructions in http://munin-monitoring.org/wiki/CgiHowto2 # # Notes: # - moving to CGI for HTML means you cannot have graph generated by cron. # - cgi html has some bugs, mostly you still have to launch munin-html by hand # html_strategy cron # munin-update runs in parallel. # # The default max number of processes is 16, and is probably ok for you. # # If set too high, it might hit some process/ram/filedesc limits. # If set too low, munin-update might take more than 5 min. # # If you want munin-update to not be parallel set it to 0. # max_processes 16 # RRD updates are per default, performed directly on the rrd files. # To reduce IO and enable the use of the rrdcached, uncomment it and set it to # the location of the socket that rrdcached uses. # #rrdcached_socket /var/run/rrdcached.sock # Drop [email protected] and [email protected] an email everytime # something changes (OK -> WARNING, CRITICAL -> OK, etc) #contact.someuser.command mail -s "Munin notification" [email protected] #contact.anotheruser.command mail -s "Munin notification" [email protected] # # For those with Nagios, the following might come in handy. In addition, # the services must be defined in the Nagios server as well. #contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf # a simple host tree [localhost.localdomain] address 127.0.0.1 use_node_name yes # # A more complex example of a host tree # ## First our "normal" host. # [fii.foo.com] # address foo # ## Then our other host... # [fay.foo.com] # address fay # ## IPv6 host. note that the ip adress has to be in brackets # [ip6.foo.com] # address [2001::1234:1] # ## Then we want totals... # [foo.com;Totals] #Force it into the "foo.com"-domain... # update no # Turn off data-fetching for this "host". # # # The graph "load1". We want to see the loads of both machines... # # "fii=fii.foo.com:load.load" means "label=machine:graph.field" # load1.graph_title Loads side by side # load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load # # # The graph "load2". Now we want them stacked on top of each other. # load2.graph_title Loads on top of each other # load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load # load2.dummy_field.draw AREA # We want area instead the default LINE2. # load2.dummy_field.label dummy # This is needed. Silly, really. # # # The graph "load3". Now we want them summarised into one field # load3.graph_title Loads summarised # load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load # load3.combined_loads.label Combined loads # Must be set, as this is # # not a dummy field! # ## ...and on a side note, I want them listen in another order (default is ## alphabetically) # # # Since [foo.com] would be interpreted as a host in the domain "com", we # # specify that this is a domain by adding a semicolon. # [foo.com;] # node_order Totals fii.foo.com fay.foo.com # 

munin-nodeconfiguration文件:

 # # Example config-file for munin-node # log_level 4 log_file /var/log/munin/munin-node.log pid_file /var/run/munin/munin-node.pid background 1 setsid 1 user root group root # This is the timeout for the whole transaction. # Units are in sec. Default is 15 min # # global_timeout 900 # This is the timeout for each plugin. # Units are in sec. Default is 1 min # # timeout 60 # Regexps for files to ignore ignore_file [\#~]$ ignore_file DEADJOE$ ignore_file \.bak$ ignore_file %$ ignore_file \.dpkg-(tmp|new|old|dist)$ ignore_file \.rpm(save|new)$ ignore_file \.pod$ # Set this if the client doesn't report the correct hostname when # telnetting to localhost, port 4949 # #host_name localhost.localdomain # A list of addresses that are allowed to connect. This must be a # regular expression, since Net::Server does not understand CIDR-style # network notation unless the perl module Net::CIDR is installed. You # may repeat the allow line as many times as you'd like allow ^127\.0\.0\.1$ allow ^::1$ # If you have installed the Net::CIDR perl module, you can use one or more # cidr_allow and cidr_deny address/mask patterns. A connecting client must # match any cidr_allow, and not match any cidr_deny. Note that a netmask # *must* be provided, even if it's /32 # # Example: # # cidr_allow 127.0.0.1/32 # cidr_allow 192.0.2.0/24 # cidr_deny 192.0.2.42/32 # Which address to bind to; host * # host 127.0.0.1 # And which port port 4949 

你有错误的fastcgi_pass参数,它应该将请求传递给spawn-fcgi,就像munin的wiki说的不是php-fpm一样。

对于Ubuntu / Debian:

 sudo apt-get install spawn-fcgi spawn-fcgi -s /var/run/munin/fcgi-graph.sock -U www-data -u www-data -g www-data /usr/lib/munin/cgi/munin-cgi-graph 

不要忘记修复nginx的位置,然后重新启动它:

  location ^~ /munin-cgi/munin-cgi-graph/ { access_log off; fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*); fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass unix:/var/run/munin/fcgi-graph.sock; include fastcgi_params; }