3 `@sLddlZddlZddlZddlmZGdddejZedkrHejdS)N) parse_statusc@seZdZdZddZdS)Pluginopenvpnc Cs`i}i}|j}y,t|jdd}t|j}WdQRXWn tk r\}z|Sd}~XnXyt|jj|d<x|jjD]\}} | j j dd| _ i|| j <t | j } t | j } |jd| j df| ||| j d<|jd| j d f| ||| j d <| |d| j d f<| |d| j df<q~WWn"tk rD}z|Sd}~XnXtj|d <|j||S) a+ OpenVPN monitoring, needs access to openvpn-status.log file. pip install openvpn-status or pip3 install openvpn-status In /etc/nixstats.ini to enable put: [openvpn] enabled = yes status_path = /etc/openvpn/openvpn-status.log test the plugin by running: sudo -u nixstats nixstatsagent test OpenVPN If you are having permission issues try to run the agent as root user: https://help.nixstats.com/en/article/running-the-monitoring-agent-as-root-user-m0ylxw/ rZ status_pathN containers.-z%s_%sZ net_out_bytesZ net_in_bytests)Zget_agent_cacheopengetrread ExceptionlenZ client_listitemsZ common_namereplaceintZ bytes_sentZbytes_receivedZabsolute_to_per_secondtimeZset_agent_cache) selfconfigZopenvpn_clients last_valueZ prev_cacheZlogfilestatusekeyclientZ bytes_outZbytes_inrG/usr/local/lib/python3.6/site-packages/nixstatsagent/plugins/openvpn.pyrun s0   ""  z Plugin.runN)__name__ __module__ __qualname__rrrrrr sr__main__) osZpluginsrZopenvpn_statusrZ BasePluginrrexecuterrrrs  2