13

我最近在我的机器上安装了 Munin。我得到了一切工作,数据实际上是在图表上绘制的!:)

但是,由于某种原因,当我单击每个单独的图表时,它会将我带到动态页面,但它都是没有图像的纯文本:(

这是我的 apache.conf:

# Enable this for template generation
Alias /munin /var/cache/munin/www

# Enable this for cgi-based templates
#Alias /munin-cgi/static /var/cache/munin/www/static
#ScriptAlias /munin-cgi /usr/lib/munin/cgi/munin-cgi-html
#<Location /munin-cgi>
#       Order allow,deny
#       Allow from localhost 127.0.0.0/8 ::1
#       AuthUserFile /etc/munin/munin-htpasswd
#       AuthName "Munin"
#       AuthType Basic
#       require valid-user
#</Location>

<Directory /var/cache/munin/www>
        Order allow,deny
        # Allow from localhost 127.0.0.0/8 ::1
        Allow from all
        Options None
        AllowOverride None

        # This file can be used as a .htaccess file, or a part of your apache
        # config file.
        #
        # For the .htaccess file option to work the munin www directory
        # (/var/cache/munin/www) must have "AllowOverride all" or something 
        # close to that set.
        #

        AuthUserFile /etc/munin/munin-htpasswd
        AuthName "Munin"
        AuthType Basic
        require valid-user

        # This next part requires mod_expires to be enabled.
        #

        # Set the default expiration time for files to 5 minutes 10 seconds from
        # their creation (modification) time.  There are probably new files by
        # that time. 
        #

    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault M310
    </IfModule>

</Directory>

# Enables fastcgi for munin-cgi-html if present
#<Location /munin-cgi>
#    <IfModule mod_fastcgi.c>
#        SetHandler fastcgi-script
#    </IfModule>
#</Location>

#<Location /munin-cgi/static>
#       SetHandler None
#</Location>

# Enables fastcgi for munin-cgi-graph if present
ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
        Order allow,deny
        Allow from localhost 127.0.0.0/8 ::1
        # AuthUserFile /etc/munin/munin-htpasswd
        # AuthName "Munin"
        # AuthType Basic
        # require valid-user
        <IfModule mod_fcgid.c>
            SetHandler fcgid-script
        </IfModule>
        <IfModule !mod_fcgid.c>
            SetHandler cgi-script
        </IfModule>
</Location>

ScriptAlias /munin-cgi/munin-cgi-html /usr/lib/munin/cgi/munin-cgi-html
<Location /munin-cgi/munin-cgi-html>
        Order allow,deny
        Allow from localhost 127.0.0.0/8 ::1
        # AuthUserFile /etc/munin/munin-htpasswd
        # AuthName "Munin"
        # AuthType Basic
        # require valid-user
        <IfModule mod_fcgid.c>
            SetHandler fcgid-script
        </IfModule>
        <IfModule !mod_fcgid.c>
            SetHandler cgi-script
        </IfModule>
</Location>

为什么这不起作用?如果我没有提供足够的信息,请告诉我。谢谢

4

8 回答 8

12

启用 apache2 cgi(或 cgid)使 dynazoom 工作。

sudo a2enmod cgi; sudo service apache2 restart
于 2014-07-16T14:46:23.773 回答
12

我在 Ubuntu 14.04 上遇到了同样的问题。

通过检查/var/log/apache2/error.log,我发现脚本抱怨缺少模块:

Can't locate CGI/Fast.pm in @INC (you may need to install the CGI::Fast module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl) at /usr/lib/munin/cgi/munin-cgi-graph line 36.

我确实安装了 CGI::Fast 模块来解决这个问题:

sudo apt-get install libcgi-fast-perl

如另一个答案所示,不需要任何重写规则。Ubuntu 14.04 中的软件包具有正确配置的路径名。

于 2014-07-13T07:54:13.323 回答
8

除了ermannob的回答;我的 apache2 error.log 报告

  AH01797: client denied by server configuration: /usr/lib/munin/cgi/munin-cgi-graph

这阻止了我在操作系统中搞乱文件权限,并导致我查看 apache 配置。所需要的只是改变

<Location /munin-cgi/munin-cgi-graph>
    Order allow,deny
    Allow from localhost 127.0.0.0/8 ::1
    ...

在 /etc/apache2/conf-enabled/munin.conf,到

<Location /munin-cgi/munin-cgi-graph>
    Require all granted
    Options FollowSymLinks SymLinksIfOwnerMatch

我不需要安装任何 fastcgi 包并按照这里的教程进行操作。他们建议直接将配置添加到 apache.conf 文件中,但是,放宽 conf-enabled/munin.conf 文件中的权限(对于 /munin、/munin-cgi/munin-cgi-graph 和 /munin-cgi/ munin-cgi-html) 就足够了。我省略了对 apache.conf 的更改。

于 2016-02-24T12:35:21.647 回答
5

在运行 Ubuntu 14.04 时,我通过将 /etc/apache2/conf-available/munin.conf 中的 apache 配置从 2.2 样式更新到 2.4,在我自己的服务器上修复了这个问题

例子:

<Directory /var/cache/munin/www>
Order allow,deny
Allow from localhost 127.0.0.0/8 ::1
....
</Directory>

需要改为

<Directory /var/cache/munin/www>
# Order allow,deny
# Allow from localhost 127.0.0.0/8 ::1
Require all granted
....
</Directory>

或者你可以做

Require host localhost

或者

Require ip 127.0.0.0/8 ::8

在此处查看有关更改的 apache 文档。当我意识到这一点时,我已经完成并安装了 FastCGI 和这个线程中列出的 perl 模块。需要对您在 munin.conf 中看到的所有位置/目录区域进行此更改。

于 2014-07-30T23:21:52.797 回答
3

我在 Debian 8 上遇到了同样的问题。我像这样编辑了文件 /etc/munin/apache24.conf:

Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
   Require all granted
   Options FollowSymLinks SymLinksIfOwnerMatch
</Directory>

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
    Require all granted
    Options FollowSymLinks SymLinksIfOwnerMatch
        <IfModule mod_fcgid.c>
            SetHandler fcgid-script
        </IfModule>
        <IfModule !mod_fcgid.c>
            SetHandler cgi-script
        </IfModule>
</Location>

然后我安装了前面提到的 libapache2-mod-fcgid。

munin-node 重启后,它工作正常。

于 2015-05-19T09:58:55.770 回答
1

我在 Ubuntu 14.04 LTS 中经历过同样的行为。原因是 dynazoom 页面中的图像 URL 使用不正确,/cgi-bin/munin-cgi-graph/而不是使用/munin-cgi/munin-cgi/graph/so 而不是在代码中查找以修复此错误,我使用快速重写规则解决了它:

RewriteRule ^/cgi-bin/munin-cgi-graph/(.*) /$1

希望这可以帮助

于 2014-07-11T09:03:36.617 回答
1

您应该更改有关 munin-cgi-graph 的配置部分,设置与主要部分相同的权限。这是您的配置:

# Enables fastcgi for munin-cgi-graph if present
ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
    Order allow,deny
    Allow from localhost 127.0.0.0/8 ::1
    # AuthUserFile /etc/munin/munin-htpasswd
    # AuthName "Munin"
    # AuthType Basic
    # require valid-user
    <IfModule mod_fcgid.c>
        SetHandler fcgid-script
    </IfModule>
    <IfModule !mod_fcgid.c>
        SetHandler cgi-script
    </IfModule>
</Location>

将其更改为:

# Enables fastcgi for munin-cgi-graph if present
ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
    Order allow,deny
    # Allow from localhost 127.0.0.0/8 ::1
    Allow from all
    AuthUserFile /etc/munin/munin-htpasswd
    AuthName "Munin"
    AuthType Basic
    require valid-user
    <IfModule mod_fcgid.c>
        SetHandler fcgid-script
    </IfModule>
    <IfModule !mod_fcgid.c>
        SetHandler cgi-script
    </IfModule>
</Location>

此外,我必须安装 libcgi-fast-perl 包,这样做:

sudo apt-get install libcgi-fast-perl

检查/var/log/apache2/error.log对我帮助很大。

于 2014-09-13T07:12:11.223 回答
0

在我的情况下,遵循https://bugs.launchpad.net/ubuntu/+source/munin/+bug/1258026http://munin-monitoring.org/wiki/MuninConfigurationMasterCGI工作。

唯一有问题的部分是在哪里放置 Apache 虚拟主机配置,结果证明放置它是/etc/apache2/sites-enabled/001-munin.conf有效的。

于 2016-04-20T13:16:06.540 回答