使用者工具

網站工具


tech:zabbix:openvpn

openvpn 納入 Zabbix 監控

@openvpn Server 設定程序

  • 安裝相關的套件
    yum install zabbix-sender nc
  • OpenVPN 設定啟用 management 功能
    • /etc/selinux/config 內要關閉 SELINUX=disabled
    • vi /etc/openvpn/server.conf
      :
      :
      management 127.0.0.1 7505
      service openvpn restart
      netstat -na | grep 7505
      [[email protected] ~]# netstat -na | grep 7505
      tcp        0      0 127.0.0.1:7505              0.0.0.0:*                   LISTEN
  • 加入 zabbix script
    • 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
  • 測試 zabbix script - openvpn_stats.sh
    /usr/local/bin/openvpn_stats.sh
    [[email protected] 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
  • 設定每分鐘回報一次
    vi /etc/crontab
    :
    # Zabbix - openvpn
    * * * * * root /usr/local/bin/openvpn_stats.sh > /tmp/openvpn_stats.log
    :
    service crond restart

@Zabbix Server 設定程序

參考網址

tech/zabbix/openvpn.txt · 上一次變更: 2015/10/06 20:59 由 jonathan