tonyseek / openvpn-status

Parse OpenVPN status logs in Python
https://openvpn-status.readthedocs.io
MIT License
83 stars 31 forks source link

RFE: real-time checking against a management socket #10

Closed gcoxmoz closed 1 year ago

gcoxmoz commented 6 years ago

The logfile regenerates on a time delay (looks to be 'once a minute'?). Would it be feasible to have a code path that let you specify the management socket instead of a logfile, and pull the real-time status?

(there's a lurking second-question RFE here of "and if you can do that, you'll be most of the way towards allowing me to issue socket commands like 'kill SOMEUSER', so can I get that too?") But I'll settle for this issue being scoped as 'real time status'.

Thanks!

TomDeBacker commented 6 years ago

If you get the management socket working and can read it you could do something like this:

temp = io.StringIO(statusoutputstring)
status = parse_status(temp.getvalue())

statusoutputstring is a string. This is how I'm doing it.