未找到 apache 伺服器狀態。檢查 mod_status 是否啟用
我在
apache_
munin 節點上啟用了外掛:
ln -sv /usr/share/munin/plugins/apache_* /etc/munin/plugins/
使用此處重新啟動節點後,
service munin-node restart
出現以下錯誤:$ munin-node-configure --suggest 2>/dev/null | grep "apache\|Plugin\|------" Plugin | Used | Suggestions ------ | ---- | ----------- apache_accesses | yes | no [apache server-status not found. check if mod_status is enabled] apache_processes | yes | no [apache server-status not found. check if mod_status is enabled] apache_volume | yes | no [apache server-status not found. check if mod_status is enabled]
但是
mod_status
已經啟用:$ a2enmod status Module status already enabled
並且重新啟動 apache 並沒有什麼不同。
如果我嘗試手動執行外掛,這就是我得到的(我讀到獲得 U 是個壞消息,所以至少這是一致的)。
$ munin-run apache_accesses --debug # Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node # Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/ # Setting up environment # About to run '/etc/munin/plugins/apache_accesses' accesses80.value U $ munin-run apache_processes --debug # Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node # Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/ # Setting up environment # About to run '/etc/munin/plugins/apache_processes' busy80.value U idle80.value U free80.value U $ munin-run apache_volume --debug # Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node # Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/ # Setting up environment # About to run '/etc/munin/plugins/apache_volume' volume80.value U
有誰知道為什麼我仍然收到
server-status not found
消息以及如何擺脫它?更新答案 1
Location
Shane 的建議是關於使用和SetHandler
在 apache 站點中設置請求處理程序是正確的。有關更多資訊,mod_status
請參閱此頁面
munin
我可以通過查看我從/var/log/apache2/access.log
哪裡得到這個來驗證是否有效地提出了適當的請求:127.0.0.1 - - [10/Nov/2011:07:24:15 +0000] "GET /server-status?auto HTTP/1.1" 404 7774 "-" "libwww-perl/5.834
在我的情況下,設置
Location
是不夠的,因為我正在執行一個Drupal
站點,並且.htaccess
正在mod_rewrite
重寫請求。要修復它,我必須將以下行添加到我的.htaccess
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteCond %{REQUEST_URI} !=/server-status # <= added this line RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
請注意,這並不代表安全問題,因為訪問
/server-status
僅限127.0.0.1
於 apache 站點。更新答案 2
似乎
Location
根本不需要添加到 apache 站點,因為這已經在/etc/apache2/mods-enabled/status.conf
. 順便說一句,如果您想添加ExtendedStatus On
指令,那麼您應該在該文件中添加指令。
似乎它正在嘗試實際向狀態模組發出請求。您的狀態位置是否有適當的配置
VirtualHost
?像這樣的東西:<Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location>
我發現我可以跑
$ wget http://localhost/server-status?auto
但不是
$ wget http://127.0.0.1/server-status?auto
第一個是命中預設伺服器,第二個是虛擬伺服器。
所以我明確添加了一個 apache 部分
/etc/munin/plugin-conf.d/munin-node
[apache_*] env.url http://localhost:%d/server-status?auto env.ports 80
並得到了我的 munin apache 圖表。