顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== 安裝 Apache Agent 的方式 ====== * 返回 [[tech:librenms]] * 這是 SNMP Extend * Apache 要啟動 mod_status 模組 <code sh> vi /etc/httpd/conf.d/server-status.conf</code>內容大概類似以下<file> <Location "/server-status"> SetHandler server-status Order deny,allow Deny from all Allow from localhost Allow from 192.168.1.132 </Location> </file> * 重新載入設定檔進行驗證 <code sh> systemctl reload httpd curl http://localhost/server-status </code> 如果沒問題顯示結果類似以下<cli> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html><head> <title>Apache Status</title> </head><body> <h1>Apache Server Status for localhost (via 192.168.1.132)</h1> <dl><dt>Server Version: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.31</dt> <dt>Server MPM: event</dt> <dt>Server Built: Aug 8 2019 11:41:18 </dt></dl><hr/><dl> <dt>Current Time: Monday, 06-Jul-2020 11:13:36 CST</dt> <dt>Restart Time: Monday, 06-Jul-2020 10:57:54 CST</dt> : : <tr><td bgcolor="#ffffff"> cache type: <b>SHMCB</b>, shared memory: <b>512000</b> bytes, current entries: <b>1</b><br>subcaches: <b>32</b>, indexes per subcache: <b>88</b><br>time left on oldest entries' objects: avg: <b>299</b> seconds, (range: 299...299)<br>index usage: <b>0%</b>, cache usage: <b>0%</b><br>total entries stored since starting: <b>1</b><br>total entries replaced since starting: <b>0</b><br>total entries expired since starting: <b>0</b><br>total (pre-expiry) entries scrolled out of the cache: <b>0</b><br>total retrieves since starting: <b>0</b> hit, <b>0</b> miss<br>total removes since starting: <b>0</b> hit, <b>0</b> miss<br></td></tr> </table> </body></html> </cli> * 至 Apache 主機內安裝 <code sh> wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/apache-stats.py -O /etc/snmp/apache-stats.py chmod +x /etc/snmp/apache-stats.py mkdir -p /var/cache/librenms/ yum install python-urlgrabber python-pycurl </code> * 確認 apache-stats.py 可以正確執行<code sh> /etc/snmp/apache-stats.py</code> 如果正確執行應該可以看到類似的訊息<cli> 1045 28035072 .642358 1289 .810706 21749.5 26827.8 2 98 98 0 1 1 0 0 0 0 0 0 300 </cli> * 修改 snmpd 設定<code> vi /etc/snmp/snmpd.conf</code><file> : extend apache /etc/snmp/apache-stats.py </file>重新啟動 snmpd <code sh> systemctl restart snmpd </code> ===== 參考網址 ===== * https://docs.librenms.org/Extensions/Applications/#apache {{tag>librenms agent snmp_ext}} tech/librenms/apache_agent.txt 上一次變更: 2021/01/16 14:41由 jonathan