7

400以上のノードのmunin-1.4.xをインストールしました。これをmunin-2.xにアップグレードして、muninマスターサーバーでのCGIベースのコンテンツ生成(htmlとグラフ)を利用します。私は公式のdox(http://munin-monitoring.org/wiki/CgiHowto2)を調べましたが、それは単に機能していません。それは私の設定ではないVirtualHost(http://munin.example.com)のみをカバーしていますが、私はそれを出発点として使用しようとしました。

具体的には、http://example.com/muninをベースURLにして、すべてのノードを一覧表示するhtmlコンテンツを、個々のノードページへのリンクとともに動的に生成する必要があります(クリックすると動的に生成/更新されます) 。追加されたキャッチは、私がFedora(16)でこれを行っていることであり、私が見つけたハウツーの大部分は、Debian / Ubuntuを想定しています(またはcronを介した非cgi静的コンテンツ生成を想定しています)。

公式のFedoramuninパッケージは、以下をインストールします。

  • muninベースディレクトリは/var/ www / html/muninです
  • munin静的コンテンツディレクトリは/var/ www / html / munin/staticです
  • munin cgiスクリプト(munin-cg-graph&munin-cg-html)は/ var / www / html / munin/cgiにあります

これまでに行ったこと:*/etc/munin/munin.confに「html_strategycgi」と「cgiurl_graph/ munin / cgi/munin-cgi-html」を設定します*/etc / httpd / conf/httpdに以下を追加しました.conf:

# Rewrites
RewriteEngine On
Alias /static /var/www/html/munin/static
Alias /munin /var/www/html/munin
# HTML
RewriteCond %{REQUEST_URI} !^/static
RewriteCond %{REQUEST_URI} .html$ [or]
RewriteCond %{REQUEST_URI} =/
RewriteRule ^/(.*)           /var/www/html/munin/cgi/munin-cgi-html/$1 [L]
# Images
# - remove path to munin-cgi-graph, if present
RewriteRule ^/munin/cgi/munin-cgi-graph/(.*) /$1
RewriteCond %{REQUEST_URI}                 !^/static
RewriteCond %{REQUEST_URI}                 .png$
RewriteRule ^/(.*)  /var/www/html/munin/cgi/munin-cgi-graph/$1 [L]
ScriptAlias /munin/cgi/munin-cgi-graph   /var/www/html/munin/cgi/munin-cgi-graph
<Location /munin/cgi/munin-cgi-graph>
        Options +ExecCGI FollowSymLinks
        <IfModule mod_fcgid.c>
                SetHandler fcgi-script
        </IfModule>
        <IfModule !mod_fcgid.c>
                SetHandler cgi-script
        </IfModule>
</Location>
ScriptAlias /munin/cgi/munin-cgi-html   /var/www/html/munin/cgi/munin-cgi-html
<Location /munin/cgi/munin-cgi-html>
        Options +ExecCGI FollowSymLinks
        <IfModule mod_fcgid.c>
                SetHandler fcgi-script
        </IfModule>
        <IfModule !mod_fcgid.c>
                SetHandler cgi-script
        </IfModule>
</Location>

ただし、これらすべてを実行した後(およびapacheを再起動した後)、http://example.com/muninにアクセスすると、404エラーが発生し、apacheエラーログに次のように表示されます。

File does not exist: /var/www/html/munin/cgi/munin-cgi-html/munin/index.html

明らかな何かが欠けていることを願っていますが、今のところ、この機能を実現するために他に何を調整する必要があるかについて完全に途方に暮れています。ありがとう。

4

3 に答える 3

1

問題は、(VirtualHost ではなく) "場所" ベースのセットアップで構成を使用する場合、RewriteRule のフラグが間違っていることです。

mod_rewriteドキュメントによると:

 L  Stop the rewriting process immediately and don't apply any more rules.

ただし、あなたの場合、 ScriptAlias が実際にトリガーされるように /munin/cgi/munin-cgi-html を渡す必要があります。したがって:

 PT Forces the resulting URI to be passed back to the URL mapping engine for
    processing of other URI-to-filename translators, such as Alias or Redirect

ルールを変更して読む場合

RewriteRule ^/(.*)  /munin/cgi/munin-cgi-html/$1 [PT]  
....  
RewriteRule ^/(.*)  /munin/cgi/munin-cgi-graph/$1 [PT]

相対パスに注意してください。そうしないと、ScriptAlias が機能しません。

于 2013-02-07T15:30:53.077 に答える
1

私はまったく同じ問題を抱えていて、しばらく苦労しましたが、最終的には、まさにあなたが望むことを行う次の構成を思いつきました.

私のシステムは Ubuntu Server 12.10 です。何らかの理由で、私の静的ファイルは /var/cache/munin/www にあります。これが Ubuntu の標準なのか、最近の Ubuntu 12.04 からのアップグレードが原因なのかはわかりません。

    RewriteEngine On

    # HTML
    RewriteRule ^/munin/(.*\.html)?$ /munin/munin-cgi/munin-cgi-html/$1 [PT]

    # Images
    RewriteRule ^/munin/munin-cgi/munin-cgi-graph/(.*) /munin/$1
    RewriteCond %{REQUEST_URI} !^/static
    RewriteRule ^/munin/(.*.png)$ /munin/munin-cgi/munin-cgi-graph/$1 [L,PT]

    <Directory /var/cache/munin/www/>
            Order deny,allow
            Allow from all
    </Directory>

    # Ensure we can run (fast)cgi scripts
    ScriptAlias /munin/munin-cgi/munin-cgi-graph /usr/lib/cgi-bin/munin-cgi-graph
    <Location /munin/munin-cgi/munin-cgi-graph>
            Options +ExecCGI
            SetHandler fcgid-script
            Allow from all
    </Location>

    ScriptAlias /munin/munin-cgi/munin-cgi-html /usr/lib/cgi-bin/munin-cgi-html
    <Location /munin/munin-cgi/munin-cgi-html>
            Options +ExecCGI
            SetHandler fcgid-script
            Allow from all
    </Location>
于 2013-03-27T16:12:22.540 に答える
0

munin-cgi がインストールされており、依存関係が mod_fcgid であることを確認してください。

CentOS 7 では、/etc/httpd/conf.d/munin.conf にあるファイル構成に特別なパラメーターは追加されていません。

よろしく。

于 2015-03-11T22:07:21.120 に答える