加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

munin nginx:没有dynazoom成图

发布时间:2020-12-13 21:26:02 所属栏目:Nginx 来源:网络整理
导读:我无法让Munin动态变焦工作.我确信这个问题与Nginx配置有关.任何生成缩放图的尝试都会在nginx日志中触发以下错误条目: 2015/02/22 13:26:01 [error] 4782#0: *2580 open() "/data/munin/usr/share/munin/cgi/munin-cgi-graph/bellaria/antergos1.bellaria/d

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

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虚拟服务器(见下文)并向我解释有什么问题?它让我发疯 – 但我有预感,任何专家都会在不到一秒的时间内发现问题……

# Munin server
server {
       listen 80;
    server_name munin munin.bellaria;
    root /data/munin;
    allow all;
    access_log logs/munin.access.log;
    error_log logs/munin.error.log;

    location / {
        index index.html index.htm index.php;
        }

    location ~ .(php|html|html|cgi)${
        fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param   AUTH_USER $remote_user;
        fastcgi_param   REMOTE_USER $remote_user;
        fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_index  index.php;
        include        fastcgi.conf;
        }


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

   }
最佳答案
我在寻找解决问题和好消息的同时找到了这个!我解决了我的问题.我希望这也可以帮助你让munin在你的设置上工作.

要求:
> spawnfcgi:

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

autoreconf -v -i

>编译和安装:

./configure && make && sudo make install

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

#! /bin/sh
### BEGIN INIT INFO
# Provides:          munin-fastcgi
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts munin-fastcgi
# Description:       Spawn Munin FCGI sockets for Web access
### END INIT INFO

#
# munin-fastcgi     Startup script for Munin CGI services
#
# chkconfig: - 84 15
# description: Loading Munin CGI services using spawn-cgi
#              HTML files and CGI.
#
# Author:  Ryan Norbauer 
# Modified:     Geoffrey Grosenbach http://topfunky.com
# Modified:     David Krmpotic http://davidhq.com
# Modified:     Kun Xi http://kunxi.org
# Modified:     http://drumcoder.co.uk/
# Modified:     http://uname.pingveno.net/
# Modified:     the_architecht http://iwbyt.com/
PATH=/usr/local/bin/:/usr/local/sbin:$PATH
DAEMON=$(which spawn-fcgi)
FCGI_GRAPH_SOCK=/var/run/munin/fastcgi-munin-graph.sock
FCGI_HTML_SOCK=/var/run/munin/fastcgi-munin-html.sock
WWW_USER=www-data
FCGI_USER=www-data
FCGI_GROUP=www-data
FCGI_SPAWN_GRAPH=/usr/lib/munin/cgi/munin-cgi-graph
FCGI_SPAWN_HTML=/usr/lib/munin/cgi/munin-cgi-html
PIDFILE_GRAPH=/var/run/munin/fastcgi-munin-graph.pid
PIDFILE_HTML=/var/run/munin/fastcgi-munin-html.pid
DESC="Munin FCGI for Graph and HTML"

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
test -x $FCGI_SPAWN_GRAPH || exit 0
test -x $FCGI_SPAWN_HTML || exit 0

start() {
  $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"
  $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"
}

stop() {
  kill -QUIT `cat $PIDFILE_GRAPH` || echo "Graph not running"
  kill -QUIT `cat $PIDFILE_HTML` || echo "HTML Not running"
}

restart() {
  kill -HUP `cat $PIDFILE_GRAPH` || echo "Can't reload Graph"
  kill -HUP `cat $PIDFILE_HTML` || echo "Can't reload HTML"
}

case "$1" in
  start)
    echo "Starting $DESC: "
    start
  ;;
  stop)
    echo "Stopping $DESC: "
    stop
  ;;
  restart|reload)
    echo "Restarting $DESC: "
    stop
    # One second might not be time enough for a daemon to stop,# if this happens,d_start will fail (and dpkg will break if
    # the package is being upgraded). Change the timeout if needed
    # be,or change d_stop to have start-stop-daemon use --retry.
    # Notice that using --retry slows down the shutdown process somewhat.
    sleep 1
    start
  ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
    exit 3
  ;;
esac

exit $?

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

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

location /munin {
#    alias /var/cache/munin/www;
    index index.html;
#    include /etc/nginx/php.conf;
#    access_log off;
    allow 127.0.0.1;
    allow 192.168.0.0/16;
    deny all;                                
}

location ^~ /munin-cgi/munin-cgi-graph/ {
#   if ($uri ~ /munin-cgi/munin-cgi-graph/([^/]*)) { set $path $1; }
    fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_pass unix:/var/run/munin/fastcgi-munin-graph.sock;
    include fastcgi_params;
}
location  ^~ /munin-cgi/munin-cgi-html/ {
#   if ($uri ~ /munin-cgi/munin-cgi-html/([^/]*)) { set $path $1; }
    fastcgi_split_path_info ^(/munin-cgi/munin-cgi-html)(.*);
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_pass unix:/var/run/munin/fastcgi-munin-html.sock;
    include fastcgi_params;
}

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读