Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mikesavtechnology/ccccc9ee4b993f27cc58ffd0a0c4b4e4 to your computer and use it in GitHub Desktop.
Save mikesavtechnology/ccccc9ee4b993f27cc58ffd0a0c4b4e4 to your computer and use it in GitHub Desktop.
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