Created
May 24, 2018 17:51
-
-
Save mikesavtechnology/ccccc9ee4b993f27cc58ffd0a0c4b4e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OpenVPNAccessServer < Scout::Plugin | |
SACLI_SCRIPT = 'sudo /usr/local/openvpn_as/scripts/sacli VPNSummary' | |
LIMAN_SCRIPT = 'sudo /usr/local/openvpn_as/scripts/liman info' | |
def build_report | |
connected = user_output['n_clients'] | |
licensed = license['concurrent_connections'] | |
available = connected - licensed | |
report connected: connected, licensed: licensed, available: available | |
end | |
private | |
def user_output | |
JSON.parse `#{SACLI_SCRIPT}` | |
end | |
def license | |
JSON.parse `#{LIMAN_SCRIPT}`[5..-1].gsub("'", '"').chomp.downcase | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment