munin nginx:没有dynazoom成图

前端之家收集整理的这篇文章主要介绍了munin nginx:没有dynazoom成图前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我无法让Munin动态变焦工作.我确信这个问题与Nginx配置有关.任何生成缩放图的尝试都会在Nginx日志中触发以下错误条目:

  1. 2015/02/22 13:26:01 [error] 4782#0: *2580 open() "/data/munin/usr/share/munin/cgi/munin-cgi-graph/bellaria/antergos1.bellaria/diskstats_latency/AntergosVG_AntergosRoot-pinpoint=1421756527,1424607727.png" Failed (2: No such file or directory),client: 10.10.10.25,server: munin,request: "GET /usr/share/munin/cgi/munin-cgi-graph/bellaria/antergos1.bellaria/diskstats_latency/AntergosVG_AntergosRoot-pinpoint=1421756527,1424607727.png?&lower_limit=&upper_limit=&size_x=800&size_y=400 HTTP/1.1",host: "munin.bellaria",referrer: "http://munin.bellaria/static/dynazoom.html?cgiurl_graph=/usr/share/munin/cgi/munin-cgi-graph&plugin_name=bellaria/antergos1.bellaria/diskstats_latency/AntergosVG_AntergosRoot&size_x=800&size_y=400&start_epoch=1421756527&stop_epoch=1424607727"

具体来说,我怀疑fastCGI参数有问题.愿一个好友好的灵魂看看我的Munin虚拟服务器(见下文)并向我解释有什么问题?它让我发疯 – 但我有预感,任何专家都会在不到一秒的时间内发现问题……

  1. # Munin server
  2. server {
  3. listen 80;
  4. server_name munin munin.bellaria;
  5. root /data/munin;
  6. allow all;
  7. access_log logs/munin.access.log;
  8. error_log logs/munin.error.log;
  9. location / {
  10. index index.html index.htm index.PHP;
  11. }
  12. location ~ \.(PHP|html|html|cgi)${
  13. fastcgi_pass unix:/run/PHP-fpm/PHP-fpm.sock;
  14. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  15. fastcgi_param AUTH_USER $remote_user;
  16. fastcgi_param REMOTE_USER $remote_user;
  17. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  18. fastcgi_index index.PHP;
  19. include fastcgi.conf;
  20. }
  21. location ^~ /cgi-bin/munin-cgi-graph/ {
  22. access_log off;
  23. fastcgi_split_path_info ^(/cgi-bin/munin-cgi-graph)(.*);
  24. fastcgi_param PATH_INFO $fastcgi_path_info;
  25. fastcgi_pass unix:/var/run/munin/fcgi-graph.sock;
  26. include fastcgi_params;
  27. }
  28. }
最佳答案
我在寻找解决问题和好消息的同时找到了这个!我解决了我的问题.我希望这也可以帮助你让munin在你的设置上工作.

要求:
> spawnfcgi:

>从https://github.com/lighttpd/spawn-fcgi克隆或下载邮政编码
>准备:

  1. autoreconf -v -i

>编译和安装:

  1. ./configure && make && sudo make install

>初始化脚本(我不做systemd所以弄清楚如何制作服务):

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: munin-fastcgi
  4. # required-Start: $remote_fs $network
  5. # required-Stop: $remote_fs $network
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: starts munin-fastcgi
  9. # Description: Spawn Munin FCGI sockets for Web access
  10. ### END INIT INFO
  11.  
  12. #
  13. # munin-fastcgi Startup script for Munin CGI services
  14. #
  15. # chkconfig: - 84 15
  16. # description: Loading Munin CGI services using spawn-cgi
  17. # HTML files and CGI.
  18. #
  19. # Author: Ryan Norbauer
  20. # Modified: Geoffrey Grosenbach http://topfunky.com
  21. # Modified: David Krmpotic http://davidhq.com
  22. # Modified: Kun Xi http://kunxi.org
  23. # Modified: http://drumcoder.co.uk/
  24. # Modified: http://uname.pingveno.net/
  25. # Modified: the_architecht http://iwbyt.com/
  26. PATH=/usr/local/bin/:/usr/local/sbin:$PATH
  27. DAEMON=$(which spawn-fcgi)
  28. FCGI_GRAPH_SOCK=/var/run/munin/fastcgi-munin-graph.sock
  29. FCGI_HTML_SOCK=/var/run/munin/fastcgi-munin-html.sock
  30. WWW_USER=www-data
  31. FCGI_USER=www-data
  32. FCGI_GROUP=www-data
  33. FCGI_SPAWN_GRAPH=/usr/lib/munin/cgi/munin-cgi-graph
  34. FCGI_SPAWN_HTML=/usr/lib/munin/cgi/munin-cgi-html
  35. PIDFILE_GRAPH=/var/run/munin/fastcgi-munin-graph.pid
  36. PIDFILE_HTML=/var/run/munin/fastcgi-munin-html.pid
  37. DESC="Munin FCGI for Graph and HTML"
  38.  
  39. # Gracefully exit if the package has been removed.
  40. test -x $DAEMON || exit 0
  41. test -x $FCGI_SPAWN_GRAPH || exit 0
  42. test -x $FCGI_SPAWN_HTML || exit 0
  43.  
  44. start() {
  45. $DAEMON -s $FCGI_GRAPH_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_GRAPH $FCGI_SPAWN_GRAPH 2> /dev/null || echo "Graph Already running"
  46. $DAEMON -s $FCGI_HTML_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_HTML $FCGI_SPAWN_HTML 2> /dev/null || echo "HTML Already running"
  47. }
  48.  
  49. stop() {
  50. kill -QUIT `cat $PIDFILE_GRAPH` || echo "Graph not running"
  51. kill -QUIT `cat $PIDFILE_HTML` || echo "HTML Not running"
  52. }
  53.  
  54. restart() {
  55. kill -HUP `cat $PIDFILE_GRAPH` || echo "Can't reload Graph"
  56. kill -HUP `cat $PIDFILE_HTML` || echo "Can't reload HTML"
  57. }
  58.  
  59. case "$1" in
  60. start)
  61. echo "Starting $DESC: "
  62. start
  63. ;;
  64. stop)
  65. echo "Stopping $DESC: "
  66. stop
  67. ;;
  68. restart|reload)
  69. echo "Restarting $DESC: "
  70. stop
  71. # One second might not be time enough for a daemon to stop,# if this happens,d_start will fail (and dpkg will break if
  72. # the package is being upgraded). Change the timeout if needed
  73. # be,or change d_stop to have start-stop-daemon use --retry.
  74. # Notice that using --retry slows down the shutdown process somewhat.
  75. sleep 1
  76. start
  77. ;;
  78. *)
  79. echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
  80. exit 3
  81. ;;
  82. esac
  83.  
  84. exit $?

在/etc/init.d/munin-fcgi下安装上面的权限755

>在您的虚拟主机中,例如/etc/Nginx/conf.d/example.com.conf,将其添加到server {}块中.您可以更改允许的ip块以适合您的设置.我在本地服务器上做了这个,并希望munin图只能在本地使用.

  1. location /munin {
  2. # alias /var/cache/munin/www;
  3. index index.html;
  4. # include /etc/Nginx/PHP.conf;
  5. # access_log off;
  6. allow 127.0.0.1;
  7. allow 192.168.0.0/16;
  8. deny all;
  9. }
  10.  
  11. location ^~ /munin-cgi/munin-cgi-graph/ {
  12. # if ($uri ~ /munin-cgi/munin-cgi-graph/([^/]*)) { set $path $1; }
  13. fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);
  14. fastcgi_param PATH_INFO $fastcgi_path_info;
  15. fastcgi_pass unix:/var/run/munin/fastcgi-munin-graph.sock;
  16. include fastcgi_params;
  17. }
  18. location ^~ /munin-cgi/munin-cgi-html/ {
  19. # if ($uri ~ /munin-cgi/munin-cgi-html/([^/]*)) { set $path $1; }
  20. fastcgi_split_path_info ^(/munin-cgi/munin-cgi-html)(.*);
  21. fastcgi_param PATH_INFO $fastcgi_path_info;
  22. fastcgi_pass unix:/var/run/munin/fastcgi-munin-html.sock;
  23. include fastcgi_params;
  24. }

>启动/etc/init.d/munin-fcgi启动并重新加载Nginx然后你就可以了.

p.s我将munin的html文件链接到我的vhost文件夹:ln -s / var / cache / munin / www / /var/www/example.com/munin -v.

猜你在找的Nginx相关文章