顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== openvpn 納入 Zabbix 監控 ====== ===== @openvpn Server 設定程序 ===== * 安裝相關的套件 <code sh> yum install zabbix-sender nc </code> * OpenVPN 設定啟用 management 功能 * /etc/selinux/config 內要關閉 SELINUX=disabled * <code sh>vi /etc/openvpn/server.conf</code><file> : : management 127.0.0.1 7505 </file><code sh> service openvpn restart </code><code sh> netstat -na | grep 7505 </code><file> [root@openvpn ~]# netstat -na | grep 7505 tcp 0 0 127.0.0.1:7505 0.0.0.0:* LISTEN </file> * 加入 zabbix script * <code sh> cd /usr/local/bin/ wget https://gist.githubusercontent.com/alice-xu/bf89c5f1174a3e793ff8/raw/316719f654f4b95b3277c4bc08f210c3fdce2bcd/zbx_functions wget https://gist.githubusercontent.com/alice-xu/2cfd97766cf61c1d1ba4/raw/3d87c94db64fdcd60b072e2500d2e317aa7d3178/openvpn_stats.sh chmod a+x openvpn_stats.sh </code> * 測試 zabbix script - openvpn_stats.sh<code sh> /usr/local/bin/openvpn_stats.sh </code><file> [root@openvpn bin]# /usr/local/bin/openvpn_stats.sh SUCCESS: nclients=7,bytesin=204069,bytesout=208556 zabbix_sender [2861]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 3; total: 3; seconds spent: 0.000113"}] info from server: "processed: 0; failed: 3; total: 3; seconds spent: 0.000113" sent: 3; skipped: 0; total: 3 </file> * 設定每分鐘回報一次 <code sh> vi /etc/crontab</code><file> : # Zabbix - openvpn * * * * * root /usr/local/bin/openvpn_stats.sh > /tmp/openvpn_stats.log : </file><code sh> service crond restart </code> ==== @Zabbix Server 設定程序 ===== * 下載 [[https://gist.githubusercontent.com/alice-xu/c0831c26f8ac86f51779/raw/197206b4e44461d872683c74860250a8e8a1196e/zabbix_custom_template_for_OpenVPN.xml|zabbix_custom_template_for_OpenVPN.xml]] * 將 zabbix_custom_template_for_OpenVPN.xml 匯入至 Zabbix Server → Configuration → Templates → Import ===== 參考網址 ===== * https://gist.github.com/alice-xu * https://gist.github.com/alice-xu/2cfd97766cf61c1d1ba4 * https://gist.github.com/alice-xu/bf89c5f1174a3e793ff8 * https://gist.github.com/alice-xu/c0831c26f8ac86f51779 * https://openvpn.net/index.php/open-source/documentation/howto.html#server {{tag>openvpn zabbix}} tech/zabbix/openvpn.txt 上一次變更: 2015/10/06 20:59由 jonathan