====== 安裝 Apache Agent 的方式 ====== * 返回 [[tech:librenms]] * 這是 SNMP Extend * Apache 要啟動 mod_status 模組 vi /etc/httpd/conf.d/server-status.conf內容大概類似以下 SetHandler server-status Order deny,allow Deny from all Allow from localhost Allow from 192.168.1.132 * 重新載入設定檔進行驗證 systemctl reload httpd curl http://localhost/server-status 如果沒問題顯示結果類似以下 Apache Status

Apache Server Status for localhost (via 192.168.1.132)

Server Version: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.31
Server MPM: event
Server Built: Aug 8 2019 11:41:18

Current Time: Monday, 06-Jul-2020 11:13:36 CST
Restart Time: Monday, 06-Jul-2020 10:57:54 CST
: : cache type: SHMCB, shared memory: 512000 bytes, current entries: 1
subcaches: 32, indexes per subcache: 88
time left on oldest entries' objects: avg: 299 seconds, (range: 299...299)
index usage: 0%, cache usage: 0%
total entries stored since starting: 1
total entries replaced since starting: 0
total entries expired since starting: 0
total (pre-expiry) entries scrolled out of the cache: 0
total retrieves since starting: 0 hit, 0 miss
total removes since starting: 0 hit, 0 miss
* 至 Apache 主機內安裝 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 * 確認 apache-stats.py 可以正確執行 /etc/snmp/apache-stats.py 如果正確執行應該可以看到類似的訊息 1045 28035072 .642358 1289 .810706 21749.5 26827.8 2 98 98 0 1 1 0 0 0 0 0 0 300 * 修改 snmpd 設定 vi /etc/snmp/snmpd.conf : extend apache /etc/snmp/apache-stats.py 重新啟動 snmpd systemctl restart snmpd ===== 參考網址 ===== * https://docs.librenms.org/Extensions/Applications/#apache {{tag>librenms agent snmp_ext}}